Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
DlgSettingsGridRemoval.cpp
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "CmdMediator.h"
8 #include "CmdSettingsGridRemoval.h"
9 #include "DlgSettingsGridRemoval.h"
10 #include "EngaugeAssert.h"
11 #include "Logger.h"
12 #include "MainWindow.h"
13 #include <QCheckBox>
14 #include <QComboBox>
15 #include <QDoubleValidator>
16 #include <QGraphicsScene>
17 #include <QGridLayout>
18 #include <QGroupBox>
19 #include <QHBoxLayout>
20 #include <QLabel>
21 #include <QLineEdit>
22 #include "ViewPreview.h"
23 
24 const double CLOSE_DISTANCE_MAX = 64;
25 const double CLOSE_DISTANCE_MIN = 0;
26 const int CLOSE_DECIMALS = 1;
27 const int COUNT_MIN = 1;
28 const int COUNT_MAX = 100;
29 const int COUNT_DECIMALS = 0;
30 const int MINIMUM_HEIGHT = 480;
31 
33  DlgSettingsAbstractBase (tr ("Grid Removal"),
34  "DlgSettingsGridRemoval",
35  mainWindow),
36  m_scenePreview (0),
37  m_viewPreview (0),
38  m_modelGridRemovalBefore (0),
39  m_modelGridRemovalAfter (0)
40 {
41  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::DlgSettingsGridRemoval";
42 
43  QWidget *subPanel = createSubPanel ();
44  finishPanel (subPanel);
45 }
46 
47 DlgSettingsGridRemoval::~DlgSettingsGridRemoval()
48 {
49  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::~DlgSettingsGridRemoval";
50 }
51 
52 void DlgSettingsGridRemoval::createOptionalSaveDefault (QHBoxLayout * /* layout */)
53 {
54 }
55 
56 void DlgSettingsGridRemoval::createPreview (QGridLayout *layout, int &row)
57 {
58  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createPreview";
59 
60  QLabel *labelPreview = new QLabel (tr ("Preview"));
61  layout->addWidget (labelPreview, row++, 0, 1, 5);
62 
63  m_scenePreview = new QGraphicsScene (this);
64  m_viewPreview = new ViewPreview (m_scenePreview,
65  ViewPreview::VIEW_ASPECT_RATIO_VARIABLE,
66  this);
67  m_viewPreview->setWhatsThis (tr ("Preview window that shows how current settings affect grid removal"));
68  m_viewPreview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
69  m_viewPreview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
70  m_viewPreview->setMinimumHeight (MINIMUM_PREVIEW_HEIGHT);
71  layout->addWidget (m_viewPreview, row++, 0, 1, 5);
72 }
73 
74 void DlgSettingsGridRemoval::createRemoveGridLines (QGridLayout *layout, int &row)
75 {
76  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createRemoveGridLines";
77 
78  m_chkRemoveGridLines = new QCheckBox (tr ("Remove pixels close to defined grid lines"));
79  m_chkRemoveGridLines->setWhatsThis (tr ("Check this box to have pixels close to regularly spaced gridlines removed.\n\n"
80  "This option is only available when the axis points have all been defined."));
81  connect (m_chkRemoveGridLines, SIGNAL (stateChanged (int)), this, SLOT (slotRemoveGridLines (int)));
82  layout->addWidget (m_chkRemoveGridLines, row++, 1, 1, 3);
83 
84  QLabel *labelCloseDistance = new QLabel (tr ("Close distance (pixels):"));
85  layout->addWidget (labelCloseDistance, row, 2);
86 
87  m_editCloseDistance = new QLineEdit;
88  m_editCloseDistance->setWhatsThis (tr ("Set closeness distance in pixels.\n\n"
89  "Pixels that are closer to the regularly spaced gridlines, than this distance, "
90  "will be removed.\n\n"
91  "This value cannot be negative. A zero value disables this feature. Decimal values are allowed"));
92  m_validatorCloseDistance = new QDoubleValidator (CLOSE_DISTANCE_MIN, CLOSE_DISTANCE_MAX, CLOSE_DECIMALS);
93  m_editCloseDistance->setValidator (m_validatorCloseDistance);
94  connect (m_editCloseDistance, SIGNAL (textChanged (const QString &)), this, SLOT (slotCloseDistance (const QString &)));
95  layout->addWidget (m_editCloseDistance, row++, 3);
96 
97  createRemoveGridLinesX (layout, row);
98  createRemoveGridLinesY (layout, row);
99 }
100 
101 void DlgSettingsGridRemoval::createRemoveGridLinesX (QGridLayout *layout, int &row)
102 {
103  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createRemoveGridLinesX";
104 
105  QString titleX = tr ("X Grid Lines");
106  if (false) {
107  titleX = QString (QChar (0x98, 0x03)) + QString (" %1").arg (tr ("Grid Lines"));
108  }
109  QGroupBox *groupX = new QGroupBox (titleX);
110  layout->addWidget (groupX, row, 2);
111 
112  QGridLayout *layoutGroup = new QGridLayout;
113  groupX->setLayout (layoutGroup);
114 
115  QLabel *labelDisable = new QLabel (tr ("Disable:"));
116  layoutGroup->addWidget (labelDisable, 0, 0);
117 
118  m_cmbDisableX = new QComboBox;
119  m_cmbDisableX->setWhatsThis (tr ("Disabled value.\n\n"
120  "The X grid lines are specified using only three values at a time. For flexibility, four values "
121  "are offered so you must chose which value is disabled. Once disabled, that value is simply "
122  "updated as the other values change"));
123  m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_COUNT),
124  QVariant (GRID_COORD_DISABLE_COUNT));
125  m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_START),
126  QVariant (GRID_COORD_DISABLE_START));
127  m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STEP),
128  QVariant (GRID_COORD_DISABLE_STEP));
129  m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STOP),
130  QVariant (GRID_COORD_DISABLE_STOP));
131  connect (m_cmbDisableX, SIGNAL (activated (const QString &)), this, SLOT (slotDisableX (const QString &))); // activated() ignores code changes
132  layoutGroup->addWidget (m_cmbDisableX, 0, 1);
133 
134  QLabel *labelCount = new QLabel (tr ("Count:"));
135  layoutGroup->addWidget (labelCount, 1, 0);
136 
137  m_editCountX = new QLineEdit;
138  m_editCountX->setWhatsThis (tr ("Number of X grid lines.\n\n"
139  "The number of X grid lines must be entered as an integer greater than zero"));
140  m_validatorCountX = new QDoubleValidator (COUNT_MIN, COUNT_MAX, COUNT_DECIMALS);
141  m_editCountX->setValidator (m_validatorCountX);
142  connect (m_editCountX, SIGNAL (textChanged (const QString &)), this, SLOT (slotCountX (const QString &)));
143  layoutGroup->addWidget (m_editCountX, 1, 1);
144 
145  QLabel *labelStart = new QLabel (tr ("Start:"));
146  layoutGroup->addWidget (labelStart, 2, 0);
147 
148  m_editStartX = new QLineEdit;
149  m_editStartX->setWhatsThis (tr ("Value of the first X grid line.\n\n"
150  "The start value cannot be greater than the stop value"));
151  m_validatorStartX = new QDoubleValidator;
152  m_editStartX->setValidator (m_validatorStartX);
153  connect (m_editStartX, SIGNAL (textChanged (const QString &)), this, SLOT (slotStartX (const QString &)));
154  layoutGroup->addWidget (m_editStartX, 2, 1);
155 
156  QLabel *labelStep = new QLabel (tr ("Step:"));
157  layoutGroup->addWidget (labelStep, 3, 0);
158 
159  m_editStepX = new QLineEdit;
160  m_editStepX->setWhatsThis (tr ("Difference in value between two successive X grid lines.\n\n"
161  "The step value must be greater than zero"));
162  m_validatorStepX = new QDoubleValidator;
163  m_editStepX->setValidator (m_validatorStepX);
164  connect (m_editStepX, SIGNAL (textChanged (const QString &)), this, SLOT (slotStepX (const QString &)));
165  layoutGroup->addWidget (m_editStepX, 3, 1);
166 
167  QLabel *labelStop = new QLabel (tr ("Stop:"));
168  layoutGroup->addWidget (labelStop, 4, 0);
169 
170  m_editStopX = new QLineEdit;
171  m_editStopX->setWhatsThis (tr ("Value of the last X grid line.\n\n"
172  "The stop value cannot be less than the start value"));
173  m_validatorStopX = new QDoubleValidator;
174  m_editStopX->setValidator (m_validatorStopX);
175  connect (m_editStopX, SIGNAL (textChanged (const QString &)), this, SLOT (slotStopX (const QString &)));
176  layoutGroup->addWidget (m_editStopX, 4, 1);
177 }
178 
179 void DlgSettingsGridRemoval::createRemoveGridLinesY (QGridLayout *layout, int &row)
180 {
181  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createRemoveGridLinesY";
182 
183  QString titleY = tr ("Y Grid Lines");
184  if (false) {
185  titleY = QString (tr ("R Grid Lines"));
186  }
187  QGroupBox *groupY = new QGroupBox (titleY);
188  layout->addWidget (groupY, row++, 3);
189 
190  QGridLayout *layoutGroup = new QGridLayout;
191  groupY->setLayout (layoutGroup);
192 
193  QLabel *labelDisable = new QLabel (tr ("Disable:"));
194  layoutGroup->addWidget (labelDisable, 0, 0);
195 
196  m_cmbDisableY = new QComboBox;
197  m_cmbDisableY->setWhatsThis (tr ("Disabled value.\n\n"
198  "The Y grid lines are specified using only three values at a time. For flexibility, four values "
199  "are offered so you must chose which value is disabled. Once disabled, that value is simply "
200  "updated as the other values change"));
201  m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_COUNT),
202  QVariant (GRID_COORD_DISABLE_COUNT));
203  m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_START),
204  QVariant (GRID_COORD_DISABLE_START));
205  m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STEP),
206  QVariant (GRID_COORD_DISABLE_STEP));
207  m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STOP),
208  QVariant (GRID_COORD_DISABLE_STOP));
209  connect (m_cmbDisableY, SIGNAL (activated (const QString &)), this, SLOT (slotDisableY (const QString &))); // activated() ignores code changes
210  layoutGroup->addWidget (m_cmbDisableY, 0, 1);
211 
212  QLabel *labelCount = new QLabel (tr ("Count:"));
213  layoutGroup->addWidget (labelCount, 1, 0);
214 
215  m_editCountY = new QLineEdit;
216  m_editCountY->setWhatsThis (tr ("Number of Y grid lines.\n\n"
217  "The number of Y grid lines must be entered as an integer greater than zero"));
218  m_validatorCountY = new QDoubleValidator (COUNT_MIN, COUNT_MAX, COUNT_DECIMALS);
219  m_editCountY->setValidator (m_validatorCountY);
220  connect (m_editCountY, SIGNAL (textChanged (const QString &)), this, SLOT (slotCountY (const QString &)));
221  layoutGroup->addWidget (m_editCountY, 1, 1);
222 
223  QLabel *labelStart = new QLabel (tr ("Start:"));
224  layoutGroup->addWidget (labelStart, 2, 0);
225 
226  m_editStartY = new QLineEdit;
227  m_editStartY->setWhatsThis (tr ("Value of the first Y grid line.\n\n"
228  "The start value cannot be greater than the stop value"));
229  m_validatorStartY = new QDoubleValidator;
230  m_editStartY->setValidator (m_validatorStartY);
231  connect (m_editStartY, SIGNAL (textChanged (const QString &)), this, SLOT (slotStartY (const QString &)));
232  layoutGroup->addWidget (m_editStartY, 2, 1);
233 
234  QLabel *labelStep = new QLabel (tr ("Step:"));
235  layoutGroup->addWidget (labelStep, 3, 0);
236 
237  m_editStepY = new QLineEdit;
238  m_editStepY->setWhatsThis (tr ("Difference in value between two successive Y grid lines.\n\n"
239  "The step value must be greater than zero"));
240  m_validatorStepY = new QDoubleValidator;
241  m_editStepY->setValidator (m_validatorStepY);
242  connect (m_editStepY, SIGNAL (textChanged (const QString &)), this, SLOT (slotStepY (const QString &)));
243  layoutGroup->addWidget (m_editStepY, 3, 1);
244 
245  QLabel *labelStop = new QLabel (tr ("Stop:"));
246  layoutGroup->addWidget (labelStop, 4, 0);
247 
248  m_editStopY = new QLineEdit;
249  m_editStopY->setWhatsThis (tr ("Value of the last Y grid line.\n\n"
250  "The stop value cannot be less than the start value"));
251  m_validatorStopY = new QDoubleValidator;
252  m_editStopY->setValidator (m_validatorStopY);
253  connect (m_editStopY, SIGNAL (textChanged (const QString &)), this, SLOT (slotStopY (const QString &)));
254  layoutGroup->addWidget (m_editStopY, 4, 1);
255 }
256 
258 {
259  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createSubPanel";
260 
261  const int COLUMN_CHECKBOX_WIDTH = 60;
262 
263  QWidget *subPanel = new QWidget ();
264  QGridLayout *layout = new QGridLayout (subPanel);
265  subPanel->setLayout (layout);
266 
267  layout->setColumnStretch(0, 1); // Empty first column
268  layout->setColumnStretch(1, 0); // Checkbox part of "section" checkboxes. In other rows this has empty space as indentation
269  layout->setColumnMinimumWidth(1, COLUMN_CHECKBOX_WIDTH);
270  layout->setColumnStretch(2, 0); // X
271  layout->setColumnStretch(3, 0); // Y
272  layout->setColumnStretch(4, 1); // Empty last column
273 
274  int row = 0;
275  createRemoveGridLines (layout, row);
276  createPreview (layout, row);
277 
278  return subPanel;
279 }
280 
282 {
283  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::handleOk";
284 
285  // Set the stable flag
286  m_modelGridRemovalAfter->setStable ();
287 
289  cmdMediator ().document(),
290  *m_modelGridRemovalBefore,
291  *m_modelGridRemovalAfter);
292  cmdMediator ().push (cmd);
293 
294  hide ();
295 }
296 
298 {
299  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::load";
300 
301  setCmdMediator (cmdMediator);
302 
303  // Flush old data
304  if (m_modelGridRemovalBefore != 0) {
305  delete m_modelGridRemovalBefore;
306  }
307  if (m_modelGridRemovalAfter != 0) {
308  delete m_modelGridRemovalAfter;
309  }
310 
311  // Save new data
312  m_modelGridRemovalBefore = new DocumentModelGridRemoval (cmdMediator.document());
313  m_modelGridRemovalAfter = new DocumentModelGridRemoval (cmdMediator.document());
314 
315  // Sanity checks. Incoming defaults must be acceptable to the local limits
316  ENGAUGE_ASSERT (CLOSE_DISTANCE_MIN <= m_modelGridRemovalAfter->closeDistance());
317  ENGAUGE_ASSERT (CLOSE_DISTANCE_MAX >= m_modelGridRemovalAfter->closeDistance());
318 
319  // Populate controls
320  m_chkRemoveGridLines->setChecked (m_modelGridRemovalAfter->removeDefinedGridLines());
321 
322  m_editCloseDistance->setText (QString::number (m_modelGridRemovalAfter->closeDistance()));
323 
324  int indexDisableX = m_cmbDisableX->findData (QVariant (m_modelGridRemovalAfter->gridCoordDisableX()));
325  m_cmbDisableX->setCurrentIndex (indexDisableX);
326 
327  m_editCountX->setText(QString::number(m_modelGridRemovalAfter->countX()));
328  m_editStartX->setText(QString::number(m_modelGridRemovalAfter->startX()));
329  m_editStepX->setText(QString::number(m_modelGridRemovalAfter->stepX()));
330  m_editStopX->setText(QString::number(m_modelGridRemovalAfter->stopX()));
331 
332  int indexDisableY = m_cmbDisableY->findData (QVariant (m_modelGridRemovalAfter->gridCoordDisableY()));
333  m_cmbDisableY->setCurrentIndex (indexDisableY);
334 
335  m_editCountY->setText(QString::number(m_modelGridRemovalAfter->countY()));
336  m_editStartY->setText(QString::number(m_modelGridRemovalAfter->startY()));
337  m_editStepY->setText(QString::number(m_modelGridRemovalAfter->stepY()));
338  m_editStopY->setText(QString::number(m_modelGridRemovalAfter->stopY()));
339 
340  m_scenePreview->clear();
341  m_scenePreview->addPixmap (cmdMediator.document().pixmap());
342 
343  updateControls ();
344  enableOk (false); // Disable Ok button since there not yet any changes
345  updatePreview();
346 }
347 
349 {
350  if (!smallDialogs) {
351  setMinimumHeight (MINIMUM_HEIGHT);
352  }
353 }
354 
355 void DlgSettingsGridRemoval::slotCloseDistance(const QString &)
356 {
357  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotCloseDistance";
358 
359  m_modelGridRemovalAfter->setCloseDistance(m_editCloseDistance->text().toDouble());
360  updateControls ();
361  updatePreview();
362 }
363 
364 void DlgSettingsGridRemoval::slotCountX(const QString &count)
365 {
366  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotCountX";
367 
368  m_modelGridRemovalAfter->setCountX(count.toInt());
369  updateControls ();
370  updatePreview();
371 }
372 
373 void DlgSettingsGridRemoval::slotCountY(const QString &count)
374 {
375  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotCountY";
376 
377  m_modelGridRemovalAfter->setCountY(count.toInt());
378  updateControls ();
379  updatePreview();
380 }
381 
382 void DlgSettingsGridRemoval::slotDisableX(const QString &)
383 {
384  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotDisableX";
385 
386  GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
387  m_modelGridRemovalAfter->setGridCoordDisableX(gridCoordDisable);
388  updateControls();
389  updatePreview();
390 }
391 
392 void DlgSettingsGridRemoval::slotDisableY(const QString &)
393 {
394  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotDisableY";
395 
396  GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
397  m_modelGridRemovalAfter->setGridCoordDisableY(gridCoordDisable);
398  updateControls();
399  updatePreview();
400 }
401 
402 void DlgSettingsGridRemoval::slotRemoveGridLines (int state)
403 {
404  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotRemoveGridLines";
405 
406  m_modelGridRemovalAfter->setRemoveDefinedGridLines(state == Qt::Checked);
407  updateControls();
408  updatePreview();
409 }
410 
411 void DlgSettingsGridRemoval::slotStartX(const QString &startX)
412 {
413  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStartX";
414 
415  m_modelGridRemovalAfter->setStartX(startX.toDouble());
416  updateControls();
417  updatePreview();
418 }
419 
420 void DlgSettingsGridRemoval::slotStartY(const QString &startY)
421 {
422  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStartY";
423 
424  m_modelGridRemovalAfter->setStartY(startY.toDouble());
425  updateControls();
426  updatePreview();
427 }
428 
429 void DlgSettingsGridRemoval::slotStepX(const QString &stepX)
430 {
431  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStepX";
432 
433  m_modelGridRemovalAfter->setStepX(stepX.toDouble());
434  updateControls();
435  updatePreview();
436 }
437 
438 void DlgSettingsGridRemoval::slotStepY(const QString &stepY)
439 {
440  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStepY";
441 
442  m_modelGridRemovalAfter->setStepY(stepY.toDouble());
443  updateControls();
444  updatePreview();
445 }
446 
447 void DlgSettingsGridRemoval::slotStopX(const QString &stopX)
448 {
449  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStopX";
450 
451  m_modelGridRemovalAfter->setStopX(stopX.toDouble());
452  updateControls();
453  updatePreview();
454 }
455 
456 void DlgSettingsGridRemoval::slotStopY(const QString &stopY)
457 {
458  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::slotStopY";
459 
460  m_modelGridRemovalAfter->setStopY(stopY.toDouble());
461  updateControls();
462  updatePreview();
463 }
464 
465 void DlgSettingsGridRemoval::updateControls ()
466 {
467  m_editCloseDistance->setEnabled (m_chkRemoveGridLines->isChecked ());
468 
469  m_cmbDisableX->setEnabled (m_chkRemoveGridLines->isChecked ());
470 
471  GridCoordDisable disableX = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
472  m_editCountX->setEnabled (m_chkRemoveGridLines->isChecked () && (disableX != GRID_COORD_DISABLE_COUNT));
473  m_editStartX->setEnabled (m_chkRemoveGridLines->isChecked () && (disableX != GRID_COORD_DISABLE_START));
474  m_editStepX->setEnabled (m_chkRemoveGridLines->isChecked () && (disableX != GRID_COORD_DISABLE_STEP));
475  m_editStopX->setEnabled (m_chkRemoveGridLines->isChecked () && (disableX != GRID_COORD_DISABLE_STOP));
476 
477  m_cmbDisableY->setEnabled (m_chkRemoveGridLines->isChecked ());
478 
479  GridCoordDisable disableY = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
480  m_editCountY->setEnabled (m_chkRemoveGridLines->isChecked () && (disableY != GRID_COORD_DISABLE_COUNT));
481  m_editStartY->setEnabled (m_chkRemoveGridLines->isChecked () && (disableY != GRID_COORD_DISABLE_START));
482  m_editStepY->setEnabled (m_chkRemoveGridLines->isChecked () && (disableY != GRID_COORD_DISABLE_STEP));
483  m_editStopY->setEnabled (m_chkRemoveGridLines->isChecked () && (disableY != GRID_COORD_DISABLE_STOP));
484 
485  QString textCloseDistance = m_editCloseDistance->text();
486  QString textCountX = m_editCountX->text();
487  QString textStartX = m_editStartX->text();
488  QString textStepX = m_editStepX->text();
489  QString textStopX = m_editStopX->text();
490  QString textCountY = m_editCountY->text();
491  QString textStartY = m_editStartY->text();
492  QString textStepY = m_editStepY->text();
493  QString textStopY = m_editStopY->text();
494 
495  int pos;
496  bool isOk = (m_validatorCloseDistance->validate (textCloseDistance, pos) == QValidator::Acceptable) &&
497  (m_validatorCountX->validate (textCountX, pos) == QValidator::Acceptable) &&
498  (m_validatorStartX->validate (textStartX, pos) == QValidator::Acceptable) &&
499  (m_validatorStepX->validate (textStepX, pos) == QValidator::Acceptable) &&
500  (m_validatorStopX->validate (textStopX, pos) == QValidator::Acceptable) &&
501  (m_validatorCountY->validate (textCountY, pos) == QValidator::Acceptable) &&
502  (m_validatorStartY->validate (textStartY, pos) == QValidator::Acceptable) &&
503  (m_validatorStepY->validate (textStepY, pos) == QValidator::Acceptable) &&
504  (m_validatorStopY->validate (textStopY, pos) == QValidator::Acceptable);
505  enableOk (isOk);
506 }
507 
508 void DlgSettingsGridRemoval::updatePreview ()
509 {
510 
511 }
double closeDistance() const
Get method for close distance.
bool removeDefinedGridLines() const
Get method for removing defined grid lines.
void setCloseDistance(double closeDistance)
Set method for close distance.
double startY() const
Get method for y start.
void setCountX(int countX)
Set method for x count.
void setStopY(double stopY)
Set method for y stop.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setStartY(double startY)
Set method for y start.
GridCoordDisable gridCoordDisableX() const
Get method for x coord parameter to disable.
void setStepY(double stepY)
Set method for y step.
QPixmap pixmap() const
Return the image that is being digitized.
Definition: Document.cpp:815
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
double stepY() const
Get method for y step.
GridCoordDisable gridCoordDisableY() const
Get method for y coord parameter to disable.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
void setStartX(double startX)
Set method for x start.
virtual void handleOk()
Process slotOk.
void setCountY(int countY)
Set method for y count.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
DlgSettingsGridRemoval(MainWindow &mainWindow)
Single constructor.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:14
void setStepX(double stepX)
Set method for x step.
double stopX() const
Get method for x stop.
void setRemoveDefinedGridLines(bool removeDefinedGridLines)
Set method for removing defined grid lines.
double startX() const
Get method for x start.
double stopY() const
Get method for y stop.
void setGridCoordDisableY(GridCoordDisable gridCoordDisable)
Set method for y coord parameter to disable.
Command for DlgSettingsGridRemoval.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setGridCoordDisableX(GridCoordDisable gridCoordDisable)
Set method for x coord parameter to disable.
int countX() const
Get method for x count.
int countY() const
Get method for y count.
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
double stepX() const
Get method for x step.
void setStable()
Set the stable flag to true. This public version has no argument since it cannot be undone...
void enableOk(bool enable)
Let leaf subclass control the Ok button.
Command queue stack.
Definition: CmdMediator.h:23
Abstract base class for all Settings dialogs.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:86
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void setStopX(double stopX)
Set method for x stop.