File indexing completed on 2024-12-22 05:17:22
0001 /* 0002 * This file is part of the KDE wacomtablet project. For copyright 0003 * information and license terms see the AUTHORS and COPYING files 0004 * in the top-level directory of this distribution. 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef HWBUTTONDIALOG_H 0021 #define HWBUTTONDIALOG_H 0022 0023 #include <QDialog> 0024 0025 namespace Ui 0026 { 0027 class HWButtonDialog; 0028 } 0029 0030 namespace Wacom 0031 { 0032 0033 /** 0034 * @brief Dialog that allows the user to press the buttons on the tablet for correct mapping 0035 * 0036 * The Tablet buttons 1-x are not directly mapped to the X11 buttons 1-x. 0037 * Button 4-7 are used for wheel events for example. 0038 * 0039 * Also button 1 is not always Button 1 but sometimes 9 and so on 0040 * This dialog lets the user press the logical tablet buttons and captures the X11 events 0041 * for the real X11 button connected to it. 0042 * 0043 */ 0044 class HWButtonDialog : public QDialog 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 explicit HWButtonDialog(int maxButtons, QWidget *parent = nullptr); 0050 ~HWButtonDialog() override; 0051 0052 QList<unsigned int> buttonMap() const; 0053 0054 protected: 0055 void mousePressEvent(QMouseEvent *event) final override; 0056 0057 private: 0058 void hwKey(unsigned int button); 0059 void nextButton(); 0060 0061 Ui::HWButtonDialog *ui = nullptr; 0062 int m_maxButtons; 0063 int m_nextButton; 0064 QList<unsigned int> m_buttonMap; 0065 }; 0066 0067 } 0068 0069 #endif // HWBUTTONDIALOG_H