Falkon Develop
Cross-platform Qt-based web browser
mousegesturesplugin.cpp
Go to the documentation of this file.
1/* ============================================================
2* Mouse Gestures plugin for Falkon
3* Copyright (C) 2012-2014 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#include "mousegesturesplugin.h"
19#include "pluginproxy.h"
20#include "mousegestures.h"
21#include "mainapplication.h"
22#include "browserwindow.h"
23#include "../config.h"
24
26 : QObject()
27{
28}
29
30void MouseGesturesPlugin::init(InitState state, const QString &settingsPath)
31{
32 Q_UNUSED(state)
33
34 m_gestures = new MouseGestures(settingsPath, this);
35
36 mApp->plugins()->registerAppEventHandler(PluginProxy::MousePressHandler, this);
37 mApp->plugins()->registerAppEventHandler(PluginProxy::MouseReleaseHandler, this);
38 mApp->plugins()->registerAppEventHandler(PluginProxy::MouseMoveHandler, this);
39}
40
42{
43 m_gestures->unloadPlugin();
44 m_gestures->deleteLater();
45}
46
48{
49 // Require the version that the plugin was built with
50 return (QString::fromLatin1(Qz::VERSION) == QLatin1String(FALKON_VERSION));
51}
52
54{
55 m_gestures->showSettings(parent);
56}
57
58bool MouseGesturesPlugin::mousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* event)
59{
60 if (type == Qz::ON_WebView) {
61 m_gestures->mousePress(obj, event);
62 }
63
64 return false;
65}
66
67bool MouseGesturesPlugin::mouseRelease(Qz::ObjectName type, QObject* obj, QMouseEvent* event)
68{
69 if (type == Qz::ON_WebView) {
70 return m_gestures->mouseRelease(obj, event);
71 }
72
73 return false;
74}
75
76bool MouseGesturesPlugin::mouseMove(Qz::ObjectName type, QObject* obj, QMouseEvent* event)
77{
78 if (type == Qz::ON_WebView) {
79 m_gestures->mouseMove(obj, event);
80 }
81
82 return false;
83}
bool mousePress(QObject *obj, QMouseEvent *event)
void showSettings(QWidget *parent)
bool mouseRelease(QObject *obj, QMouseEvent *event)
bool mouseMove(QObject *obj, QMouseEvent *event)
void showSettings(QWidget *parent) override
bool testPlugin() override
bool mousePress(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override
bool mouseRelease(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override
void init(InitState state, const QString &settingsPath) override
bool mouseMove(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override
@ MouseReleaseHandler
Definition: pluginproxy.h:33
@ MouseMoveHandler
Definition: pluginproxy.h:34
@ MousePressHandler
Definition: pluginproxy.h:33
#define mApp
ObjectName
Definition: qzcommon.h:89
@ ON_WebView
Definition: qzcommon.h:90
FALKON_EXPORT const char * VERSION
Definition: qzcommon.cpp:26
State state