Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
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. More...
 
virtual ~DlgSettingsAxesChecker ()
 
virtual void createOptionalSaveDefault (QHBoxLayout *layout)
 Let subclass define an optional Save As Default button. More...
 
virtual QWidget * createSubPanel ()
 Create dialog-specific panel to which base class will add Ok and Cancel buttons. More...
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document. More...
 
virtual void setSmallDialogs (bool smallDialogs)
 If false then dialogs have a minimum size so all controls are visible. More...
 
- Public Member Functions inherited from DlgSettingsAbstractBase
 DlgSettingsAbstractBase (const QString &title, const QString &dialogName, MainWindow &mainWindow)
 Single constructor. More...
 
virtual ~DlgSettingsAbstractBase ()
 

Protected Member Functions

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

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. More...
 
static int MINIMUM_PREVIEW_HEIGHT = 100
 Dialog layout constant that guarantees preview has sufficent room. More...
 

Detailed Description

Dialog for editing axes checker settings.

Definition at line 24 of file DlgSettingsAxesChecker.h.

Constructor & Destructor Documentation

DlgSettingsAxesChecker::DlgSettingsAxesChecker ( MainWindow mainWindow)

Single constructor.

Definition at line 38 of file DlgSettingsAxesChecker.cpp.

38  :
39  DlgSettingsAbstractBase (tr ("Axes Checker"),
40  "DlgSettingsAxesChecker",
41  mainWindow),
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Abstract base class for all Settings dialogs.
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

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 }
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 
197  cmdMediator ().document(),
198  *m_modelAxesCheckerBefore,
199  *m_modelAxesCheckerAfter);
200  cmdMediator ().push (cmd);
201 
202  hide ();
203 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Command for DlgSettingsAxesChecker.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
MainWindow & mainWindow()
Get method for MainWindow.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
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 
209  setCmdMediator (cmdMediator);
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 }
int checkerSeconds() const
Get method for checker lifetime in seconds.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
ColorPalette lineColor() const
Get method for line color.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
CheckerMode checkerMode() const
Get method for checker lifetime mode.
CheckerMode
Options for axes checker mode. Specifically, how long the checker is displayed after a change...
Definition: CheckerMode.h:13
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void enableOk(bool enable)
Let leaf subclass control the Ok button.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) &amp;&amp; !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
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: