Engauge Digitizer  2
Public Member Functions | Protected Member Functions | List of all members
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. More...
 
virtual ~DlgSettingsGeneral ()
 
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 general settings.

Definition at line 17 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",
27  mainWindow),
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 }

◆ ~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 
109  cmdMediator ().document(),
110  *m_modelGeneralBefore,
111  *m_modelGeneralAfter);
112  cmdMediator ().push (cmd);
113 
114  hide ();
115 }

◆ 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 }

◆ 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:
DlgSettingsAbstractBase::mainWindow
MainWindow & mainWindow()
Get method for MainWindow.
Definition: DlgSettingsAbstractBase.cpp:122
DlgSettingsAbstractBase
Abstract base class for all Settings dialogs.
Definition: DlgSettingsAbstractBase.h:19
DocumentModelGeneral::cursorSize
int cursorSize() const
Get method for effective cursor size.
Definition: DocumentModelGeneral.cpp:55
DlgSettingsAbstractBase::finishPanel
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
Definition: DlgSettingsAbstractBase.cpp:57
DlgSettingsAbstractBase::setCmdMediator
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
Definition: DlgSettingsAbstractBase.cpp:165
DlgSettingsGeneral::createSubPanel
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
Definition: DlgSettingsGeneral.cpp:85
DocumentModelGeneral
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Definition: DocumentModelGeneral.h:15
DocumentModelGeneral::extraPrecision
int extraPrecision() const
Get method for extra digits of precsion.
Definition: DocumentModelGeneral.cpp:60
CmdMediator::document
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
DlgSettingsAbstractBase::enableOk
void enableOk(bool enable)
Let leaf subclass control the Ok button.
Definition: DlgSettingsAbstractBase.cpp:52
DlgSettingsAbstractBase::cmdMediator
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
Definition: DlgSettingsAbstractBase.cpp:45
CmdSettingsGeneral
Command for DlgSettingsGeneral.
Definition: CmdSettingsGeneral.h:15