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