2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2012-01-01 15:29:55 +01:00
|
|
|
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#ifndef PLUGININTERFACE_H
|
|
|
|
#define PLUGININTERFACE_H
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include <QPixmap>
|
2011-03-02 16:57:41 +01:00
|
|
|
#include <QtPlugin>
|
2012-04-02 19:33:05 +02:00
|
|
|
#include <QWebHitTestResult>
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-19 17:50:02 +01:00
|
|
|
#include "qz_namespace.h"
|
|
|
|
|
2012-02-19 16:01:51 +01:00
|
|
|
struct PluginSpec {
|
|
|
|
QString name;
|
|
|
|
QString info;
|
|
|
|
QString description;
|
|
|
|
QString author;
|
|
|
|
QString version;
|
2012-02-25 10:22:23 +01:00
|
|
|
QPixmap icon;
|
2012-02-19 16:01:51 +01:00
|
|
|
bool hasSettings;
|
|
|
|
|
2012-04-05 10:27:35 +02:00
|
|
|
PluginSpec() {
|
|
|
|
hasSettings = false;
|
|
|
|
}
|
|
|
|
|
2012-04-06 10:15:17 +02:00
|
|
|
bool operator==(const PluginSpec &other) const {
|
2012-02-19 16:01:51 +01:00
|
|
|
return (this->name == other.name &&
|
|
|
|
this->info == other.info &&
|
|
|
|
this->description == other.description &&
|
|
|
|
this->author == other.author &&
|
|
|
|
this->version == other.version);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
class QTranslator;
|
|
|
|
class QMenu;
|
|
|
|
class QWebHitTestResult;
|
|
|
|
class QMouseEvent;
|
|
|
|
class QKeyEvent;
|
2012-04-01 16:36:38 +02:00
|
|
|
class QWheelEvent;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2012-02-19 17:50:02 +01:00
|
|
|
class WebView;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
class PluginInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//Plugin Necessary Init Functions
|
2012-02-19 16:01:51 +01:00
|
|
|
virtual PluginSpec pluginSpec() = 0;
|
|
|
|
|
|
|
|
virtual void init(const QString &settingsPath) = 0;
|
|
|
|
virtual void unload() = 0;
|
2011-03-02 16:57:41 +01:00
|
|
|
virtual bool testPlugin() = 0;
|
|
|
|
//End Plugin Necessary Init Functions
|
|
|
|
|
2012-02-19 16:01:51 +01:00
|
|
|
virtual ~PluginInterface() { }
|
|
|
|
virtual QTranslator* getTranslator(const QString &locale) { Q_UNUSED(locale) return 0; }
|
|
|
|
virtual void showSettings(QWidget* parent = 0) { Q_UNUSED(parent) }
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-02-19 17:50:02 +01:00
|
|
|
virtual void populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) }
|
2012-02-22 18:33:44 +01:00
|
|
|
|
2012-03-05 13:16:34 +01:00
|
|
|
virtual bool mouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
2012-02-22 18:33:44 +01:00
|
|
|
virtual bool mousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
|
|
|
virtual bool mouseRelease(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
|
|
|
virtual bool mouseMove(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
|
|
|
|
2012-03-07 12:19:08 +01:00
|
|
|
virtual bool wheelEvent(const Qz::ObjectName &type, QObject* obj, QWheelEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
|
|
|
|
2012-02-22 18:33:44 +01:00
|
|
|
virtual bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
|
|
|
virtual bool keyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
2012-02-19 16:01:51 +01:00
|
|
|
Q_DECLARE_INTERFACE(PluginInterface, "QupZilla.Browser.PluginInterface/1.1")
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
#endif // PLUGININTERFACE_H
|