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 addPixmap (QGraphicsScene &scene, const QPixmap &pixmap)
 Adds pixmap to the scene.
void createWhatsThis (QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
 Create a WhatsThis button in a grid layout.
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 26 of file DlgSettingsAxesChecker.h.

Constructor & Destructor Documentation

◆ DlgSettingsAxesChecker()

DlgSettingsAxesChecker::DlgSettingsAxesChecker ( MainWindow & mainWindow)

Single constructor.

Definition at line 41 of file DlgSettingsAxesChecker.cpp.

41 :
42 DlgSettingsAbstractBase (tr ("Axes Checker"),
43 "DlgSettingsAxesChecker",
45 m_checker (nullptr),
46 m_modelAxesCheckerBefore (nullptr),
47 m_modelAxesCheckerAfter (nullptr),
48 m_modelCoords (nullptr)
49{
50 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::DlgSettingsAxesChecker";
51
52 QWidget *subPanel = createSubPanel ();
53 finishPanel (subPanel);
54}
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 56 of file DlgSettingsAxesChecker.cpp.

57{
58 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::~DlgSettingsAxesChecker";
59
60 delete m_checker;
61}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsAxesChecker::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 116 of file DlgSettingsAxesChecker.cpp.

117{
118}

◆ createSubPanel()

QWidget * DlgSettingsAxesChecker::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 179 of file DlgSettingsAxesChecker.cpp.

180{
181 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::createSubPanel";
182
183 QWidget *subPanel = new QWidget ();
184 QGridLayout *layout = new QGridLayout (subPanel);
185 subPanel->setLayout (layout);
186
187 layout->setColumnStretch(0, 1); // Empty first column
188 layout->setColumnStretch(1, 0); // X
189 layout->setColumnStretch(2, 0); // Y
190 layout->setColumnStretch(3, 1); // Empty first column
191
192 int row = 0;
193 createControls (layout, row);
194 createPreview (layout, row);
195
196 createPoints ();
197
198 return subPanel;
199}

◆ handleOk()

void DlgSettingsAxesChecker::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 201 of file DlgSettingsAxesChecker.cpp.

202{
203 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::handleOk";
204
205 CmdSettingsAxesChecker *cmd = new CmdSettingsAxesChecker (mainWindow (),
206 cmdMediator ().document(),
207 *m_modelAxesCheckerBefore,
208 *m_modelAxesCheckerAfter);
209 cmdMediator ().push (cmd);
210
211 hide ();
212}
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 214 of file DlgSettingsAxesChecker.cpp.

215{
216 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsAxesChecker::load";
217
219
220 // Flush old data
221 delete m_modelAxesCheckerBefore;
222 delete m_modelAxesCheckerAfter;
223 delete m_modelCoords;
224
225 // Save new data
226 m_modelAxesCheckerBefore = new DocumentModelAxesChecker (cmdMediator.document());
227 m_modelAxesCheckerAfter = new DocumentModelAxesChecker (cmdMediator.document());
228 m_modelCoords = new DocumentModelCoords (cmdMediator.document());
229
230 // Populate controls
231 CheckerMode checkerMode = m_modelAxesCheckerAfter->checkerMode();
232 m_btnNever->setChecked (checkerMode == CHECKER_MODE_NEVER);
233 m_btnNSeconds->setChecked (checkerMode == CHECKER_MODE_N_SECONDS);
234 m_btnForever->setChecked (checkerMode == CHECKER_MODE_FOREVER);
235 int indexSeconds = m_cmbSeconds->findData (QVariant (m_modelAxesCheckerAfter->checkerSeconds()));
236 ENGAUGE_ASSERT (indexSeconds >= 0);
237 m_cmbSeconds->setCurrentIndex(indexSeconds);
238
239 int indexLineColor = m_cmbLineColor->findData (QVariant (m_modelAxesCheckerAfter->lineColor()));
240 ENGAUGE_ASSERT (indexLineColor >= 0);
241 m_cmbLineColor->setCurrentIndex (indexLineColor);
242
243 updateControls ();
244 enableOk (false); // Disable Ok button since there not yet any changes
245 updatePreview();
246}
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.
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 248 of file DlgSettingsAxesChecker.cpp.

249{
250 if (!smallDialogs) {
251 setMinimumHeight (MINIMUM_HEIGHT);
252 }
253}
const int MINIMUM_HEIGHT

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