32 #include "misc.h" |
32 #include "misc.h" |
33 #include "ui_colorsel.h" |
33 #include "ui_colorsel.h" |
34 #include "moc_colorSelectDialog.cpp" |
34 #include "moc_colorSelectDialog.cpp" |
35 |
35 |
36 static const int g_numColumns = 16; |
36 static const int g_numColumns = 16; |
37 static const short g_squareSize = 32; |
37 static const int g_squareSize = 32; |
38 |
38 |
39 extern_cfg (String, gl_maincolor); |
39 extern_cfg (String, gl_maincolor); |
40 extern_cfg (Float, gl_maincolor_alpha); |
40 extern_cfg (Float, gl_maincolor_alpha); |
41 |
41 |
42 // ============================================================================= |
42 // ============================================================================= |
43 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
44 ColorSelector::ColorSelector (short defval, QWidget* parent) : QDialog (parent) |
44 ColorSelector::ColorSelector (int defval, QWidget* parent) : QDialog (parent) |
45 { // Remove the default color if it's invalid |
45 { // Remove the default color if it's invalid |
46 if (!::getColor (defval)) |
46 if (!getColor (defval)) |
47 defval = -1; |
47 defval = -1; |
48 |
48 |
49 m_firstResize = true; |
49 m_firstResize = true; |
50 ui = new Ui_ColorSelUI; |
50 ui = new Ui_ColorSelUI; |
51 ui->setupUi (this); |
51 ui->setupUi (this); |
52 |
52 |
53 m_scene = new QGraphicsScene; |
53 m_scene = new QGraphicsScene; |
54 ui->viewport->setScene (m_scene); |
54 ui->viewport->setScene (m_scene); |
55 setSelection (::getColor (defval)); |
55 setSelection (getColor (defval)); |
56 |
56 |
57 // not really an icon but eh |
57 // not really an icon but eh |
58 m_scene->setBackgroundBrush (getIcon ("checkerboard")); |
58 m_scene->setBackgroundBrush (getIcon ("checkerboard")); |
59 drawScene(); |
59 drawScene(); |
60 |
60 |
181 drawColorInfo(); |
181 drawColorInfo(); |
182 } |
182 } |
183 |
183 |
184 // ============================================================================= |
184 // ============================================================================= |
185 // ----------------------------------------------------------------------------- |
185 // ----------------------------------------------------------------------------- |
186 bool ColorSelector::getColor (short& val, short int defval, QWidget* parent) |
186 bool ColorSelector::selectColor (int& val, int defval, QWidget* parent) |
187 { ColorSelector dlg (defval, parent); |
187 { ColorSelector dlg (defval, parent); |
188 |
188 |
189 if (dlg.exec() && dlg.sel() != null) |
189 if (dlg.exec() && dlg.sel() != null) |
190 { val = dlg.sel()->index; |
190 { val = dlg.sel()->index; |
191 return true; |
191 return true; |