Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsPointMatch Class Reference

Dialog for editing point match settings, for DigitizeStatePointMatch. More...

#include <DlgSettingsPointMatch.h>

Inheritance diagram for DlgSettingsPointMatch:
Inheritance graph
Collaboration diagram for DlgSettingsPointMatch:
Collaboration graph

Public Member Functions

 DlgSettingsPointMatch (MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsPointMatch ()
 
virtual void createOptionalSaveDefault (QHBoxLayout *layout)
 Let subclass define an optional Save As Default button.
 
virtual QWidget * createSubPanel ()
 Create dialog-specific panel to which base class will add Ok and Cancel buttons.
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document.
 
virtual void setSmallDialogs (bool smallDialogs)
 If false then dialogs have a minimum size so all controls are visible.
 
- Public Member Functions inherited from DlgSettingsAbstractBase
 DlgSettingsAbstractBase (const QString &title, const QString &dialogName, MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsAbstractBase ()
 

Protected Member Functions

virtual void handleOk ()
 Process slotOk.
 
- Protected Member Functions inherited from DlgSettingsAbstractBase
CmdMediatorcmdMediator ()
 Provide access to Document information wrapped inside CmdMediator.
 
void enableOk (bool enable)
 Let leaf subclass control the Ok button.
 
void finishPanel (QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
 Add Ok and Cancel buttons to subpanel to get the whole dialog.
 
MainWindowmainWindow ()
 Get method for MainWindow.
 
const MainWindowmainWindow () const
 Const get method for MainWindow.
 
void populateColorComboWithoutTransparent (QComboBox &combo)
 Add colors in color palette to combobox, without transparent entry at end.
 
void populateColorComboWithTransparent (QComboBox &combo)
 Add colors in color palette to combobox, with transparent entry at end.
 
void setCmdMediator (CmdMediator &cmdMediator)
 Store CmdMediator for easy access by the leaf class.
 
void setDisableOkAtStartup (bool disableOkAtStartup)
 Override the default Ok button behavior applied in showEvent.
 

Additional Inherited Members

- Static Protected Attributes inherited from DlgSettingsAbstractBase
static int MINIMUM_DIALOG_WIDTH = 380
 Dialog layout constant that guarantees every widget has sufficient room. Can be increased by finishPanel.
 
static int MINIMUM_PREVIEW_HEIGHT = 100
 Dialog layout constant that guarantees preview has sufficent room.
 

Detailed Description

Dialog for editing point match settings, for DigitizeStatePointMatch.

Definition at line 24 of file DlgSettingsPointMatch.h.

Constructor & Destructor Documentation

◆ DlgSettingsPointMatch()

DlgSettingsPointMatch::DlgSettingsPointMatch ( MainWindow & mainWindow)

Single constructor.

Definition at line 29 of file DlgSettingsPointMatch.cpp.

29 :
30 DlgSettingsAbstractBase (tr ("Point Match"),
31 "DlgSettingsPointMatch",
33 m_scenePreview (nullptr),
34 m_viewPreview (nullptr),
35 m_circle (nullptr),
36 m_modelPointMatchBefore (nullptr),
37 m_modelPointMatchAfter (nullptr)
38{
39 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::DlgSettingsPointMatch";
40
41 QWidget *subPanel = createSubPanel ();
42 finishPanel (subPanel);
43}
log4cpp::Category * mainCat
Definition Logger.cpp:14
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
MainWindow & mainWindow()
Get method for MainWindow.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ ~DlgSettingsPointMatch()

DlgSettingsPointMatch::~DlgSettingsPointMatch ( )
virtual

Definition at line 45 of file DlgSettingsPointMatch.cpp.

46{
47 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::~DlgSettingsPointMatch";
48}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsPointMatch::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 126 of file DlgSettingsPointMatch.cpp.

127{
128}

◆ createSubPanel()

QWidget * DlgSettingsPointMatch::createSubPanel ( )
virtual

Create dialog-specific panel to which base class will add Ok and Cancel buttons.

Implements DlgSettingsAbstractBase.

Definition at line 153 of file DlgSettingsPointMatch.cpp.

154{
155 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::createSubPanel";
156
157 QWidget *subPanel = new QWidget ();
158 QGridLayout *layout = new QGridLayout (subPanel);
159 subPanel->setLayout (layout);
160
161 layout->setColumnStretch(0, 1); // Empty column
162 layout->setColumnStretch(1, 0); // Labels
163 layout->setColumnStretch(2, 0); // Controls
164 layout->setColumnStretch(3, 1); // Empty column
165
166 int row = 0;
167 createControls (layout, row);
168 createPreview (layout, row);
169 createTemplate ();
170
171 return subPanel;
172}

◆ handleOk()

void DlgSettingsPointMatch::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 186 of file DlgSettingsPointMatch.cpp.

187{
188 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::handleOk";
189
190 CmdSettingsPointMatch *cmd = new CmdSettingsPointMatch (mainWindow (),
191 cmdMediator ().document(),
192 *m_modelPointMatchBefore,
193 *m_modelPointMatchAfter);
194 cmdMediator ().push (cmd);
195
196 hide ();
197}
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsPointMatch::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 207 of file DlgSettingsPointMatch.cpp.

208{
209 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::load";
210
212
213 // Flush old data
214 delete m_modelPointMatchBefore;
215 delete m_modelPointMatchAfter;
216
217 // Save new data
218 m_modelPointMatchBefore = new DocumentModelPointMatch (cmdMediator.document());
219 m_modelPointMatchAfter = new DocumentModelPointMatch (cmdMediator.document());
220
221 // Sanity checks. Incoming defaults must be acceptable to the local limits
223 ENGAUGE_ASSERT (POINT_SIZE_MAX > m_modelPointMatchAfter->maxPointSize());
224
225 // Populate controls
226 m_spinPointSize->setValue(qFloor (m_modelPointMatchAfter->maxPointSize()));
227
228 int indexAccepted = m_cmbAcceptedPointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorAccepted()));
229 ENGAUGE_ASSERT (indexAccepted >= 0);
230 m_cmbAcceptedPointColor->setCurrentIndex(indexAccepted);
231
232 int indexCandidate = m_cmbCandidatePointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorCandidate()));
233 ENGAUGE_ASSERT (indexCandidate >= 0);
234 m_cmbCandidatePointColor->setCurrentIndex(indexCandidate);
235
236 int indexRejected = m_cmbRejectedPointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorRejected()));
237 ENGAUGE_ASSERT (indexRejected >= 0);
238 m_cmbRejectedPointColor->setCurrentIndex(indexRejected);
239
240 initializeBox ();
241
242 // Fix the preview size using an invisible boundary
243 QGraphicsRectItem *boundary = m_scenePreview->addRect (QRect (0,
244 0,
245 cmdMediator.document().pixmap().width (),
246 cmdMediator.document().pixmap().height ()));
247 boundary->setVisible (false);
248
249 m_scenePreview->addPixmap (cmdMediator.document().pixmap());
250
251 updateControls();
252 enableOk (false); // Disable Ok button since there not yet any changes
253 updatePreview();
254}
const int POINT_SIZE_MIN
const int POINT_SIZE_MAX
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void enableOk(bool enable)
Let leaf subclass control the Ok button.

◆ setSmallDialogs()

void DlgSettingsPointMatch::setSmallDialogs ( bool smallDialogs)
virtual

If false then dialogs have a minimum size so all controls are visible.

Implements DlgSettingsAbstractBase.

Definition at line 263 of file DlgSettingsPointMatch.cpp.

264{
265 if (!smallDialogs) {
266 setMinimumHeight (MINIMUM_HEIGHT);
267 }
268}
const int MINIMUM_HEIGHT

The documentation for this class was generated from the following files: