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

Dialog for editing grid removal settings. More...

#include <DlgSettingsGridRemoval.h>

Inheritance diagram for DlgSettingsGridRemoval:
Inheritance graph
Collaboration diagram for DlgSettingsGridRemoval:
Collaboration graph

Public Member Functions

 DlgSettingsGridRemoval (MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsGridRemoval ()
 
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 grid removal settings.

Definition at line 23 of file DlgSettingsGridRemoval.h.

Constructor & Destructor Documentation

◆ DlgSettingsGridRemoval()

DlgSettingsGridRemoval::DlgSettingsGridRemoval ( MainWindow & mainWindow)

Single constructor.

Definition at line 35 of file DlgSettingsGridRemoval.cpp.

35 :
36 DlgSettingsAbstractBase (tr ("Grid Removal"),
37 "DlgSettingsGridRemoval",
39 m_validatorCloseDistance (nullptr),
40 m_validatorCountX (nullptr),
41 m_validatorStartX (nullptr),
42 m_validatorStepX (nullptr),
43 m_validatorStopX (nullptr),
44 m_validatorCountY (nullptr),
45 m_validatorStartY (nullptr),
46 m_validatorStepY (nullptr),
47 m_validatorStopY (nullptr),
48 m_scenePreview (nullptr),
49 m_viewPreview (nullptr),
50 m_modelGridRemovalBefore (nullptr),
51 m_modelGridRemovalAfter (nullptr)
52{
53 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::DlgSettingsGridRemoval";
54
55 QWidget *subPanel = createSubPanel ();
56 finishPanel (subPanel);
57}
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

◆ ~DlgSettingsGridRemoval()

DlgSettingsGridRemoval::~DlgSettingsGridRemoval ( )
virtual

Definition at line 59 of file DlgSettingsGridRemoval.cpp.

60{
61 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::~DlgSettingsGridRemoval";
62
63 delete m_validatorCloseDistance;
64 delete m_validatorCountX;
65 delete m_validatorStartX;
66 delete m_validatorStepX;
67 delete m_validatorStopX;
68 delete m_validatorCountY;
69 delete m_validatorStartY;
70 delete m_validatorStepY;
71 delete m_validatorStopY;
72}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsGridRemoval::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 74 of file DlgSettingsGridRemoval.cpp.

75{
76}

◆ createSubPanel()

QWidget * DlgSettingsGridRemoval::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 279 of file DlgSettingsGridRemoval.cpp.

280{
281 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createSubPanel";
282
283 QWidget *subPanel = new QWidget ();
284 QGridLayout *layout = new QGridLayout (subPanel);
285 subPanel->setLayout (layout);
286
287 layout->setColumnStretch(0, 1); // Empty first column
288 layout->setColumnStretch(1, 0); // Checkbox part of "section" checkboxes. In other rows this has empty space as indentation
289 layout->setColumnStretch(2, 0); // X
290 layout->setColumnStretch(3, 0); // Y
291 layout->setColumnStretch(4, 1); // Empty last column
292
293 int row = 0;
294 createRemoveGridLines (layout, row);
295 createPreview (layout, row);
296
297 return subPanel;
298}

◆ handleOk()

void DlgSettingsGridRemoval::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 300 of file DlgSettingsGridRemoval.cpp.

301{
302 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::handleOk";
303
304 // Set the stable flag
305 m_modelGridRemovalAfter->setStable ();
306
307 CmdSettingsGridRemoval *cmd = new CmdSettingsGridRemoval (mainWindow (),
308 cmdMediator ().document(),
309 *m_modelGridRemovalBefore,
310 *m_modelGridRemovalAfter);
311 cmdMediator ().push (cmd);
312
313 hide ();
314}
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsGridRemoval::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 316 of file DlgSettingsGridRemoval.cpp.

317{
318 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::load";
319
321
322 // Flush old data
323 delete m_modelGridRemovalBefore;
324 delete m_modelGridRemovalAfter;
325
326 // Save new data
327 m_modelGridRemovalBefore = new DocumentModelGridRemoval (cmdMediator.document());
328 m_modelGridRemovalAfter = new DocumentModelGridRemoval (cmdMediator.document());
329
330 // Sanity checks. Incoming defaults must be acceptable to the local limits
332 ENGAUGE_ASSERT (CLOSE_DISTANCE_MAX >= m_modelGridRemovalAfter->closeDistance());
333
334 // Populate controls
335 m_chkRemoveGridLines->setChecked (m_modelGridRemovalAfter->removeDefinedGridLines());
336
337 m_editCloseDistance->setText (QString::number (m_modelGridRemovalAfter->closeDistance()));
338
339 int indexDisableX = m_cmbDisableX->findData (QVariant (m_modelGridRemovalAfter->gridCoordDisableX()));
340 m_cmbDisableX->setCurrentIndex (indexDisableX);
341
342 m_editCountX->setText(QString::number(m_modelGridRemovalAfter->countX()));
343 m_editStartX->setText(QString::number(m_modelGridRemovalAfter->startX()));
344 m_editStepX->setText(QString::number(m_modelGridRemovalAfter->stepX()));
345 m_editStopX->setText(QString::number(m_modelGridRemovalAfter->stopX()));
346
347 int indexDisableY = m_cmbDisableY->findData (QVariant (m_modelGridRemovalAfter->gridCoordDisableY()));
348 m_cmbDisableY->setCurrentIndex (indexDisableY);
349
350 m_editCountY->setText(QString::number(m_modelGridRemovalAfter->countY()));
351 m_editStartY->setText(QString::number(m_modelGridRemovalAfter->startY()));
352 m_editStepY->setText(QString::number(m_modelGridRemovalAfter->stepY()));
353 m_editStopY->setText(QString::number(m_modelGridRemovalAfter->stopY()));
354
355 updateControls ();
356 enableOk (false); // Disable Ok button since there not yet any changes
357 updatePreview();
358}
const double CLOSE_DISTANCE_MIN
const double CLOSE_DISTANCE_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 DlgSettingsGridRemoval::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 360 of file DlgSettingsGridRemoval.cpp.

361{
362 if (!smallDialogs) {
363 setMinimumHeight (MINIMUM_HEIGHT);
364 }
365}
const int MINIMUM_HEIGHT

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