src/ConfigurationDialog.h

changeset 629
b75c6cce02e2
child 641
425b169a82aa
equal deleted inserted replaced
628:6b13e4c2e97b 629:b75c6cce02e2
1 /*
2 * LDForge: LDraw parts authoring CAD
3 * Copyright (C) 2013, 2014 Santeri Piippo
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef LDFORGE_CONFIGDIALOG_H
20 #define LDFORGE_CONFIGDIALOG_H
21
22 #include "MainWindow.h"
23 #include <QDialog>
24
25 class Ui_ConfigUI;
26 class QLabel;
27 class QDoubleSpinBox;
28
29 // =============================================================================
30 class ShortcutListItem : public QListWidgetItem
31 {
32 PROPERTY (public, KeySequenceConfig*, KeyConfig, NO_OPS, STOCK_WRITE)
33 PROPERTY (public, QAction*, Action, NO_OPS, STOCK_WRITE)
34
35 public:
36 explicit ShortcutListItem (QListWidget* view = null, int type = Type) :
37 QListWidgetItem (view, type) {}
38 };
39
40 // =============================================================================
41 class ConfigDialog : public QDialog
42 {
43 Q_OBJECT
44
45 public:
46 enum Tab
47 {
48 InterfaceTab,
49 ProfileTab,
50 ShortcutsTab,
51 QuickColorsTab,
52 GridsTab,
53 ExtProgsTab,
54 DownloadTab
55 };
56
57 explicit ConfigDialog (Tab deftab = InterfaceTab, QWidget* parent = null, Qt::WindowFlags f = 0);
58 virtual ~ConfigDialog();
59 float getGridValue (int i, int j) const;
60
61 QList<LDQuickColor> quickColors;
62 QDoubleSpinBox* dsb_gridData[3][4];
63
64 private:
65 Ui_ConfigUI* ui;
66 QLabel* lb_gridLabels[3];
67 QLabel* lb_gridIcons[3];
68 QList<QListWidgetItem*> quickColorItems;
69
70 void applySettings();
71 void addShortcut (KeySequenceConfig& cfg, QAction* act, int& i);
72 void setButtonBackground (QPushButton* button, QString value);
73 void pickColor (QString& conf, QPushButton* button);
74 void updateQuickColorList (LDQuickColor* sel = null);
75 void setShortcutText (ShortcutListItem* item);
76 int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack);
77 QString quickColorString();
78 QListWidgetItem* getSelectedQuickColor();
79 QList<ShortcutListItem*> getShortcutSelection();
80 void initGrids();
81 void initExtProgs();
82
83 private slots:
84 void slot_setGLBackground();
85 void slot_setGLForeground();
86 void slot_setGLSelectColor();
87 void slot_setShortcut();
88 void slot_resetShortcut();
89 void slot_clearShortcut();
90 void slot_setColor();
91 void slot_delColor();
92 void slot_addColorSeparator();
93 void slot_moveColor();
94 void slot_clearColors();
95 void slot_setExtProgPath();
96 void slot_findDownloadFolder();
97 void buttonClicked (QAbstractButton* button);
98 void selectPage (int row);
99 };
100
101 // =============================================================================
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
103 // =============================================================================
104 class KeySequenceDialog : public QDialog
105 {
106 Q_OBJECT
107
108 public:
109 explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0);
110 static bool staticDialog (KeySequenceConfig* cfg, QWidget* parent = null);
111
112 QLabel* lb_output;
113 QDialogButtonBox* bbx_buttons;
114 QKeySequence seq;
115
116 private:
117 void updateOutput();
118
119 private slots:
120 virtual void keyPressEvent (QKeyEvent* ev) override;
121 };
122
123 #endif // LDFORGE_CONFIGDIALOG_H

mercurial