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

Dialog for editing axes checker settings. More...

#include <DlgSettingsAxesChecker.h>

Inheritance diagram for DlgSettingsAxesChecker:
Inheritance graph
Collaboration diagram for DlgSettingsAxesChecker:
Collaboration graph

Public Member Functions

 DlgSettingsAxesChecker (MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsAxesChecker ()
 
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 axes checker settings.

Definition at line 24 of file DlgSettingsAxesChecker.h.

Constructor & Destructor Documentation

◆ DlgSettingsAxesChecker()

DlgSettingsAxesChecker::DlgSettingsAxesChecker ( MainWindow & mainWindow)

Single constructor.

Definition at line 38 of file DlgSettingsAxesChecker.cpp.

38 :
39 DlgSettingsAbstractBase (tr ("Axes Checker"),
40 "DlgSettingsAxesChecker",
42 m_checker (nullptr),
43 m_modelAxesCheckerBefore (nullptr),
44 m_modelAxesCheckerAfter (nullptr),
45 m_modelCoords (nullptr)
46{
47 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::DlgSettingsAxesChecker";
48
49 QWidget *subPanel = createSubPanel ();
50 finishPanel (subPanel);
51}
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

◆ ~DlgSettingsAxesChecker()

DlgSettingsAxesChecker::~DlgSettingsAxesChecker ( )
virtual

Definition at line 53 of file DlgSettingsAxesChecker.cpp.

54{
55 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::~DlgSettingsAxesChecker";
56
57 delete m_checker;
58}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsAxesChecker::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 107 of file DlgSettingsAxesChecker.cpp.

108{
109}

◆ createSubPanel()

QWidget * DlgSettingsAxesChecker::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 170 of file DlgSettingsAxesChecker.cpp.

171{
172 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::createSubPanel";
173
174 QWidget *subPanel = new QWidget ();
175 QGridLayout *layout = new QGridLayout (subPanel);
176 subPanel->setLayout (layout);
177
178 layout->setColumnStretch(0, 1); // Empty first column
179 layout->setColumnStretch(1, 0); // X
180 layout->setColumnStretch(2, 0); // Y
181 layout->setColumnStretch(3, 1); // Empty first column
182
183 int row = 0;
184 createControls (layout, row);
185 createPreview (layout, row);
186
187 createPoints ();
188
189 return subPanel;
190}

◆ handleOk()

void DlgSettingsAxesChecker::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 192 of file DlgSettingsAxesChecker.cpp.

193{
194 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::handleOk";
195
196 CmdSettingsAxesChecker *cmd = new CmdSettingsAxesChecker (mainWindow (),
197 cmdMediator ().document(),
198 *m_modelAxesCheckerBefore,
199 *m_modelAxesCheckerAfter);
200 cmdMediator ().push (cmd);
201
202 hide ();
203}
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsAxesChecker::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 205 of file DlgSettingsAxesChecker.cpp.

206{
207 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::load";
208
210
211 // Flush old data
212 delete m_modelAxesCheckerBefore;
213 delete m_modelAxesCheckerAfter;
214 delete m_modelCoords;
215
216 // Save new data
217 m_modelAxesCheckerBefore = new DocumentModelAxesChecker (cmdMediator.document());
218 m_modelAxesCheckerAfter = new DocumentModelAxesChecker (cmdMediator.document());
219 m_modelCoords = new DocumentModelCoords (cmdMediator.document());
220
221 // Populate controls
222 CheckerMode checkerMode = m_modelAxesCheckerAfter->checkerMode();
223 m_btnNever->setChecked (checkerMode == CHECKER_MODE_NEVER);
224 m_btnNSeconds->setChecked (checkerMode == CHECKER_MODE_N_SECONDS);
225 m_btnForever->setChecked (checkerMode == CHECKER_MODE_FOREVER);
226 int indexSeconds = m_cmbSeconds->findData (QVariant (m_modelAxesCheckerAfter->checkerSeconds()));
227 ENGAUGE_ASSERT (indexSeconds >= 0);
228 m_cmbSeconds->setCurrentIndex(indexSeconds);
229
230 int indexLineColor = m_cmbLineColor->findData (QVariant (m_modelAxesCheckerAfter->lineColor()));
231 ENGAUGE_ASSERT (indexLineColor >= 0);
232 m_cmbLineColor->setCurrentIndex (indexLineColor);
233
234 updateControls ();
235 enableOk (false); // Disable Ok button since there not yet any changes
236 updatePreview();
237}
CheckerMode
Options for axes checker mode. Specifically, how long the checker is displayed after a change.
Definition CheckerMode.h:14
@ CHECKER_MODE_NEVER
Definition CheckerMode.h:15
@ CHECKER_MODE_N_SECONDS
Definition CheckerMode.h:16
@ CHECKER_MODE_FOREVER
Definition CheckerMode.h:17
#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 DlgSettingsAxesChecker::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 239 of file DlgSettingsAxesChecker.cpp.

240{
241 if (!smallDialogs) {
242 setMinimumHeight (MINIMUM_HEIGHT);
243 }
244}
const int MINIMUM_HEIGHT

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