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_DIGITIZE_CURVE_H
8 #define DLG_SETTINGS_DIGITIZE_CURVE_H
9 
10 #include "DlgSettingsAbstractBase.h"
11 
12 class DocumentModelDigitizeCurve;
13 class QCheckBox;
14 class QComboBox;
15 class QGridLayout;
16 class QGraphicsPixmapItem;
17 class QGraphicsScene;
18 class QGroupBox;
19 class QRadioButton;
20 class QSpinBox;
21 class ViewPreview;
22 
23 /// Dialog for editing DigitizeStateCurve settings. The preview window would should the selected
24 /// cursor in the center, but there is no way to access the image of Qt::CrossCursor (QCursor::pixmap
25 /// only works for custom cursors that were defined by a QPixmap)
26 class DlgSettingsDigitizeCurve : public DlgSettingsAbstractBase
27 {
28   Q_OBJECT;
29 
30 public:
31   /// Single constructor.
32   DlgSettingsDigitizeCurve(MainWindow &mainWindow);
33   virtual ~DlgSettingsDigitizeCurve();
34 
35   virtual void createOptionalSaveDefault (QHBoxLayout *layout);
36   virtual QWidget *createSubPanel ();
37   virtual void load (CmdMediator &cmdMediator);
38   virtual void setSmallDialogs (bool smallDialogs);
39 
40 private slots:
41   void slotCursorCustom (bool);
42   void slotCursorInnerRadius (const QString &);
43   void slotCursorLineWidth (const QString &);
44   void slotCursorSize (const QString &);
45   void slotCursorStandard (bool);
46 
47 protected:
48   virtual void handleOk ();
49 
50 private:
51 
52   void createControls (QGridLayout *layout, int &row);
53   void createPreview (QGridLayout *layout, int &row);
54   void updateControls();
55   void updatePreview();
56 
57   QGroupBox *m_boxCursor;
58   QRadioButton *m_btnStandard;
59   QRadioButton *m_btnCustom;
60   QComboBox *m_cmbSize;
61   QSpinBox *m_spinInnerRadius;
62   QSpinBox *m_spinLineWidth;
63 
64   QGraphicsScene *m_scenePreview;
65   ViewPreview *m_viewPreview;
66 
67   DocumentModelDigitizeCurve *m_modelDigitizeCurveBefore;
68   DocumentModelDigitizeCurve *m_modelDigitizeCurveAfter;
69 };
70 
71 #endif // DLG_SETTINGS_DIGITIZE_CURVE_H
72