From ba4081c1fcaddf361abd61b2721994eff5475bb3 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 11 Jun 2011 22:11:58 +0200 Subject: move back to original directory structure --- src/qt/clientmodel.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/qt/clientmodel.h (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h new file mode 100644 index 0000000000..09d1fc921e --- /dev/null +++ b/src/qt/clientmodel.h @@ -0,0 +1,61 @@ +#ifndef CLIENTMODEL_H +#define CLIENTMODEL_H + +#include + +class OptionsModel; +class AddressTableModel; +class TransactionTableModel; + +class ClientModel : public QObject +{ + Q_OBJECT +public: + explicit ClientModel(QObject *parent = 0); + + enum StatusCode + { + OK, + InvalidAmount, + InvalidAddress, + AmountExceedsBalance, + AmountWithFeeExceedsBalance, + Aborted, + MiscError + }; + + OptionsModel *getOptionsModel(); + AddressTableModel *getAddressTableModel(); + TransactionTableModel *getTransactionTableModel(); + + qint64 getBalance(); + QString getAddress(); + int getNumConnections(); + int getNumBlocks(); + int getNumTransactions(); + + /* Set default address */ + void setAddress(const QString &defaultAddress); + /* Send coins */ + StatusCode sendCoins(const QString &payTo, qint64 payAmount); +private: + OptionsModel *optionsModel; + AddressTableModel *addressTableModel; + TransactionTableModel *transactionTableModel; + +signals: + void balanceChanged(qint64 balance); + void addressChanged(const QString &address); + void numConnectionsChanged(int count); + void numBlocksChanged(int count); + void numTransactionsChanged(int count); + /* Asynchronous error notification */ + void error(const QString &title, const QString &message); + +public slots: + +private slots: + void update(); +}; + +#endif // CLIENTMODEL_H -- cgit v1.2.3 From 7df70c000a5f687953335a5ab397ab4c74a40dd4 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 18 Jun 2011 13:13:48 +0200 Subject: Prevent notification balloon-spam on initial block download, const-correctness in client model --- src/qt/clientmodel.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 09d1fc921e..f5f12fcfd9 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -28,11 +28,14 @@ public: AddressTableModel *getAddressTableModel(); TransactionTableModel *getTransactionTableModel(); - qint64 getBalance(); - QString getAddress(); - int getNumConnections(); - int getNumBlocks(); - int getNumTransactions(); + qint64 getBalance() const; + QString getAddress() const; + int getNumConnections() const; + int getNumBlocks() const; + int getNumTransactions() const; + + /* Return true if core is doing initial block download */ + bool inInitialBlockDownload() const; /* Set default address */ void setAddress(const QString &defaultAddress); -- cgit v1.2.3 From 6cab66354d5523ec3f977cfe8c4028a4c42a693d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 18 Jun 2011 21:25:38 +0200 Subject: On initial block chain download, show a progress bar --- src/qt/clientmodel.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index f5f12fcfd9..7141937441 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -36,6 +36,8 @@ public: /* Return true if core is doing initial block download */ bool inInitialBlockDownload() const; + /* Return conservative estimate of total number of blocks, or 0 if unknown */ + int getTotalBlocksEstimate() const; /* Set default address */ void setAddress(const QString &defaultAddress); -- cgit v1.2.3 From b9e80983a5c076fed655a7c3c67b53bd9ecc3dda Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 21 Jun 2011 20:34:43 +0200 Subject: Allow changing default address (fixes issue #6) --- src/qt/clientmodel.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 7141937441..169ed8c4c9 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -29,7 +29,6 @@ public: TransactionTableModel *getTransactionTableModel(); qint64 getBalance() const; - QString getAddress() const; int getNumConnections() const; int getNumBlocks() const; int getNumTransactions() const; @@ -39,8 +38,6 @@ public: /* Return conservative estimate of total number of blocks, or 0 if unknown */ int getTotalBlocksEstimate() const; - /* Set default address */ - void setAddress(const QString &defaultAddress); /* Send coins */ StatusCode sendCoins(const QString &payTo, qint64 payAmount); private: @@ -50,7 +47,6 @@ private: signals: void balanceChanged(qint64 balance); - void addressChanged(const QString &address); void numConnectionsChanged(int count); void numBlocksChanged(int count); void numTransactionsChanged(int count); -- cgit v1.2.3 From 38deedc1b52e915f2eac733e0fd7f5112361241b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 25 Jun 2011 19:32:36 +0200 Subject: allow adding address to address book in send dialog --- src/qt/clientmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 169ed8c4c9..da3e52e20e 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -39,7 +39,7 @@ public: int getTotalBlocksEstimate() const; /* Send coins */ - StatusCode sendCoins(const QString &payTo, qint64 payAmount); + StatusCode sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs=QString()); private: OptionsModel *optionsModel; AddressTableModel *addressTableModel; -- cgit v1.2.3 From e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 26 Jun 2011 19:23:24 +0200 Subject: update core to d0d80170a2ca73004e08fb85007fe055cbf4e411 (CWallet class) --- src/qt/clientmodel.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index da3e52e20e..9c23a14a0a 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -6,12 +6,13 @@ class OptionsModel; class AddressTableModel; class TransactionTableModel; +class CWallet; class ClientModel : public QObject { Q_OBJECT public: - explicit ClientModel(QObject *parent = 0); + explicit ClientModel(CWallet *wallet, QObject *parent = 0); enum StatusCode { @@ -41,6 +42,8 @@ public: /* Send coins */ StatusCode sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs=QString()); private: + CWallet *wallet; + OptionsModel *optionsModel; AddressTableModel *addressTableModel; TransactionTableModel *transactionTableModel; -- cgit v1.2.3 From ef079e183bf1be9f5a61a05018ee4480db86bc45 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 30 Jun 2011 18:05:29 +0200 Subject: Split off WalletModel from ClientModel, to be able to support multi-wallets in future --- src/qt/clientmodel.h | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 9c23a14a0a..a5028ff3b8 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -8,52 +8,35 @@ class AddressTableModel; class TransactionTableModel; class CWallet; +// Interface to Bitcoin network client class ClientModel : public QObject { Q_OBJECT public: + // The only reason that this constructor takes a wallet is because + // the global client settings are stored in the main wallet. explicit ClientModel(CWallet *wallet, QObject *parent = 0); - enum StatusCode - { - OK, - InvalidAmount, - InvalidAddress, - AmountExceedsBalance, - AmountWithFeeExceedsBalance, - Aborted, - MiscError - }; - OptionsModel *getOptionsModel(); - AddressTableModel *getAddressTableModel(); - TransactionTableModel *getTransactionTableModel(); - qint64 getBalance() const; int getNumConnections() const; int getNumBlocks() const; - int getNumTransactions() const; - /* Return true if core is doing initial block download */ + // Return true if core is doing initial block download bool inInitialBlockDownload() const; - /* Return conservative estimate of total number of blocks, or 0 if unknown */ + // Return conservative estimate of total number of blocks, or 0 if unknown int getTotalBlocksEstimate() const; - /* Send coins */ - StatusCode sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs=QString()); private: CWallet *wallet; OptionsModel *optionsModel; - AddressTableModel *addressTableModel; - TransactionTableModel *transactionTableModel; signals: - void balanceChanged(qint64 balance); void numConnectionsChanged(int count); void numBlocksChanged(int count); - void numTransactionsChanged(int count); - /* Asynchronous error notification */ + + // Asynchronous error notification void error(const QString &title, const QString &message); public slots: -- cgit v1.2.3 From d56c6f312c7784e30794ff71eb0b0ec94cdf15ef Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 30 Jun 2011 19:14:42 +0200 Subject: Make it very clear when on testnet (green icon, add [testnet] to title) --- src/qt/clientmodel.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index a5028ff3b8..18b3ba11e1 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -22,6 +22,8 @@ public: int getNumConnections() const; int getNumBlocks() const; + // Return true if client connected to testnet + bool isTestNet() const; // Return true if core is doing initial block download bool inInitialBlockDownload() const; // Return conservative estimate of total number of blocks, or 0 if unknown -- cgit v1.2.3 From 0052fe7bbc2a4c244786e3a496263c045fb185c5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 1 Jul 2011 17:06:36 +0200 Subject: General cleanups --- src/qt/clientmodel.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 18b3ba11e1..659fa65762 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -29,6 +29,8 @@ public: // Return conservative estimate of total number of blocks, or 0 if unknown int getTotalBlocksEstimate() const; + QString formatFullVersion() const; + private: CWallet *wallet; -- cgit v1.2.3 From 84c8506e90c01b4ba38c19064389d8549593be2f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 8 Jul 2011 18:05:10 +0200 Subject: Display a "freshness" indicator instead of nr of blocks --- src/qt/clientmodel.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 659fa65762..6c2c275cef 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -8,6 +8,10 @@ class AddressTableModel; class TransactionTableModel; class CWallet; +QT_BEGIN_NAMESPACE +class QDateTime; +QT_END_NAMESPACE + // Interface to Bitcoin network client class ClientModel : public QObject { @@ -22,6 +26,8 @@ public: int getNumConnections() const; int getNumBlocks() const; + QDateTime getLastBlockDate() const; + // Return true if client connected to testnet bool isTestNet() const; // Return true if core is doing initial block download -- cgit v1.2.3 From 5df0b03c950184b2e2fdbfc6e9f8075dcf81c75c Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 17 Jul 2011 14:06:43 +0200 Subject: make initial block download reporting somewhat better by tracking version responses --- src/qt/clientmodel.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 6c2c275cef..f7ad14c28b 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -42,6 +42,9 @@ private: OptionsModel *optionsModel; + int cachedNumConnections; + int cachedNumBlocks; + signals: void numConnectionsChanged(int count); void numBlocksChanged(int count); -- cgit v1.2.3 From ee014e5b10f5f65820ff056311051ff49813b294 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 29 Jul 2011 14:36:35 +0200 Subject: Full support for other units, add configuration option for default unit (used when displaying amounts) --- src/qt/clientmodel.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index f7ad14c28b..544334e47a 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -19,7 +19,7 @@ class ClientModel : public QObject public: // The only reason that this constructor takes a wallet is because // the global client settings are stored in the main wallet. - explicit ClientModel(CWallet *wallet, QObject *parent = 0); + explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0); OptionsModel *getOptionsModel(); @@ -38,8 +38,6 @@ public: QString formatFullVersion() const; private: - CWallet *wallet; - OptionsModel *optionsModel; int cachedNumConnections; -- cgit v1.2.3 From 3b59297b36f795e7cdaaab74daefa89cee6dd24d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 29 Jul 2011 16:16:12 +0200 Subject: Remove no longer valid comment --- src/qt/clientmodel.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 544334e47a..845ad10dec 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -17,8 +17,6 @@ class ClientModel : public QObject { Q_OBJECT public: - // The only reason that this constructor takes a wallet is because - // the global client settings are stored in the main wallet. explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0); OptionsModel *getOptionsModel(); -- cgit v1.2.3 From b0849613bf02b61774b23804c8feed54aa88474a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 8 Aug 2011 17:38:17 +0200 Subject: QtUI code cleanup / comment improvements --- src/qt/clientmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 845ad10dec..15387056c8 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -12,7 +12,7 @@ QT_BEGIN_NAMESPACE class QDateTime; QT_END_NAMESPACE -// Interface to Bitcoin network client +// Model for Bitcoin network client class ClientModel : public QObject { Q_OBJECT -- cgit v1.2.3 From 78b3bf56f7804f3eb1b7cf8b189c5d567be7ca60 Mon Sep 17 00:00:00 2001 From: Janne Pulkkinen Date: Sat, 10 Sep 2011 12:43:45 +0300 Subject: The synchronization progress bar now compares the amount of total blocks to amount of blocks downloaded at application start-up. Could be probably implemented better. --- src/qt/clientmodel.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 15387056c8..8605fb93ab 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -23,6 +23,7 @@ public: int getNumConnections() const; int getNumBlocks() const; + int getNumBlocksAtStartup(); QDateTime getLastBlockDate() const; @@ -41,6 +42,8 @@ private: int cachedNumConnections; int cachedNumBlocks; + int numBlocksAtStartup; + signals: void numConnectionsChanged(int count); void numBlocksChanged(int count); -- cgit v1.2.3 From d33cc2b5e3779033502fedc3f17aeffb4fa8e01c Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 11 Sep 2011 10:49:30 +0200 Subject: clarify function signature (GetNumBlocksOfPeers) and use number of 'frozen' blocks as initial value for number of peer blocks --- src/qt/clientmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qt/clientmodel.h') diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 8605fb93ab..c68fb0f035 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -32,7 +32,7 @@ public: // Return true if core is doing initial block download bool inInitialBlockDownload() const; // Return conservative estimate of total number of blocks, or 0 if unknown - int getTotalBlocksEstimate() const; + int getNumBlocksOfPeers() const; QString formatFullVersion() const; -- cgit v1.2.3