Warning, file /plasma/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef WINDOW_DEFINITION_H 0002 #define WINDOW_DEFINITION_H 0003 /* SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "hotkeys_widget_iface.h" 0009 0010 #include "qwindowdefs.h" 0011 #include <QDialog> 0012 #include <QDialogButtonBox> 0013 #include <QVBoxLayout> 0014 #include <QWidget> 0015 0016 namespace Ui 0017 { 0018 class WindowDefinitionWidget; 0019 } 0020 0021 namespace KHotKeys 0022 { 0023 class Windowdef_simple; 0024 } 0025 0026 /** 0027 * @author Michael Jansen <kde@michael-jansen.biz> 0028 */ 0029 class WindowDefinitionWidget : public HotkeysWidgetIFace 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 /** 0035 * Default constructor 0036 */ 0037 WindowDefinitionWidget(KHotKeys::Windowdef_simple *windowdef, QWidget *parent = nullptr); 0038 0039 /** 0040 * Destructor 0041 */ 0042 ~WindowDefinitionWidget() override; 0043 0044 bool isChanged() const override; 0045 0046 protected: 0047 void doCopyFromObject() override; 0048 void doCopyToObject() override; 0049 0050 private Q_SLOTS: 0051 0052 void slotWindowClassChanged(int); 0053 void slotWindowRoleChanged(int); 0054 void slotWindowTitleChanged(int); 0055 0056 void slotAutoDetect(); 0057 void slotWindowSelected(WId); 0058 0059 private: 0060 Ui::WindowDefinitionWidget *ui; 0061 0062 KHotKeys::Windowdef_simple *_windowdef; 0063 }; 0064 0065 class WindowDefinitionDialog : public QDialog 0066 { 0067 Q_OBJECT 0068 0069 public: 0070 WindowDefinitionDialog(KHotKeys::Windowdef_simple *windowdef, QWidget *parent = nullptr) 0071 : QDialog(parent) 0072 , def(nullptr) 0073 { 0074 setLayout(new QVBoxLayout); 0075 0076 def = new WindowDefinitionWidget(windowdef, this); 0077 def->copyFromObject(); 0078 0079 layout()->addWidget(def); 0080 0081 QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 0082 0083 layout()->addWidget(buttonBox); 0084 0085 connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); 0086 connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); 0087 } 0088 0089 ~WindowDefinitionDialog() override 0090 { 0091 def = nullptr; 0092 } 0093 0094 void accept() override 0095 { 0096 def->copyToObject(); 0097 QDialog::accept(); 0098 } 0099 0100 private: 0101 WindowDefinitionWidget *def; 0102 }; 0103 0104 #endif /* #ifndef WINDOW_DEFINITION_H */