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 class QHBoxLayout;
11 
13 class DlgSettingsAbstractBase : public QDialog
14 {
15  Q_OBJECT;
16 
17 public:
19  DlgSettingsAbstractBase(const QString &title,
20  const QString &dialogName,
22  virtual ~DlgSettingsAbstractBase();
23 
24 protected:
27 
29  virtual void createOptionalSaveDefault (QHBoxLayout *layout) = 0;
30 
32  virtual QWidget *createSubPanel () = 0;
33 
42  void enableOk (bool enable);
43 
45  void finishPanel (QWidget *subPanel);
46 
48  virtual void handleOk () = 0;
49 
52 
55 
57  virtual void load (CmdMediator &cmdMediator) = 0;
58 
61 
63  const MainWindow &mainWindow () const;
64 
66  void populateColorComboWithoutTransparent (QComboBox &combo);
67 
69  void populateColorComboWithTransparent (QComboBox &combo);
70 
72  void setCmdMediator (CmdMediator &cmdMediator);
73 
74 private slots:
76  virtual void showEvent (QShowEvent *event);
77 
79  void slotCancel();
80 
82  void slotOk ();
83 
84 private:
86 
87  void saveGeometryToSettings ();
88 
89  MainWindow &m_mainWindow;
90  CmdMediator *m_cmdMediator; // Cannot be const since Document gets a command pushed if dialog is ok'ed
91  QPushButton *m_btnCancel;
92  QPushButton *m_btnOk;
93 
94  const QString m_dialogName;
95 };
96 
97 #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.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)=0
Let subclass define an optional Save As Default button.
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:66
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.