Engauge Digitizer  2
DlgSettingsSegments.h
1 #ifndef DLG_SETTINGS_SEGMENTS_H
2 #define DLG_SETTINGS_SEGMENTS_H
3 
4 #include "DlgSettingsAbstractBase.h"
5 #include "GraphicsPoint.h"
6 #include <QImage>
7 #include <QList>
8 
10 class QCheckBox;
11 class QComboBox;
12 class QGridLayout;
13 class QGraphicsScene;
14 class QSpinBox;
15 class Segment;
16 class ViewPreview;
17 
18 typedef QList<GraphicsPoint*> GraphicsPoints;
19 
22 {
23  Q_OBJECT;
24 
25 public:
28  virtual ~DlgSettingsSegments();
29 
30  virtual void createOptionalSaveDefault (QHBoxLayout *layout);
31  virtual QWidget *createSubPanel ();
32  virtual void load (CmdMediator &cmdMediator);
33 
34 private slots:
35  void slotFillCorners (int state);
36  void slotLineColor (const QString &);
37  void slotLineWidth (int);
38  void slotMinLength (const QString &);
39  void slotPointSeparation (const QString &);
40 
41 protected:
42  virtual void handleOk ();
43 
44 private:
45 
46  void clearPoints();
47  void createControls (QGridLayout *layout, int &row);
48  void createPreview (QGridLayout *layout, int &row);
49  QImage createPreviewImage () const;
50  void updateControls();
51  void updatePreview();
52 
53  QSpinBox *m_spinMinLength;
54  QSpinBox *m_spinPointSeparation;
55  QCheckBox *m_chkFillCorners;
56  QSpinBox *m_spinLineWidth;
57  QComboBox *m_cmbLineColor;
58 
59  QGraphicsScene *m_scenePreview;
60  ViewPreview *m_viewPreview;
61 
62  DocumentModelSegments *m_modelSegmentsBefore;
63  DocumentModelSegments *m_modelSegmentsAfter;
64 
65  QList<Segment*> m_segments; // Segments extracted from image
66  GraphicsPoints m_points; // Points spread along the segments
67 
68  bool m_loading; // Flag that prevents multiple preview updates during loading while controls get loaded
69 };
70 
71 #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:8
Selectable piecewise-defined line that follows a filtered line in the image.
Definition: Segment.h:15
Command queue stack.
Definition: CmdMediator.h:16
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:66
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.