Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsAbstractBase.h
Go to the documentation of this file.
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;
17class QScrollArea;
18
20class DlgSettingsAbstractBase : public QDialog
21{
22 Q_OBJECT;
23
24public:
26 DlgSettingsAbstractBase(const QString &title,
27 const QString &dialogName,
30
31protected:
34
36 virtual void createOptionalSaveDefault (QHBoxLayout *layout) = 0;
37
39 virtual QWidget *createSubPanel () = 0;
40
49 void enableOk (bool enable);
50
52 void finishPanel (QWidget *subPanel,
53 int minimumWidth = MINIMUM_DIALOG_WIDTH,
54 int minimumHeightOrZero = 0);
55
57 virtual void handleOk () = 0;
58
60 virtual void load (CmdMediator &cmdMediator) = 0;
61
64
67
70
72 const MainWindow &mainWindow () const;
73
75 void populateColorComboWithoutTransparent (QComboBox &combo);
76
78 void populateColorComboWithTransparent (QComboBox &combo);
79
82
84 void setDisableOkAtStartup(bool disableOkAtStartup);
85
87 virtual void setSmallDialogs (bool smallDialogs) = 0;
88
89private slots:
90
92 void slotCancel();
93
95 void slotOk ();
96
97private:
99
100 void saveGeometryToSettings ();
101
103 virtual void hideEvent (QHideEvent *event);
104
106 virtual void showEvent (QShowEvent *event);
107
108 QScrollArea *m_scroll;
109 MainWindow &m_mainWindow;
110 CmdMediator *m_cmdMediator; // Cannot be const since Document gets a command pushed if dialog is ok'ed
111 QPushButton *m_btnCancel;
112 QPushButton *m_btnOk;
113
114 const QString m_dialogName;
115 bool m_disableOkAtStartup;
116};
117
118#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. Can be increased by finishPa...
virtual QWidget * createSubPanel()=0
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
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.
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.
virtual void setSmallDialogs(bool smallDialogs)=0
If false then dialogs have a minimum size so all controls are visible.
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:92