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 #ifndef DLG_SETTINGS_GRID_REMOVAL_H
8 #define DLG_SETTINGS_GRID_REMOVAL_H
9 
10 #include "DlgSettingsAbstractBase.h"
11 
12 class DocumentModelGridRemoval;
13 class QCheckBox;
14 class QComboBox;
15 class QDoubleValidator;
16 class QGraphicsScene;
17 class QGridLayout;
18 class QHBoxLayout;
19 class QLineEdit;
20 class ViewPreview;
21 
22 /// Dialog for editing grid removal settings.
23 class DlgSettingsGridRemoval : public DlgSettingsAbstractBase
24 {
25   Q_OBJECT;
26 
27 public:
28   /// Single constructor.
29   DlgSettingsGridRemoval(MainWindow &mainWindow);
30   virtual ~DlgSettingsGridRemoval();
31 
32   virtual void createOptionalSaveDefault (QHBoxLayout *layout);
33   virtual QWidget *createSubPanel ();
34   virtual void load (CmdMediator &cmdMediator);
35   virtual void setSmallDialogs (bool smallDialogs);
36 
37 private slots:
38   void slotRemoveGridLines (int);
39   void slotCloseDistance(const QString &);
40 
41   void slotDisableX(const QString &);
42   void slotCountX(const QString &);
43   void slotStartX(const QString &);
44   void slotStepX(const QString &);
45   void slotStopX(const QString &);
46 
47   void slotDisableY(const QString &);
48   void slotCountY(const QString &);
49   void slotStartY(const QString &);
50   void slotStepY(const QString &);
51   void slotStopY(const QString &);
52 
53 protected:
54   virtual void handleOk ();
55 
56 private:
57 
58   void createRemoveGridLines (QGridLayout *layout, int &row);
59   void createRemoveGridLinesX (QGridLayout *layoutGridLines, int &row);
60   void createRemoveGridLinesY (QGridLayout *layoutGridLines, int &row);
61   void createPreview (QGridLayout *layout, int &row);
62   void updateControls ();
63   void updateDisplayedVariableX ();
64   void updateDisplayedVariableY ();
65   void updatePreview();
66 
67   QCheckBox *m_chkRemoveGridLines;
68   QLineEdit *m_editCloseDistance;
69   QDoubleValidator *m_validatorCloseDistance;
70 
71   QComboBox *m_cmbDisableX;
72   QLineEdit *m_editCountX;
73   QLineEdit *m_editStartX;
74   QLineEdit *m_editStepX;
75   QLineEdit *m_editStopX;
76   QDoubleValidator *m_validatorCountX;
77   QDoubleValidator *m_validatorStartX;
78   QDoubleValidator *m_validatorStepX;
79   QDoubleValidator *m_validatorStopX;
80 
81   QComboBox *m_cmbDisableY;
82   QLineEdit *m_editCountY;
83   QLineEdit *m_editStartY;
84   QLineEdit *m_editStepY;
85   QLineEdit *m_editStopY;
86   QDoubleValidator *m_validatorCountY;
87   QDoubleValidator *m_validatorStartY;
88   QDoubleValidator *m_validatorStepY;
89   QDoubleValidator *m_validatorStopY;
90 
91   QGraphicsScene *m_scenePreview;
92   ViewPreview *m_viewPreview;
93 
94   DocumentModelGridRemoval *m_modelGridRemovalBefore;
95   DocumentModelGridRemoval *m_modelGridRemovalAfter;
96 };
97 
98 #endif // DLG_SETTINGS_GRID_REMOVAL_H
99