200 // Initializes the table of grid stuff |
200 // Initializes the table of grid stuff |
201 // ============================================================================= |
201 // ============================================================================= |
202 void ConfigDialog::initGrids() |
202 void ConfigDialog::initGrids() |
203 { |
203 { |
204 QGridLayout* gridlayout = new QGridLayout; |
204 QGridLayout* gridlayout = new QGridLayout; |
205 QLabel* xlabel = new QLabel ("X"), |
205 QLabel* coordlabel = new QLabel ("Coordinate"); |
206 *ylabel = new QLabel ("Y"), |
206 QLabel* anglelabel = new QLabel ("Angle"); |
207 *zlabel = new QLabel ("Z"), |
|
208 *anglabel = new QLabel ("Angle"); |
|
209 int i = 1; |
207 int i = 1; |
210 |
208 |
211 for (QLabel* label : QList<QLabel*> ({xlabel, ylabel, zlabel, anglabel})) |
209 for (QLabel* label : QList<QLabel*> ({coordlabel, anglelabel})) |
212 { |
210 { |
213 label->setAlignment (Qt::AlignCenter); |
211 label->setAlignment (Qt::AlignCenter); |
214 gridlayout->addWidget (label, 0, i++); |
212 gridlayout->addWidget (label, 0, i++); |
215 } |
213 } |
216 |
214 |
217 for (int i = 0; i < g_NumGrids; ++i) |
215 gridlayout->setColumnStretch (0, 0); |
|
216 gridlayout->setColumnStretch (1, 1); |
|
217 gridlayout->setColumnStretch (2, 1); |
|
218 |
|
219 for (int i = 0; i < g_numGrids; ++i) |
218 { |
220 { |
219 // Icon |
221 // Icon |
220 lb_gridIcons[i] = new QLabel; |
222 lb_gridIcons[i] = new QLabel; |
221 lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", String (g_GridInfo[i].name).toLower()))); |
223 lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", String (g_gridInfo[i].name).toLower()))); |
222 |
224 |
223 // Text label |
225 // Text label |
224 lb_gridLabels[i] = new QLabel (format ("%1:", g_GridInfo[i].name)); |
226 lb_gridLabels[i] = new QLabel (format ("%1:", g_gridInfo[i].name)); |
225 |
227 |
226 QHBoxLayout* labellayout = new QHBoxLayout; |
228 QHBoxLayout* labellayout = new QHBoxLayout; |
227 labellayout->addWidget (lb_gridIcons[i]); |
229 labellayout->addWidget (lb_gridIcons[i]); |
228 labellayout->addWidget (lb_gridLabels[i]); |
230 labellayout->addWidget (lb_gridLabels[i]); |
229 gridlayout->addLayout (labellayout, i + 1, 0); |
231 gridlayout->addLayout (labellayout, i + 1, 0); |
230 |
232 |
231 // Add the widgets |
233 // Add the widgets |
232 for (int j = 0; j < 4; ++j) |
234 for (int j = 0; j < 2; ++j) |
233 { |
235 { |
234 dsb_gridData[i][j] = new QDoubleSpinBox; |
236 dsb_gridData[i][j] = new QDoubleSpinBox; |
235 |
|
236 // Set the maximum angle |
|
237 if (j == 3) |
|
238 dsb_gridData[i][j]->setMaximum (360); |
|
239 |
|
240 dsb_gridData[i][j]->setValue (*g_GridInfo[i].confs[j]); |
|
241 gridlayout->addWidget (dsb_gridData[i][j], i + 1, j + 1); |
237 gridlayout->addWidget (dsb_gridData[i][j], i + 1, j + 1); |
242 } |
238 } |
|
239 |
|
240 // Fill in defaults and stuff |
|
241 dsb_gridData[i][0]->setValue (*g_gridInfo[i].coordsnap); |
|
242 dsb_gridData[i][1]->setValue (*g_gridInfo[i].anglesnap); |
|
243 dsb_gridData[i][1]->setMaximum (360); |
|
244 dsb_gridData[i][1]->setSuffix (UTF16 (u"\u00B0")); // degree symbol |
243 } |
245 } |
244 |
246 |
245 ui->grids->setLayout (gridlayout); |
247 ui->grids->setLayout (gridlayout); |
246 } |
248 } |
247 |
249 |
340 // Rebuild the quick color toolbar |
342 // Rebuild the quick color toolbar |
341 g_win->setQuickColors (quickColors); |
343 g_win->setQuickColors (quickColors); |
342 gui_colortoolbar = quickColorString(); |
344 gui_colortoolbar = quickColorString(); |
343 |
345 |
344 // Set the grid settings |
346 // Set the grid settings |
345 for (int i = 0; i < g_NumGrids; ++i) |
347 for (int i = 0; i < g_numGrids; ++i) |
346 for (int j = 0; j < 4; ++j) |
348 { |
347 *g_GridInfo[i].confs[j] = dsb_gridData[i][j]->value(); |
349 *g_gridInfo[i].coordsnap = dsb_gridData[i][0]->value(); |
|
350 *g_gridInfo[i].anglesnap = dsb_gridData[i][1]->value(); |
|
351 } |
348 |
352 |
349 // Apply key shortcuts |
353 // Apply key shortcuts |
350 g_win->updateActionShortcuts(); |
354 g_win->updateActionShortcuts(); |
351 |
355 |
352 // Ext program settings |
356 // Ext program settings |