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 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 18 of file DlgSettingsGeneral.h.

Constructor & Destructor Documentation

◆ DlgSettingsGeneral()

DlgSettingsGeneral::DlgSettingsGeneral ( MainWindow & mainWindow)

Single constructor.

Definition at line 24 of file DlgSettingsGeneral.cpp.

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

38{
39 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::~DlgSettingsGeneral";
40}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsGeneral::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 75 of file DlgSettingsGeneral.cpp.

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

◆ createSubPanel()

QWidget * DlgSettingsGeneral::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 85 of file DlgSettingsGeneral.cpp.

86{
87 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::createSubPanel";
88
89 QWidget *subPanel = new QWidget ();
90 QGridLayout *layout = new QGridLayout (subPanel);
91 subPanel->setLayout (layout);
92
93 layout->setColumnStretch(0, 1); // Empty first column
94 layout->setColumnStretch(1, 0); // Labels
95 layout->setColumnStretch(2, 0); // Values
96 layout->setColumnStretch(3, 1); // Empty first column
97
98 int row = 0;
99 createControls (layout, row);
100
101 return subPanel;
102}

◆ handleOk()

void DlgSettingsGeneral::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 104 of file DlgSettingsGeneral.cpp.

105{
106 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::handleOk";
107
108 CmdSettingsGeneral *cmd = new CmdSettingsGeneral (mainWindow (),
109 cmdMediator ().document(),
110 *m_modelGeneralBefore,
111 *m_modelGeneralAfter);
112 cmdMediator ().push (cmd);
113
114 hide ();
115}
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 117 of file DlgSettingsGeneral.cpp.

118{
119 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGeneral::load";
120
122
123 // Flush old data
124 delete m_modelGeneralBefore;
125 delete m_modelGeneralAfter;
126
127 // Save new data
128 m_modelGeneralBefore = new DocumentModelGeneral (cmdMediator.document());
129 m_modelGeneralAfter = new DocumentModelGeneral (cmdMediator.document());
130
131 // Populate controls
132 m_spinCursorSize->setValue (m_modelGeneralAfter->cursorSize());
133 m_spinExtraPrecision->setValue (m_modelGeneralAfter->extraPrecision());
134
135 updateControls ();
136 enableOk (false); // Disable Ok button since there not yet any changes
137}
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 139 of file DlgSettingsGeneral.cpp.

140{
141}

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