File indexing completed on 2025-01-26 05:09:31
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 PRESSURECURVEDIALOG_H 0021 #define PRESSURECURVEDIALOG_H 0022 0023 #include "devicetype.h" 0024 0025 #include <QDialog> 0026 0027 namespace Ui 0028 { 0029 class PressureCurveDialog; 0030 } 0031 0032 class QDBusInterface; 0033 0034 namespace Wacom 0035 { 0036 class PressureCurveWidget; 0037 0038 /** 0039 * This dialog shows the PressureCurveWidget and lets the uses change it on the fly 0040 * The pressure is animated when the suer uses his pen inside the widget 0041 */ 0042 class PressureCurveDialog : public QDialog 0043 { 0044 Q_OBJECT 0045 public: 0046 /** 0047 * default constructor 0048 * 0049 * @param initialValue initial value of the pressure 0050 * @param tabletId tablet identifier 0051 * @param deviceType device type, @see DeviceType 0052 * @param parent parent widget 0053 */ 0054 PressureCurveDialog(const QString &initialValue, const QString &tabletId, const DeviceType &deviceType, QWidget *parent = nullptr); 0055 0056 /** 0057 * default destructor 0058 */ 0059 ~PressureCurveDialog() override; 0060 0061 /** 0062 * Returns the changed presscurve control points in the format needed by the xsetwacom settings 0063 * 0064 * @return string version of both control points separated by spaces 0065 */ 0066 QString getControllPoints(); 0067 0068 public slots: 0069 /** 0070 * Updates the pen presscurve via the xsetwacom settings and shows the values in the dialog 0071 * 0072 * @param points string version of both control points separated by spaces 0073 */ 0074 void updateControlPoints(const QString &points); 0075 0076 /** 0077 * called when the user accept his changes 0078 */ 0079 void accept() override; 0080 0081 /** 0082 * called when the user discards his changes 0083 */ 0084 void reject() override; 0085 0086 private: 0087 /** 0088 * Sets the controllpoints to some starting values 0089 * 0090 * @param points starting values in the format as expected by the xssetwacom settings 0091 */ 0092 void setControllPoints(const QString &points); 0093 0094 private: 0095 Ui::PressureCurveDialog *m_ui = nullptr; /**< Handler to the presscurvedialog.ui file */ 0096 PressureCurveWidget *m_pressCurve = nullptr; /**< Widget that shows the presscurve and lets him change it */ 0097 0098 QString _initialValue; 0099 QString _tabletId; 0100 QString _deviceType; 0101 }; 0102 } 0103 #endif // PRESSURECURVEDIALOG_H