Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsSegments.h
Go to the documentation of this file.
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
11#include "GraphicsPoint.h"
12#include <QImage>
13#include <QList>
14
15class ButtonWhatsThis;
17class QCheckBox;
18class QComboBox;
19class QGridLayout;
20class QGraphicsScene;
21class QSpinBox;
22class Segment;
23class ViewPreview;
24
25typedef QList<GraphicsPoint*> GraphicsPoints;
26
32{
33 Q_OBJECT;
34
35public:
38 virtual ~DlgSettingsSegments();
39
40 virtual void createOptionalSaveDefault (QHBoxLayout *layout);
41 virtual QWidget *createSubPanel ();
42 virtual void load (CmdMediator &cmdMediator);
43 virtual void setSmallDialogs (bool smallDialogs);
44
45private slots:
46 void slotFillCorners (int state);
47 void slotInactiveOpacity (const QString &);
48 void slotLineColor (const QString &);
49 void slotLineWidthActive (int);
50 void slotLineWidthInactive (int);
51 void slotMinLength (const QString &);
52 void slotPointSeparation (const QString &);
53 void slotWhatsThis();
54
55protected:
56 virtual void handleOk ();
57
58private:
59
60 enum HoverState {
61 HOVER_ACTIVE,
62 HOVER_INACTIVE
63 };
64
65 void clearPointsOneScene (GraphicsPoints &points);
66 void createControls (QGridLayout *layout, int &row);
67 void createPreview (QGridLayout *layout, int &row);
68 QImage createPreviewImage () const;
69 void updateControls();
70 void updatePreview();
71 void updatePreviewOneScene (QGraphicsScene *scenePreview,
72 QList<Segment*> &segments,
73 GraphicsPoints &points,
74 HoverState hoverState);
75
76 ButtonWhatsThis *m_btnWhatsThis;
77 QSpinBox *m_spinMinLength;
78 QSpinBox *m_spinPointSeparation;
79 QCheckBox *m_chkFillCorners;
80 QSpinBox *m_spinLineWidthActive;
81 QSpinBox *m_spinLineWidthInactive;
82 QComboBox *m_cmbLineColor;
83 QComboBox *m_cmbInactiveOpacity;
84
85 QGraphicsScene *m_scenePreviewActive;
86 QGraphicsScene *m_scenePreviewInactive;
87 ViewPreview *m_viewPreviewActive;
88 ViewPreview *m_viewPreviewInactive;
89
90 DocumentModelSegments *m_modelSegmentsBefore;
91 DocumentModelSegments *m_modelSegmentsAfter;
92
93 QList<Segment*> m_segmentsActive; // Segments extracted from image
94 QList<Segment*> m_segmentsInactive; // Segments extracted from image
95 GraphicsPoints m_pointsActive; // Points spread along the segments
96 GraphicsPoints m_pointsInactive; // Points spread along the segments
97
98 bool m_loading; // Flag that prevents multiple preview updates during loading while controls get loaded
99};
100
101#endif // DLG_SETTINGS_SEGMENTS_H
QList< GraphicsPoint * > GraphicsPoints
Unobtrusive button to trigger QWhatsThis since some operating systems (Linux Mint) do not show WhatsT...
Command queue stack.
Definition CmdMediator.h:24
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
MainWindow & mainWindow()
Get method for MainWindow.
virtual void handleOk()
Process slotOk.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
DlgSettingsSegments(MainWindow &mainWindow)
Single constructor.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Model for DlgSettingsSegments and CmdSettingsSegments.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
Selectable piecewise-defined line that follows a filtered line in the image.
Definition Segment.h:22
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...
Definition ViewPreview.h:15