Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
DlgSettingsSegments.h
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_SEGMENTS_H
8 #define DLG_SETTINGS_SEGMENTS_H
9 
10 #include "DlgSettingsAbstractBase.h"
11 #include "GraphicsPoint.h"
12 #include <QImage>
13 #include <QList>
14 
16 class QCheckBox;
17 class QComboBox;
18 class QGridLayout;
19 class QGraphicsScene;
20 class QSpinBox;
21 class Segment;
22 class ViewPreview;
23 
24 typedef QList<GraphicsPoint*> GraphicsPoints;
25 
28 {
29  Q_OBJECT;
30 
31 public:
34  virtual ~DlgSettingsSegments();
35 
36  virtual void createOptionalSaveDefault (QHBoxLayout *layout);
37  virtual QWidget *createSubPanel ();
38  virtual void load (CmdMediator &cmdMediator);
39 
40 private slots:
41  void slotFillCorners (int state);
42  void slotLineColor (const QString &);
43  void slotLineWidth (int);
44  void slotMinLength (const QString &);
45  void slotPointSeparation (const QString &);
46 
47 protected:
48  virtual void handleOk ();
49 
50 private:
51 
52  void clearPoints();
53  void createControls (QGridLayout *layout, int &row);
54  void createPreview (QGridLayout *layout, int &row);
55  QImage createPreviewImage () const;
56  void updateControls();
57  void updatePreview();
58 
59  QSpinBox *m_spinMinLength;
60  QSpinBox *m_spinPointSeparation;
61  QCheckBox *m_chkFillCorners;
62  QSpinBox *m_spinLineWidth;
63  QComboBox *m_cmbLineColor;
64 
65  QGraphicsScene *m_scenePreview;
66  ViewPreview *m_viewPreview;
67 
68  DocumentModelSegments *m_modelSegmentsBefore;
69  DocumentModelSegments *m_modelSegmentsAfter;
70 
71  QList<Segment*> m_segments; // Segments extracted from image
72  GraphicsPoints m_points; // Points spread along the segments
73 
74  bool m_loading; // Flag that prevents multiple preview updates during loading while controls get loaded
75 };
76 
77 #endif // DLG_SETTINGS_SEGMENTS_H
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:14
Selectable piecewise-defined line that follows a filtered line in the image.
Definition: Segment.h:21
Command queue stack.
Definition: CmdMediator.h:23
DlgSettingsSegments(MainWindow &mainWindow)
Single constructor.
Model for DlgSettingsSegments and CmdSettingsSegments.
Abstract base class for all Settings dialogs.
virtual void handleOk()
Process slotOk.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
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:77
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.