Engauge Digitizer  2
DlgSettingsAbstractBase.h
1 #ifndef DLG_SETTINGS_ABSTRACT_BASE_H
2 #define DLG_SETTINGS_ABSTRACT_BASE_H
3 
4 #include <QDialog>
5 #include <QObject>
6 
7 class CmdMediator;
8 class MainWindow;
9 class QComboBox;
10 
12 class DlgSettingsAbstractBase : public QDialog
13 {
14  Q_OBJECT;
15 
16 public:
18  DlgSettingsAbstractBase(const QString &title,
19  const QString &dialogName,
21  virtual ~DlgSettingsAbstractBase();
22 
23 protected:
26 
28  virtual QWidget *createSubPanel () = 0;
29 
38  void enableOk (bool enable);
39 
41  void finishPanel (QWidget *subPanel);
42 
44  virtual void handleOk () = 0;
45 
48 
51 
53  virtual void load (CmdMediator &cmdMediator) = 0;
54 
57 
59  const MainWindow &mainWindow () const;
60 
62  void populateColorComboWithoutTransparent (QComboBox &combo);
63 
65  void populateColorComboWithTransparent (QComboBox &combo);
66 
68  void setCmdMediator (CmdMediator &cmdMediator);
69 
70 private slots:
72  virtual void showEvent (QShowEvent *event);
73 
75  void slotCancel();
76 
78  void slotOk ();
79 
80 private:
82 
83  void saveGeometryToSettings ();
84 
85  MainWindow &m_mainWindow;
86  CmdMediator *m_cmdMediator; // Cannot be const since Document gets a command pushed if dialog is ok'ed
87  QPushButton *m_btnCancel;
88  QPushButton *m_btnOk;
89 
90  const QString m_dialogName;
91 };
92 
93 #endif // DLG_SETTINGS_ABSTRACT_BASE_H
static int MINIMUM_DIALOG_WIDTH
Dialog layout constant that guarantees every widget has sufficient room.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void populateColorComboWithoutTransparent(QComboBox &combo)
Add colors in color palette to combobox, without transparent entry at end.
virtual QWidget * createSubPanel()=0
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
void finishPanel(QWidget *subPanel)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
virtual void load(CmdMediator &cmdMediator)=0
Load settings from Document.
Command queue stack.
Definition: CmdMediator.h:16
virtual void handleOk()=0
Process slotOk.
void populateColorComboWithTransparent(QComboBox &combo)
Add colors in color palette to combobox, with transparent entry at end.
Abstract base class for all Settings dialogs.
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:60
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.