Engauge Digitizer 2
Loading...
Searching...
No Matches
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 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.
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 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 main window settings, which are entirely independent of all documents.

Definition at line 25 of file DlgSettingsMainWindow.h.

Constructor & Destructor Documentation

◆ DlgSettingsMainWindow()

DlgSettingsMainWindow::DlgSettingsMainWindow ( MainWindow & mainWindow)

Single constructor.

Definition at line 52 of file DlgSettingsMainWindow.cpp.

52 :
53 DlgSettingsAbstractBase (tr ("Main Window"),
54 "DlgSettingsMainWindow",
56 m_modelMainWindowBefore (nullptr),
57 m_modelMainWindowAfter (nullptr)
58{
59 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::DlgSettingsMainWindow";
60
61 QWidget *subPanel = createSubPanel ();
62 finishPanel (subPanel,
64}
const int MINIMUM_DIALOG_WIDTH_MAIN_WINDOW
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

◆ ~DlgSettingsMainWindow()

DlgSettingsMainWindow::~DlgSettingsMainWindow ( )
virtual

Definition at line 66 of file DlgSettingsMainWindow.cpp.

67{
68 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::~DlgSettingsMainWindow";
69}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsMainWindow::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 292 of file DlgSettingsMainWindow.cpp.

293{
294 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createOptionalSaveDefault";
295}

◆ createSubPanel()

QWidget * DlgSettingsMainWindow::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 297 of file DlgSettingsMainWindow.cpp.

298{
299 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createSubPanel";
300
301 QWidget *subPanel = new QWidget ();
302 QGridLayout *layout = new QGridLayout (subPanel);
303 subPanel->setLayout (layout);
304
305 layout->setColumnStretch(0, 1); // Empty first column
306 layout->setColumnStretch(1, 0); // Labels
307 layout->setColumnStretch(2, 0); // Values
308 layout->setColumnStretch(3, 1); // Empty first column
309
310 int row = 0;
311
312 createWhatsThis (layout,
313 m_btnWhatsThis,
314 row++,
315 3);
316 createControls (layout, row);
317
318 return subPanel;
319}
void createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.

◆ handleOk()

void DlgSettingsMainWindow::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 333 of file DlgSettingsMainWindow.cpp.

334{
335 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::handleOk";
336
337 mainWindow().updateSettingsMainWindow (*m_modelMainWindowAfter);
338
339 hide ();
340}
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 342 of file DlgSettingsMainWindow.cpp.

343{
344 LOG4CPP_ERROR_S ((*mainCat)) << "DlgSettingsMainWindow::load";
345
346 ENGAUGE_ASSERT (false);
347}
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

◆ 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 349 of file DlgSettingsMainWindow.cpp.

351{
352 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::loadMainWindowModel";
353
355
356 // Flush old data
357 delete m_modelMainWindowBefore;
358 delete m_modelMainWindowAfter;
359
360 // Save new data
361 m_modelMainWindowBefore = new MainWindowModel (modelMainWindow);
362 m_modelMainWindowAfter = new MainWindowModel (modelMainWindow);
363
364 // Populate controls
365 int index = m_cmbZoomFactor->findData (m_modelMainWindowAfter->zoomFactorInitial());
366 m_cmbZoomFactor->setCurrentIndex (index);
367 index = m_cmbZoomControl->findData (m_modelMainWindowAfter->zoomControl());
368 m_cmbZoomControl->setCurrentIndex (index);
369 QString locLabel = QLocaleToString (m_modelMainWindowAfter->locale());
370 index = m_cmbLocale->findText (locLabel);
371 if (index < 0) {
372 // Somehow an invalid locale is selected. Fix it by setting to default
373 locLabel = QLocale::system().name();
374 index = m_cmbLocale->findText (locLabel);
375 }
376 m_cmbLocale->setCurrentIndex(index);
377 index = m_cmbImportCropping->findData (m_modelMainWindowAfter->importCropping());
378 m_cmbImportCropping->setCurrentIndex (index);
379 index = m_cmbLoadViews->findData (m_modelMainWindowAfter->loadViews());
380 m_cmbLoadViews->setCurrentIndex (index);
381 m_chkTitleBarFormat->setChecked (m_modelMainWindowAfter->mainTitleBarFormat() == MAIN_TITLE_BAR_FORMAT_PATH);
382#ifdef ENGAUGE_PDF
383 index = m_cmbPdfResolution->findData (m_modelMainWindowAfter->pdfResolution());
384 m_cmbPdfResolution->setCurrentIndex(index);
385#endif
386 m_spinMaximumGridLines->setValue (m_modelMainWindowAfter->maximumGridLines());
387 m_spinHighlightOpacity->setValue (m_modelMainWindowAfter->highlightOpacity());
388 m_chkSmallDialogs->setChecked (m_modelMainWindowAfter->smallDialogs());
389 m_chkDragDropExport->setChecked (m_modelMainWindowAfter->dragDropExport());
390 m_spinSignificantDigits->setValue (m_modelMainWindowAfter->significantDigits ());
391 m_chkImageReplaceRenamesDocument->setChecked (m_modelMainWindowAfter->imageReplaceRenamesDocument());
392 m_spinMaximumExportedPointsPerCurve->setValue (m_modelMainWindowAfter->maximumExportedPointsPerCurve());
393
394 updateControls ();
395 enableOk (false); // Disable Ok button since there not yet any changes
396}
@ 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.

◆ 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 398 of file DlgSettingsMainWindow.cpp.

399{
400}

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