Mon, 31 Aug 2015 04:57:16 +0300
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
968 | 3 | * Copyright (C) 2013 - 2015 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
962
a4b463a7ee82
Rename MainWindow files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
20 | #include "mainwindow.h" |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
21 | #include "toolsets/extprogramtoolset.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QDialog> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | class Ui_ConfigUI; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | class QLabel; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | class QDoubleSpinBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | class ShortcutListItem : public QListWidgetItem |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | { |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
31 | PROPERTY (public, QAction*, action, setAction, STOCK_WRITE) |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
32 | PROPERTY (public, QKeySequence, sequence, setSequence, STOCK_WRITE) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | |
794 | 34 | public: |
35 | explicit ShortcutListItem (QListWidget* view = null, int type = Type) : | |
36 | QListWidgetItem (view, type) {} | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
39 | struct ExternalProgramWidgets |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
40 | { |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
41 | class QLineEdit* input; |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
42 | class QPushButton* setPathButton; |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
43 | class QCheckBox* wineBox; |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
44 | }; |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
45 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // ============================================================================= |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
47 | class ConfigDialog : public QDialog, public HierarchyElement |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | |
794 | 51 | public: |
52 | enum Tab | |
53 | { | |
54 | InterfaceTab, | |
55 | EditingToolsTab, | |
56 | ProfileTab, | |
57 | ShortcutsTab, | |
58 | QuickColorsTab, | |
59 | GridsTab, | |
60 | ExtProgsTab, | |
61 | DownloadTab | |
62 | }; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
64 | explicit ConfigDialog (QWidget* parent = nullptr, Tab defaulttab = (Tab) 0, Qt::WindowFlags f = 0); |
794 | 65 | virtual ~ConfigDialog(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | |
794 | 67 | QList<LDQuickColor> quickColors; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
794 | 69 | private: |
70 | Ui_ConfigUI* ui; | |
71 | QList<QListWidgetItem*> quickColorItems; | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
851
diff
changeset
|
72 | QMap<QPushButton*, QColor> m_buttonColors; |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
73 | ExternalProgramWidgets m_externalProgramWidgets[NumExternalPrograms]; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
794 | 75 | void applySettings(); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
76 | void addShortcut (QAction* act); |
794 | 77 | void setButtonBackground (QPushButton* button, QString value); |
78 | void updateQuickColorList (LDQuickColor* sel = null); | |
79 | void setShortcutText (ShortcutListItem* item); | |
80 | int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); | |
81 | QString quickColorString(); | |
82 | QListWidgetItem* getSelectedQuickColor(); | |
83 | QList<ShortcutListItem*> getShortcutSelection(); | |
84 | void initExtProgs(); | |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
85 | void applyToWidgetOptions (std::function<void (QWidget*, AbstractConfigEntry*)> func); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
794 | 87 | private slots: |
851
dbed6938238c
- refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents:
844
diff
changeset
|
88 | void setButtonColor(); |
794 | 89 | void slot_setShortcut(); |
90 | void slot_resetShortcut(); | |
91 | void slot_clearShortcut(); | |
92 | void slot_setColor(); | |
93 | void slot_delColor(); | |
94 | void slot_addColorSeparator(); | |
95 | void slot_moveColor(); | |
96 | void slot_clearColors(); | |
97 | void slot_setExtProgPath(); | |
98 | void slot_findDownloadFolder(); | |
99 | void buttonClicked (QAbstractButton* button); | |
100 | void selectPage (int row); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | // ============================================================================= |
794 | 104 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | class KeySequenceDialog : public QDialog |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | |
794 | 109 | public: |
110 | explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0); | |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
111 | static bool staticDialog (ShortcutListItem* item, QWidget* parent = null); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | |
794 | 113 | QLabel* lb_output; |
114 | QDialogButtonBox* bbx_buttons; | |
115 | QKeySequence seq; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | |
794 | 117 | private: |
118 | void updateOutput(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
794 | 120 | private slots: |
121 | virtual void keyPressEvent (QKeyEvent* ev) override; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | }; |