Falkon Develop
Cross-platform Qt-based web browser
mousegestures.h
Go to the documentation of this file.
1/* ============================================================
2* Mouse Gestures plugin for Falkon
3* Copyright (C) 2012-2017 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 MOUSEGESTURES_H
19#define MOUSEGESTURES_H
20
21#include <QObject>
22#include <QPointer>
23
24class QMouseEvent;
25
26class WebView;
29
30class MouseGestures : public QObject
31{
32 Q_OBJECT
33public:
34 explicit MouseGestures(const QString &settingsPath, QObject* parent = nullptr);
36
37 bool mousePress(QObject* obj, QMouseEvent* event);
38 bool mouseRelease(QObject* obj, QMouseEvent* event);
39 bool mouseMove(QObject* obj, QMouseEvent* event);
40
41 void showSettings(QWidget* parent);
42 void unloadPlugin();
43
44 Qt::MouseButton gestureButton() const;
45 void setGestureButton(Qt::MouseButton button);
46 void setGestureButtonByIndex(int index);
47 int buttonToIndex() const;
48
49 bool rockerNavigationEnabled() const;
50 void setRockerNavigationEnabled(bool enable);
51
52 void loadSettings();
53 void saveSettings();
54
55private Q_SLOTS:
56 void upGestured();
57 void downGestured();
58 void leftGestured();
59 void rightGestured();
60
61 void downRightGestured();
62 void downLeftGestured();
63 void downUpGestured();
64
65 void upDownGestured();
66 void upLeftGestured();
67 void upRightGestured();
68
69private:
70 void init();
71 void initFilter();
72
73 QjtMouseGestureFilter* m_filter;
74 QPointer<MouseGesturesSettingsDialog> m_settings;
75 QPointer<WebView> m_view;
76
77 QString m_settingsFile;
78 Qt::MouseButton m_button;
79 bool m_enableRockerNavigation = false;
80
81 bool m_blockNextRightMouseRelease = false;
82 bool m_blockNextLeftMouseRelease = false;
83
84 bool m_oldWebViewForceContextMenuOnRelease = false;
85};
86
87#endif // MOUSEGESTURES_H
bool mousePress(QObject *obj, QMouseEvent *event)
Qt::MouseButton gestureButton() const
MouseGestures(const QString &settingsPath, QObject *parent=nullptr)
void showSettings(QWidget *parent)
void setRockerNavigationEnabled(bool enable)
bool rockerNavigationEnabled() const
bool mouseRelease(QObject *obj, QMouseEvent *event)
void setGestureButton(Qt::MouseButton button)
void setGestureButtonByIndex(int index)
bool mouseMove(QObject *obj, QMouseEvent *event)
int buttonToIndex() const