-
Notifications
You must be signed in to change notification settings - Fork 10
/
PreferencesDialog.h
213 lines (160 loc) · 4.65 KB
/
PreferencesDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#ifndef _SETTINGS_DIALOG_H_
#define _SETTINGS_DIALOG_H_
#include <iostream>
#include <QDialog>
#include <QPainter>
#include <QSettings>
#include <QListWidget>
#include <QStackedWidget>
class GeneralPage;
class ModelViewPage;
class VoxelPage;
class GridPage;
class LightingPage;
class GuidesPage;
class PalettePage;
class WIPPage;
////////////////////////////////////////////////////////////////////////////////
// Main preferences dialog /////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
class PreferencesDialog : public QDialog
{
Q_OBJECT
public:
PreferencesDialog(QWidget* parent = 0, QSettings* appSettings = NULL);
public slots:
void changePage(QListWidgetItem* current, QListWidgetItem* previous);
void reject();
signals:
void preferenceChanged();
private:
QSettings* m_pAppSettings;
QListWidget* m_pContentsWidget;
QStackedWidget* m_pPagesWidget;
// Keep track of all the sub-pages
GeneralPage* m_pGeneralPage;
ModelViewPage* m_pModelViewPage;
VoxelPage* m_pVoxelPage;
GridPage* m_pGridPage;
LightingPage* m_pLightingPage;
GuidesPage* m_pGuidesPage;
PalettePage* m_pPalettePage;
WIPPage* m_pWIPPage;
};
////////////////////////////////////////////////////////////////////////////////
// Preference Sub-Pages ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
class GeneralPage : public QWidget
{ Q_OBJECT
public:
GeneralPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
bool m_saveWindowPositionsOrig;
bool m_frameOnOpenOrig;
void restoreOriginals();
signals:
void preferenceChanged();
public slots:
void setSaveWindowPositions(int state);
void setFrameOnOpen(int state);
};
class ModelViewPage : public QWidget
{ Q_OBJECT
public:
ModelViewPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
QColor m_backgroundColorOrig;
bool m_dragEnabledOrig;
bool m_previewEnabledOrig;
int m_voxelDisplayOrig;
void restoreOriginals();
signals:
void preferenceChanged();
public slots:
void setBackgroundColor(const QColor& value);
void setDragEnabled(int value);
void setPreviewEnabled(int value);
};
class VoxelPage : public QWidget
{ Q_OBJECT
public:
VoxelPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
bool m_drawOutlinesOrig, m_drawSmoothOrig;
void restoreOriginals();
signals:
void preferenceChanged();
public slots:
void setDrawOutlines(int value);
void setDrawSmooth(int value);
};
class GridPage : public QWidget
{ Q_OBJECT
public:
GridPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
QColor m_gridColorOrig;
int m_gridSizeOrig;
int m_gridCellSizeOrig;
void restoreOriginals();
signals:
void preferenceChanged();
public slots:
void setGridColor(const QColor& value);
void setGridSize(int value);
void setgridCellSize(int value);
};
class LightingPage : public QWidget
{ Q_OBJECT
public:
LightingPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
void restoreOriginals();
};
class GuidesPage : public QWidget
{ Q_OBJECT
public:
GuidesPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
void restoreOriginals();
};
class PalettePage : public QWidget
{ Q_OBJECT
public:
PalettePage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
void restoreOriginals();
};
class WIPPage : public QWidget
{ Q_OBJECT
public:
WIPPage(QWidget* parent = NULL, QSettings* appSettings = NULL);
QSettings* m_pAppSettings;
void restoreOriginals();
};
////////////////////////////////////////////////////////////////////////////////
// Helper Widgets //////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
class ColorWidget : public QWidget
{
Q_OBJECT
public:
ColorWidget(QWidget* parent = NULL) :
QWidget(parent),
m_color(255,0,0)
{
setMinimumSize(50, 22);
}
void setColor(const QColor& nc) { m_color = nc; }
QColor color() { return m_color; }
public slots:
void colorChangedSlot(QColor color);
signals:
void colorChanged(QColor color);
protected:
void paintEvent(QPaintEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
private:
QColor m_color;
};
#endif