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 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 grid removal settings.

Definition at line 24 of file DlgSettingsGridRemoval.h.

Constructor & Destructor Documentation

◆ DlgSettingsGridRemoval()

DlgSettingsGridRemoval::DlgSettingsGridRemoval ( MainWindow & mainWindow)

Single constructor.

Definition at line 37 of file DlgSettingsGridRemoval.cpp.

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

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

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsGridRemoval::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 76 of file DlgSettingsGridRemoval.cpp.

77{
78}

◆ createSubPanel()

QWidget * DlgSettingsGridRemoval::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 281 of file DlgSettingsGridRemoval.cpp.

282{
283 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createSubPanel";
284
285 QWidget *subPanel = new QWidget ();
286 QGridLayout *layout = new QGridLayout (subPanel);
287 subPanel->setLayout (layout);
288
289 layout->setColumnStretch(0, 1); // Empty first column
290 layout->setColumnStretch(1, 0); // Checkbox part of "section" checkboxes. In other rows this has empty space as indentation
291 layout->setColumnStretch(2, 0); // X
292 layout->setColumnStretch(3, 0); // Y
293 layout->setColumnStretch(4, 1); // Empty last column
294
295 int row = 0;
296
297 createWhatsThis (layout,
298 m_btnWhatsThis,
299 row++,
300 4);
301
302 createRemoveGridLines (layout, row);
303 createPreview (layout, row);
304
305 return subPanel;
306}
void createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.

◆ handleOk()

void DlgSettingsGridRemoval::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 308 of file DlgSettingsGridRemoval.cpp.

309{
310 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::handleOk";
311
312 // Set the stable flag
313 m_modelGridRemovalAfter->setStable ();
314
315 CmdSettingsGridRemoval *cmd = new CmdSettingsGridRemoval (mainWindow (),
316 cmdMediator ().document(),
317 *m_modelGridRemovalBefore,
318 *m_modelGridRemovalAfter);
319 cmdMediator ().push (cmd);
320
321 hide ();
322}
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 324 of file DlgSettingsGridRemoval.cpp.

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

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

Implements DlgSettingsAbstractBase.

Definition at line 368 of file DlgSettingsGridRemoval.cpp.

369{
370 if (!smallDialogs) {
371 setMinimumHeight (MINIMUM_HEIGHT);
372 }
373}
const int MINIMUM_HEIGHT

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