src/dialogs/configdialog.h

changeset 1433
bd3a9e237ef5
parent 1432
4cc687851fbb
equal deleted inserted replaced
1432:4cc687851fbb 1433:bd3a9e237ef5
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include "../mainwindow.h" 20 #include "../mainwindow.h"
21 #include "../toolsets/extprogramtoolset.h" 21 #include "../toolsets/extprogramtoolset.h"
22 #include "shortcutsmodel.h"
22 #include <QDialog> 23 #include <QDialog>
23
24 // =============================================================================
25 class ShortcutListItem : public QListWidgetItem
26 {
27 public:
28 explicit ShortcutListItem (QListWidget* view = nullptr, int type = Type);
29
30 QAction* action() const;
31 QKeySequence sequence() const;
32 void setAction (QAction* action);
33 void setSequence (const QKeySequence& sequence);
34
35 private:
36 QAction* m_action;
37 QKeySequence m_sequence;
38 };
39 24
40 struct ExternalProgramWidgets 25 struct ExternalProgramWidgets
41 { 26 {
42 class QLineEdit* input; 27 class QLineEdit* input;
43 class QPushButton* setPathButton; 28 class QPushButton* setPathButton;
44 class QCheckBox* wineBox; 29 class QCheckBox* wineBox;
45 }; 30 };
46 31
47 // =============================================================================
48 class ConfigDialog : public QDialog, public HierarchyElement 32 class ConfigDialog : public QDialog, public HierarchyElement
49 { 33 {
50 Q_OBJECT 34 Q_OBJECT
51 35
52 public: 36 public:
75 QVector<QListWidgetItem*> quickColorItems; 59 QVector<QListWidgetItem*> quickColorItems;
76 QMap<QPushButton*, QColor> m_buttonColors; 60 QMap<QPushButton*, QColor> m_buttonColors;
77 ExternalProgramWidgets m_externalProgramWidgets[NumExternalPrograms]; 61 ExternalProgramWidgets m_externalProgramWidgets[NumExternalPrograms];
78 class LibrariesModel* librariesModel; 62 class LibrariesModel* librariesModel;
79 Libraries libraries; 63 Libraries libraries;
64 ShortcutsModel shortcuts;
65 KeySequenceDelegate shortcutsDelegate;
80 66
81 void applySettings(); 67 void applySettings();
82 void addShortcut (QAction* act);
83 void setButtonBackground (QPushButton* button, QString value); 68 void setButtonBackground (QPushButton* button, QString value);
84 void setShortcutText (ShortcutListItem* item);
85 int getItemRow (QListWidgetItem* item, QVector<QListWidgetItem*>& haystack);
86 QVector<ShortcutListItem*> getShortcutSelection();
87 void initExtProgs(); 69 void initExtProgs();
88 void applyToWidgetOptions (std::function<void (QWidget*, QString)> func); 70 void applyToWidgetOptions (std::function<void (QWidget*, QString)> func);
89 71
90 private slots: 72 private slots:
91 void setButtonColor(); 73 void setButtonColor();
92 void slot_setShortcut();
93 void slot_resetShortcut();
94 void slot_clearShortcut();
95 void slot_setExtProgPath(); 74 void slot_setExtProgPath();
96 void slot_findDownloadFolder(); 75 void slot_findDownloadFolder();
97 void buttonClicked (QAbstractButton* button); 76 void buttonClicked (QAbstractButton* button);
98 void selectPage (int row); 77 void selectPage (int row);
99 }; 78 };
100
101 // =============================================================================
102 //
103 class KeySequenceDialog : public QDialog
104 {
105 Q_OBJECT
106
107 public:
108 explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = nullptr, Qt::WindowFlags f = 0);
109 static bool staticDialog (ShortcutListItem* item, QWidget* parent = nullptr);
110
111 class QLabel* lb_output;
112 class QDialogButtonBox* bbx_buttons;
113 QKeySequence seq;
114
115 private:
116 void updateOutput();
117
118 private slots:
119 virtual void keyPressEvent (QKeyEvent* ev) override;
120 };

mercurial