src/configDialog.h

changeset 970
c8aae45afd85
parent 968
4b93b7963456
child 971
c00f9665a9f8
equal deleted inserted replaced
969:b1742ee91d5b 970:c8aae45afd85
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
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 <QDialog> 22 #include <QDialog>
22 23
23 class Ui_ConfigUI; 24 class Ui_ConfigUI;
24 class QLabel; 25 class QLabel;
25 class QDoubleSpinBox; 26 class QDoubleSpinBox;
33 public: 34 public:
34 explicit ShortcutListItem (QListWidget* view = null, int type = Type) : 35 explicit ShortcutListItem (QListWidget* view = null, int type = Type) :
35 QListWidgetItem (view, type) {} 36 QListWidgetItem (view, type) {}
36 }; 37 };
37 38
39 struct ExternalProgramWidgets
40 {
41 class QLineEdit* input;
42 class QPushButton* setPathButton;
43 class QCheckBox* wineBox;
44 };
45
38 // ============================================================================= 46 // =============================================================================
39 class ConfigDialog : public QDialog 47 class ConfigDialog : public QDialog, public HierarchyElement
40 { 48 {
41 Q_OBJECT 49 Q_OBJECT
42 50
43 public: 51 public:
44 enum Tab 52 enum Tab
51 GridsTab, 59 GridsTab,
52 ExtProgsTab, 60 ExtProgsTab,
53 DownloadTab 61 DownloadTab
54 }; 62 };
55 63
56 explicit ConfigDialog (Tab deftab = InterfaceTab, QWidget* parent = null, Qt::WindowFlags f = 0); 64 explicit ConfigDialog (QWidget* parent = nullptr, Tab defaulttab = (Tab) 0, Qt::WindowFlags f = 0);
57 virtual ~ConfigDialog(); 65 virtual ~ConfigDialog();
58 66
59 QList<LDQuickColor> quickColors; 67 QList<LDQuickColor> quickColors;
60 68
61 private: 69 private:
62 Ui_ConfigUI* ui; 70 Ui_ConfigUI* ui;
63 QList<QListWidgetItem*> quickColorItems; 71 QList<QListWidgetItem*> quickColorItems;
64 QMap<QPushButton*, QColor> m_buttonColors; 72 QMap<QPushButton*, QColor> m_buttonColors;
73 ExternalProgramWidgets m_externalProgramWidgets[NumExternalPrograms];
65 74
66 void applySettings(); 75 void applySettings();
67 void addShortcut (QAction* act); 76 void addShortcut (QAction* act);
68 void setButtonBackground (QPushButton* button, QString value); 77 void setButtonBackground (QPushButton* button, QString value);
69 void updateQuickColorList (LDQuickColor* sel = null); 78 void updateQuickColorList (LDQuickColor* sel = null);
71 int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); 80 int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack);
72 QString quickColorString(); 81 QString quickColorString();
73 QListWidgetItem* getSelectedQuickColor(); 82 QListWidgetItem* getSelectedQuickColor();
74 QList<ShortcutListItem*> getShortcutSelection(); 83 QList<ShortcutListItem*> getShortcutSelection();
75 void initExtProgs(); 84 void initExtProgs();
76 void m_applyToWidgetOptions (std::function<void (QWidget*, AbstractConfigEntry*)> func); 85 void applyToWidgetOptions (std::function<void (QWidget*, AbstractConfigEntry*)> func);
77 86
78 private slots: 87 private slots:
79 void setButtonColor(); 88 void setButtonColor();
80 void slot_setShortcut(); 89 void slot_setShortcut();
81 void slot_resetShortcut(); 90 void slot_resetShortcut();

mercurial