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 GENERALPAGEWIDGET_H
0021 #define GENERALPAGEWIDGET_H
0022 
0023 #include <QWidget>
0024 
0025 namespace Ui
0026 {
0027 class GeneralPageWidget;
0028 }
0029 
0030 class QDBusInterface;
0031 class KShortcutsEditor;
0032 
0033 namespace Wacom
0034 {
0035 class ProfileManagement;
0036 class GlobalActions;
0037 
0038 /**
0039  * This class shows some general information about the detected tablet device.
0040  *
0041  * Shows an image and the name plus all detected input devices (pad/stylus/eraser and so on).
0042  * Mainly used as debug output and to help the user to realize that his tablet
0043  * was detected correctly.
0044  */
0045 class GeneralPageWidget : public QWidget
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050     /**
0051      * Default constructor
0052      *
0053      * @param parent the parent widget
0054      */
0055     explicit GeneralPageWidget(QWidget *parent = nullptr);
0056 
0057     /**
0058      * default destructor
0059      */
0060     ~GeneralPageWidget() override;
0061 
0062     void setTabletId(const QString &tabletId);
0063 
0064     /**
0065      * Saves all values to the current profile
0066      */
0067     void saveToProfile();
0068 
0069 public slots:
0070     /**
0071      * When called the widget information will be refreshed
0072      */
0073     void reloadWidget();
0074 
0075     /**
0076      * Called whenever the profile is switched or the widget needs to be reinitialized.
0077      *
0078      * Updates all values on the widget to the values from the profile.
0079      */
0080     void loadFromProfile();
0081 
0082     /**
0083      * Called whenever a value is changed.
0084      * Fires the changed() signal afterwards to inform the main widget that unsaved changes are available.
0085      */
0086     void profileChanged();
0087 
0088 signals:
0089     /**
0090      * Used to inform the main widget that unsaved changes in the current profile are available.
0091      */
0092     void changed();
0093 
0094 private slots:
0095     void profileUp();
0096     void profileDown();
0097     void profileAdd();
0098     void profileRemove();
0099 
0100 private:
0101     Ui::GeneralPageWidget *ui = nullptr;
0102     GlobalActions *_actionCollection = nullptr;
0103     KShortcutsEditor *_shortcutEditor = nullptr;
0104     QString _tabletId;
0105 
0106 }; // CLASS
0107 } // NAMESPACE
0108 #endif // GENERALPAGEWIDGET_H