diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-01 14:40:06 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-01 17:15:42 +0200 |
commit | c3e0734dbc3c9ace13fbf4188b52aff6e56832b8 (patch) | |
tree | 5d2c14e7b59e080d98761473d48d69c9c623597d /gui/include | |
parent | c6dd35f03dd58a5712d38a3ce535723cdf0ffb30 (diff) |
implement options model / improve view with validators
Diffstat (limited to 'gui/include')
-rw-r--r-- | gui/include/mainoptionspage.h | 37 | ||||
-rw-r--r-- | gui/include/monitoreddatamapper.h | 32 | ||||
-rw-r--r-- | gui/include/optionsdialog.h | 5 | ||||
-rw-r--r-- | gui/include/optionsmodel.h | 4 |
4 files changed, 38 insertions, 40 deletions
diff --git a/gui/include/mainoptionspage.h b/gui/include/mainoptionspage.h deleted file mode 100644 index 4ef5e60a25..0000000000 --- a/gui/include/mainoptionspage.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MAINOPTIONSPAGE_H -#define MAINOPTIONSPAGE_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QDataWidgetMapper; -class QCheckBox; -class QLineEdit; -QT_END_NAMESPACE - -class OptionsModel; - -class MainOptionsPage : public QWidget -{ - Q_OBJECT -public: - explicit MainOptionsPage(QWidget *parent=0); - - void setMapper(QDataWidgetMapper *mapper); -private: - QCheckBox *bitcoin_at_startup; - QCheckBox *minimize_to_tray; - QCheckBox *map_port_upnp; - QCheckBox *minimize_on_close; - QCheckBox *connect_socks4; - QLineEdit *proxy_ip; - QLineEdit *proxy_port; - QLineEdit *fee_edit; - -signals: - -public slots: - -}; - -#endif // MAINOPTIONSPAGE_H diff --git a/gui/include/monitoreddatamapper.h b/gui/include/monitoreddatamapper.h new file mode 100644 index 0000000000..4dd2d1a86a --- /dev/null +++ b/gui/include/monitoreddatamapper.h @@ -0,0 +1,32 @@ +#ifndef MONITOREDDATAMAPPER_H +#define MONITOREDDATAMAPPER_H + +#include <QDataWidgetMapper> + +QT_BEGIN_NAMESPACE +class QWidget; +QT_END_NAMESPACE + +/* Data <-> Widget mapper that watches for changes, + to be able to notify when 'dirty' (for example, to + enable a commit/apply button). + */ +class MonitoredDataMapper : public QDataWidgetMapper +{ + Q_OBJECT +public: + explicit MonitoredDataMapper(QObject *parent=0); + + void addMapping(QWidget *widget, int section); + void addMapping(QWidget *widget, int section, const QByteArray &propertyName); +private: + void addChangeMonitor(QWidget *widget); + +signals: + void viewModified(); + +}; + + + +#endif // MONITOREDDATAMAPPER_H diff --git a/gui/include/optionsdialog.h b/gui/include/optionsdialog.h index ff8542d41a..07e85297d5 100644 --- a/gui/include/optionsdialog.h +++ b/gui/include/optionsdialog.h @@ -7,11 +7,11 @@ QT_BEGIN_NAMESPACE class QStackedWidget; class QListWidget; class QListWidgetItem; -class QDataWidgetMapper; class QPushButton; QT_END_NAMESPACE class OptionsModel; class MainOptionsPage; +class MonitoredDataMapper; class OptionsDialog : public QDialog { @@ -30,12 +30,13 @@ private slots: void cancelClicked(); void applyClicked(); void enableApply(); + void disableApply(); private: QListWidget *contents_widget; QStackedWidget *pages_widget; MainOptionsPage *main_options_page; OptionsModel *model; - QDataWidgetMapper *mapper; + MonitoredDataMapper *mapper; QPushButton *apply_button; void setupMainPage(); diff --git a/gui/include/optionsmodel.h b/gui/include/optionsmodel.h index 3e0bcc1ddd..4fb6d25145 100644 --- a/gui/include/optionsmodel.h +++ b/gui/include/optionsmodel.h @@ -3,7 +3,7 @@ #include <QAbstractListModel> -/* Configuration data structure for bitcoin client */ +/* Interface from QT to configuration data structure for bitcoin client */ class OptionsModel : public QAbstractListModel { Q_OBJECT @@ -28,6 +28,8 @@ public: /* Explicit getters */ qint64 getTransactionFee(); + bool getMinimizeToTray(); + bool getMinimizeOnClose(); signals: public slots: |