Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
DlgSettingsMainWindow Class Reference

Dialog for editing main window settings, which are entirely independent of all documents. More...

#include <DlgSettingsMainWindow.h>

Inheritance diagram for DlgSettingsMainWindow:
Inheritance graph
Collaboration diagram for DlgSettingsMainWindow:
Collaboration graph

Public Member Functions

 DlgSettingsMainWindow (MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsMainWindow ()
 
virtual void createOptionalSaveDefault (QHBoxLayout *layout)
 Let subclass define an optional Save As Default button.
 
virtual QWidgetcreateSubPanel ()
 Create dialog-specific panel to which base class will add Ok and Cancel buttons.
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document.
 
void loadMainWindowModel (CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
 Replaced load method since the main window settings are independent of document, unlike other DlgSettings* classes.
 
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 main window settings, which are entirely independent of all documents.

Definition at line 24 of file DlgSettingsMainWindow.h.

Constructor & Destructor Documentation

◆ DlgSettingsMainWindow()

DlgSettingsMainWindow::DlgSettingsMainWindow ( MainWindow & mainWindow)

Single constructor.

Definition at line 42 of file DlgSettingsMainWindow.cpp.

42 :
43 DlgSettingsAbstractBase (tr ("Main Window"),
44 "DlgSettingsMainWindow",
46 m_modelMainWindowBefore (nullptr),
47 m_modelMainWindowAfter (nullptr)
48{
49 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::DlgSettingsMainWindow";
50
54}
const int INNER_RADIUS_MIN
const int MINIMUM_DIALOG_WIDTH_MAIN_WINDOW
log4cpp::Category * mainCat
Definition Logger.cpp:14
Abstract base class for all Settings dialogs.
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

◆ ~DlgSettingsMainWindow()

DlgSettingsMainWindow::~DlgSettingsMainWindow ( )
virtual

Definition at line 56 of file DlgSettingsMainWindow.cpp.

57{
58 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::~DlgSettingsMainWindow";
59}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsMainWindow::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 257 of file DlgSettingsMainWindow.cpp.

258{
259 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createOptionalSaveDefault";
260}

◆ createSubPanel()

QWidget * DlgSettingsMainWindow::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 262 of file DlgSettingsMainWindow.cpp.

263{
264 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createSubPanel";
265
266 QWidget *subPanel = new QWidget ();
268 subPanel->setLayout (layout);
269
270 layout->setColumnStretch(0, 1); // Empty first column
271 layout->setColumnStretch(1, 0); // Labels
272 layout->setColumnStretch(2, 0); // Values
273 layout->setColumnStretch(3, 1); // Empty first column
274
275 int row = 0;
276 createControls (layout, row);
277
278 return subPanel;
279}

◆ handleOk()

void DlgSettingsMainWindow::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 291 of file DlgSettingsMainWindow.cpp.

292{
293 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::handleOk";
294
295 mainWindow().updateSettingsMainWindow (*m_modelMainWindowAfter);
296
297 hide ();
298}
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.

◆ load()

void DlgSettingsMainWindow::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 300 of file DlgSettingsMainWindow.cpp.

301{
302 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::load";
303
304 ENGAUGE_ASSERT (false);
305}
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...

◆ loadMainWindowModel()

void DlgSettingsMainWindow::loadMainWindowModel ( CmdMediator & cmdMediator,
const MainWindowModel & modelMainWindow )

Replaced load method since the main window settings are independent of document, unlike other DlgSettings* classes.

Definition at line 307 of file DlgSettingsMainWindow.cpp.

309{
310 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::loadMainWindowModel";
311
313
314 // Flush old data
315 delete m_modelMainWindowBefore;
316 delete m_modelMainWindowAfter;
317
318 // Save new data
319 m_modelMainWindowBefore = new MainWindowModel (modelMainWindow);
320 m_modelMainWindowAfter = new MainWindowModel (modelMainWindow);
321
322 // Populate controls
323 int index = m_cmbZoomFactor->findData (m_modelMainWindowAfter->zoomFactorInitial());
324 m_cmbZoomFactor->setCurrentIndex (index);
325 index = m_cmbZoomControl->findData (m_modelMainWindowAfter->zoomControl());
326 m_cmbZoomControl->setCurrentIndex (index);
327 QString locLabel = QLocaleToString (m_modelMainWindowAfter->locale());
328 index = m_cmbLocale->findText (locLabel);
329 if (index < 0) {
330 // Somehow an invalid locale is selected. Fix it by setting to default
331 locLabel = QLocaleToString (QLocale::system().name());
332 index = m_cmbLocale->findText (locLabel);
333 }
334 m_cmbLocale->setCurrentIndex(index);
335 index = m_cmbImportCropping->findData (m_modelMainWindowAfter->importCropping());
336 m_cmbImportCropping->setCurrentIndex (index);
337 m_chkTitleBarFormat->setChecked (m_modelMainWindowAfter->mainTitleBarFormat() == MAIN_TITLE_BAR_FORMAT_PATH);
338#ifdef ENGAUGE_PDF
339 index = m_cmbPdfResolution->findData (m_modelMainWindowAfter->pdfResolution());
340 m_cmbPdfResolution->setCurrentIndex(index);
341#endif
342 m_spinMaximumGridLines->setValue (m_modelMainWindowAfter->maximumGridLines());
343 m_spinHighlightOpacity->setValue (m_modelMainWindowAfter->highlightOpacity());
344 m_chkSmallDialogs->setChecked (m_modelMainWindowAfter->smallDialogs());
345 m_chkDragDropExport->setChecked (m_modelMainWindowAfter->dragDropExport());
346 m_spinSignificantDigits->setValue (m_modelMainWindowAfter->significantDigits ());
347 m_chkImageReplaceRenamesDocument->setChecked (m_modelMainWindowAfter->imageReplaceRenamesDocument());
348
349 updateControls ();
350 enableOk (false); // Disable Ok button since there not yet any changes
351}
@ MAIN_TITLE_BAR_FORMAT_PATH
Filename without path.
QString QLocaleToString(const QLocale &locale)
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
Model for DlgSettingsMainWindow.
QLocale locale() const
Get method for locale.
bool dragDropExport() const
Get method for drag and drop export.
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
ImportCropping importCropping() const
Get method for import cropping.
bool smallDialogs() const
Get method for small dialogs flag.
double highlightOpacity() const
Get method for highlight opacity.
ZoomControl zoomControl() const
Get method for zoom control.
int maximumGridLines() const
Maximum number of grid lines.
int significantDigits() const
Get method for significant digits.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.

◆ setSmallDialogs()

void DlgSettingsMainWindow::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 353 of file DlgSettingsMainWindow.cpp.

354{
355}

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