Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsAbstractBase.h
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef DLG_SETTINGS_ABSTRACT_BASE_H
8#define DLG_SETTINGS_ABSTRACT_BASE_H
9
10#include <QDialog>
11#include <QObject>
12
13class CmdMediator;
14class MainWindow;
15class QComboBox;
16class QHBoxLayout;
17
19class DlgSettingsAbstractBase : public QDialog
20{
21 Q_OBJECT;
22
23public:
25 DlgSettingsAbstractBase(const QString &title,
26 const QString &dialogName,
29
30protected:
33
35 virtual void createOptionalSaveDefault (QHBoxLayout *layout) = 0;
36
38 virtual QWidget *createSubPanel () = 0;
39
48 void enableOk (bool enable);
49
51 void finishPanel (QWidget *subPanel);
52
54 virtual void handleOk () = 0;
55
58
61
63 virtual void load (CmdMediator &cmdMediator) = 0;
64
67
69 const MainWindow &mainWindow () const;
70
72 void populateColorComboWithoutTransparent (QComboBox &combo);
73
75 void populateColorComboWithTransparent (QComboBox &combo);
76
79
81 void setDisableOkAtStartup(bool disableOkAtStartup);
82
83private slots:
85 virtual void showEvent (QShowEvent *event);
86
88 void slotCancel();
89
91 void slotOk ();
92
93private:
95
96 void saveGeometryToSettings ();
97
98 MainWindow &m_mainWindow;
99 CmdMediator *m_cmdMediator; // Cannot be const since Document gets a command pushed if dialog is ok'ed
100 QPushButton *m_btnCancel;
101 QPushButton *m_btnOk;
102
103 const QString m_dialogName;
104 bool m_disableOkAtStartup;
105};
106
107#endif // DLG_SETTINGS_ABSTRACT_BASE_H
Command queue stack.
Definition CmdMediator.h:24
Abstract base class for all Settings dialogs.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
static int MINIMUM_DIALOG_WIDTH
Dialog layout constant that guarantees every widget has sufficient room.
virtual QWidget * createSubPanel()=0
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
void populateColorComboWithTransparent(QComboBox &combo)
Add colors in color palette to combobox, with transparent entry at end.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)=0
Let subclass define an optional Save As Default button.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void populateColorComboWithoutTransparent(QComboBox &combo)
Add colors in color palette to combobox, without transparent entry at end.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
void setDisableOkAtStartup(bool disableOkAtStartup)
Override the default Ok button behavior applied in showEvent.
void finishPanel(QWidget *subPanel)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
virtual void handleOk()=0
Process slotOk.
virtual void load(CmdMediator &cmdMediator)=0
Load settings from Document.
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:78