src/ConfigurationDialog.h

Wed, 05 Mar 2014 17:29:27 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 05 Mar 2014 17:29:27 +0200
changeset 647
b87941923eb4
parent 642
751a8df42842
permissions
-rw-r--r--

- made MessageLog.h and RingFinder.h suitable for doxygen

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

mercurial