diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-05-31 22:24:53 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-05-31 22:24:53 +0200 |
commit | 92f20d53fb946a6d87e0b3aff3fd258ea31338db (patch) | |
tree | 9d2daffbf99d595476ef411cab2346887248168c /gui/include | |
parent | 6630c1cbf5cb1f2672776ada14315dcdf058b567 (diff) |
implement options model, show current options in options dialog
Diffstat (limited to 'gui/include')
-rw-r--r-- | gui/include/clientmodel.h | 5 | ||||
-rw-r--r-- | gui/include/mainoptionspage.h | 21 | ||||
-rw-r--r-- | gui/include/optionsdialog.h | 10 | ||||
-rw-r--r-- | gui/include/optionsmodel.h | 34 |
4 files changed, 68 insertions, 2 deletions
diff --git a/gui/include/clientmodel.h b/gui/include/clientmodel.h index 828c80f8db..44f1c0ab64 100644 --- a/gui/include/clientmodel.h +++ b/gui/include/clientmodel.h @@ -2,6 +2,7 @@ #define CLIENTMODEL_H #include <QObject> +class OptionsModel; class ClientModel : public QObject { @@ -20,6 +21,8 @@ public: MiscError }; + OptionsModel *getOptionsModel(); + qint64 getBalance(); QString getAddress(); int getNumConnections(); @@ -29,6 +32,8 @@ public: qint64 getTransactionFee(); StatusCode sendCoins(const QString &payTo, qint64 payAmount); +private: + OptionsModel *options_model; signals: void balanceChanged(qint64 balance); diff --git a/gui/include/mainoptionspage.h b/gui/include/mainoptionspage.h index de2ef9fcd0..4ef5e60a25 100644 --- a/gui/include/mainoptionspage.h +++ b/gui/include/mainoptionspage.h @@ -3,11 +3,30 @@ #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); + 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: diff --git a/gui/include/optionsdialog.h b/gui/include/optionsdialog.h index 501c82e9f3..c064b0a93c 100644 --- a/gui/include/optionsdialog.h +++ b/gui/include/optionsdialog.h @@ -7,13 +7,18 @@ QT_BEGIN_NAMESPACE class QStackedWidget; class QListWidget; class QListWidgetItem; +class QDataWidgetMapper; QT_END_NAMESPACE +class OptionsModel; +class MainOptionsPage; class OptionsDialog : public QDialog { Q_OBJECT public: - explicit OptionsDialog(QWidget *parent = 0); + explicit OptionsDialog(QWidget *parent=0); + + void setModel(OptionsModel *model); signals: @@ -22,6 +27,9 @@ public slots: private: QListWidget *contents_widget; QStackedWidget *pages_widget; + MainOptionsPage *main_options_page; + OptionsModel *model; + QDataWidgetMapper *mapper; void setupMainPage(); }; diff --git a/gui/include/optionsmodel.h b/gui/include/optionsmodel.h new file mode 100644 index 0000000000..4dd21c7f07 --- /dev/null +++ b/gui/include/optionsmodel.h @@ -0,0 +1,34 @@ +#ifndef OPTIONSMODEL_H +#define OPTIONSMODEL_H + +#include <QAbstractListModel> + +class OptionsModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit OptionsModel(QObject *parent = 0); + + enum OptionID { + StartAtStartup, + MinimizeToTray, + MapPortUPnP, + MinimizeOnClose, + ConnectSOCKS4, + ProxyIP, + ProxyPort, + Fee, + OptionIDRowCount + }; + + int rowCount(const QModelIndex & parent = QModelIndex()) const; + QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); + +signals: + +public slots: + +}; + +#endif // OPTIONSMODEL_H |