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

Dialog for editing general settings. More...

#include <DlgSettingsGeneral.h>

Inheritance diagram for DlgSettingsGeneral:
Inheritance graph
Collaboration diagram for DlgSettingsGeneral:
Collaboration graph

Public Member Functions

 DlgSettingsGeneral (MainWindow &mainWindow)
 Single constructor.
virtual ~DlgSettingsGeneral ()
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 general settings.

Definition at line 19 of file DlgSettingsGeneral.h.

Constructor & Destructor Documentation

◆ DlgSettingsGeneral()

DlgSettingsGeneral::DlgSettingsGeneral ( MainWindow & mainWindow)

Single constructor.

Definition at line 26 of file DlgSettingsGeneral.cpp.

26 :
27 DlgSettingsAbstractBase (tr ("General"),
28 "DlgSettingsGeneral",
30 m_modelGeneralBefore (nullptr),
31 m_modelGeneralAfter (nullptr)
32{
33 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::DlgSettingsGeneral";
34
35 QWidget *subPanel = createSubPanel ();
36 finishPanel (subPanel);
37}
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

◆ ~DlgSettingsGeneral()

DlgSettingsGeneral::~DlgSettingsGeneral ( )
virtual

Definition at line 39 of file DlgSettingsGeneral.cpp.

40{
41 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::~DlgSettingsGeneral";
42}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsGeneral::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 77 of file DlgSettingsGeneral.cpp.

78{
79 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::createOptionalSaveDefault";
80
81 m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
82 m_btnSaveDefault->setWhatsThis (tr ("Save the settings for use as future defaults, according to the curve name selection."));
83 connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
84 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
85}

◆ createSubPanel()

QWidget * DlgSettingsGeneral::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 87 of file DlgSettingsGeneral.cpp.

88{
89 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::createSubPanel";
90
91 QWidget *subPanel = new QWidget ();
92 QGridLayout *layout = new QGridLayout (subPanel);
93 subPanel->setLayout (layout);
94
95 layout->setColumnStretch(0, 1); // Empty first column
96 layout->setColumnStretch(1, 0); // Labels
97 layout->setColumnStretch(2, 0); // Values
98 layout->setColumnStretch(3, 1); // Empty first column
99
100 int row = 0;
101
102 createWhatsThis (layout,
103 m_btnWhatsThis,
104 row++,
105 3);
106
107 createControls (layout, row);
108
109 return subPanel;
110}
void createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.

◆ handleOk()

void DlgSettingsGeneral::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 112 of file DlgSettingsGeneral.cpp.

113{
114 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::handleOk";
115
116 CmdSettingsGeneral *cmd = new CmdSettingsGeneral (mainWindow (),
117 cmdMediator ().document(),
118 *m_modelGeneralBefore,
119 *m_modelGeneralAfter);
120 cmdMediator ().push (cmd);
121
122 hide ();
123}
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsGeneral::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 125 of file DlgSettingsGeneral.cpp.

126{
127 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::load";
128
130
131 // Flush old data
132 delete m_modelGeneralBefore;
133 delete m_modelGeneralAfter;
134
135 // Save new data
136 m_modelGeneralBefore = new DocumentModelGeneral (cmdMediator.document());
137 m_modelGeneralAfter = new DocumentModelGeneral (cmdMediator.document());
138
139 // Populate controls
140 m_spinCursorSize->setValue (m_modelGeneralAfter->cursorSize());
141 m_spinExtraPrecision->setValue (m_modelGeneralAfter->extraPrecision());
142
143 updateControls ();
144 enableOk (false); // Disable Ok button since there not yet any changes
145}
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 DlgSettingsGeneral::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 147 of file DlgSettingsGeneral.cpp.

148{
149}

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