File indexing completed on 2024-05-19 04:59:17
0001 /* ============================================================ 0002 * Mouse Gestures plugin for Falkon 0003 * Copyright (C) 2012-2017 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #ifndef MOUSEGESTURES_H 0019 #define MOUSEGESTURES_H 0020 0021 #include <QObject> 0022 #include <QPointer> 0023 0024 class QMouseEvent; 0025 0026 class WebView; 0027 class QjtMouseGestureFilter; 0028 class MouseGesturesSettingsDialog; 0029 0030 class MouseGestures : public QObject 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit MouseGestures(const QString &settingsPath, QObject* parent = nullptr); 0035 ~MouseGestures(); 0036 0037 bool mousePress(QObject* obj, QMouseEvent* event); 0038 bool mouseRelease(QObject* obj, QMouseEvent* event); 0039 bool mouseMove(QObject* obj, QMouseEvent* event); 0040 0041 void showSettings(QWidget* parent); 0042 void unloadPlugin(); 0043 0044 Qt::MouseButton gestureButton() const; 0045 void setGestureButton(Qt::MouseButton button); 0046 void setGestureButtonByIndex(int index); 0047 int buttonToIndex() const; 0048 0049 bool rockerNavigationEnabled() const; 0050 void setRockerNavigationEnabled(bool enable); 0051 0052 void loadSettings(); 0053 void saveSettings(); 0054 0055 private Q_SLOTS: 0056 void upGestured(); 0057 void downGestured(); 0058 void leftGestured(); 0059 void rightGestured(); 0060 0061 void downRightGestured(); 0062 void downLeftGestured(); 0063 void downUpGestured(); 0064 0065 void upDownGestured(); 0066 void upLeftGestured(); 0067 void upRightGestured(); 0068 0069 private: 0070 void init(); 0071 void initFilter(); 0072 0073 QjtMouseGestureFilter* m_filter; 0074 QPointer<MouseGesturesSettingsDialog> m_settings; 0075 QPointer<WebView> m_view; 0076 0077 QString m_settingsFile; 0078 Qt::MouseButton m_button; 0079 bool m_enableRockerNavigation = false; 0080 0081 bool m_blockNextRightMouseRelease = false; 0082 bool m_blockNextLeftMouseRelease = false; 0083 0084 bool m_oldWebViewForceContextMenuOnRelease = false; 0085 }; 0086 0087 #endif // MOUSEGESTURES_H