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 ButtonWhatsThis;
14class CmdMediator;
15class MainWindow;
16class QComboBox;
17class QGraphicsScene;
18class QGridLayout;
19class QHBoxLayout;
20class QPixmap;
21class QScrollArea;
22
24class DlgSettingsAbstractBase : public QDialog
25{
26 Q_OBJECT;
27
28public:
30 DlgSettingsAbstractBase(const QString &title,
31 const QString &dialogName,
34
35protected:
38
41 void addPixmap (QGraphicsScene &scene,
42 const QPixmap &pixmap);
43
45 void createWhatsThis (QGridLayout *layout,
46 ButtonWhatsThis *button,
47 int row,
48 int column);
49
51 virtual void createOptionalSaveDefault (QHBoxLayout *layout) = 0;
52
54 virtual QWidget *createSubPanel () = 0;
55
64 void enableOk (bool enable);
65
67 void finishPanel (QWidget *subPanel,
68 int minimumWidth = MINIMUM_DIALOG_WIDTH,
69 int minimumHeightOrZero = 0);
70
72 virtual void handleOk () = 0;
73
75 virtual void load (CmdMediator &cmdMediator) = 0;
76
79
82
85
87 const MainWindow &mainWindow () const;
88
90 void populateColorComboWithoutTransparent (QComboBox &combo);
91
93 void populateColorComboWithTransparent (QComboBox &combo);
94
97
99 void setDisableOkAtStartup(bool disableOkAtStartup);
100
102 virtual void setSmallDialogs (bool smallDialogs) = 0;
103
104private slots:
105
107 void slotCancel();
108
110 void slotOk ();
111
112private:
114
115 void saveGeometryToSettings ();
116
118 virtual void hideEvent (QHideEvent *event);
119
121 virtual void showEvent (QShowEvent *event);
122
123 QScrollArea *m_scroll;
124 MainWindow &m_mainWindow;
125 CmdMediator *m_cmdMediator; // Cannot be const since Document gets a command pushed if dialog is ok'ed
126 QPushButton *m_btnCancel;
127 QPushButton *m_btnOk;
128
129 const QString m_dialogName;
130 bool m_disableOkAtStartup;
131};
132
133#endif // DLG_SETTINGS_ABSTRACT_BASE_H
Unobtrusive button to trigger QWhatsThis since some operating systems (Linux Mint) do not show WhatsT...
Command queue stack.
Definition CmdMediator.h:24
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
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 createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.
void populateColorComboWithoutTransparent(QComboBox &combo)
Add colors in color palette to combobox, without transparent entry at end.
void addPixmap(QGraphicsScene &scene, const QPixmap &pixmap)
Adds pixmap to the scene.
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:95