Falkon Develop
Cross-platform Qt-based web browser
plugininterface.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef PLUGININTERFACE_H
19#define PLUGININTERFACE_H
20
21#include <QtPlugin>
22#include <QWebEnginePage>
23
24#include "qzcommon.h"
25#include "webhittestresult.h"
26
27class QMenu;
28class QMouseEvent;
29class QKeyEvent;
30class QWheelEvent;
31
32class WebView;
33class WebPage;
34class DesktopFile;
35
37{
38public:
39 enum InitState {
42 };
43
44 virtual ~PluginInterface() = default;
45
46 virtual void init(InitState state, const QString &settingsPath) = 0;
47 virtual void unload() = 0;
48 virtual bool testPlugin() = 0;
49
50 virtual void showSettings(QWidget* parent = nullptr) { Q_UNUSED(parent) }
51
52 virtual void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) }
53 virtual void populateExtensionsMenu(QMenu *menu) { Q_UNUSED(menu) }
54
55 virtual bool mouseDoubleClick(Qz::ObjectName type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
56 virtual bool mousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
57 virtual bool mouseRelease(Qz::ObjectName type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
58 virtual bool mouseMove(Qz::ObjectName type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
59
60 virtual bool wheelEvent(Qz::ObjectName type, QObject* obj, QWheelEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
61
62 virtual bool keyPress(Qz::ObjectName type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
63 virtual bool keyRelease(Qz::ObjectName type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
64
65 virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) { Q_UNUSED(page); Q_UNUSED(url); Q_UNUSED(type); Q_UNUSED(isMainFrame); return true; }
66};
67
68Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.4")
69
70#endif // PLUGININTERFACE_H
virtual bool mouseDoubleClick(Qz::ObjectName type, QObject *obj, QMouseEvent *event)
virtual void populateExtensionsMenu(QMenu *menu)
virtual void unload()=0
virtual bool mouseMove(Qz::ObjectName type, QObject *obj, QMouseEvent *event)
virtual bool mousePress(Qz::ObjectName type, QObject *obj, QMouseEvent *event)
virtual bool wheelEvent(Qz::ObjectName type, QObject *obj, QWheelEvent *event)
virtual ~PluginInterface()=default
virtual bool mouseRelease(Qz::ObjectName type, QObject *obj, QMouseEvent *event)
virtual void showSettings(QWidget *parent=nullptr)
virtual void init(InitState state, const QString &settingsPath)=0
virtual bool keyRelease(Qz::ObjectName type, QObject *obj, QKeyEvent *event)
virtual bool keyPress(Qz::ObjectName type, QObject *obj, QKeyEvent *event)
virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame)
virtual void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r)
virtual bool testPlugin()=0
ObjectName
Definition: qzcommon.h:89
State state