On initial block chain download, show a progress bar
[novacoin.git] / src / qt / clientmodel.h
1 #ifndef CLIENTMODEL_H
2 #define CLIENTMODEL_H
3
4 #include <QObject>
5
6 class OptionsModel;
7 class AddressTableModel;
8 class TransactionTableModel;
9
10 class ClientModel : public QObject
11 {
12     Q_OBJECT
13 public:
14     explicit ClientModel(QObject *parent = 0);
15
16     enum StatusCode
17     {
18         OK,
19         InvalidAmount,
20         InvalidAddress,
21         AmountExceedsBalance,
22         AmountWithFeeExceedsBalance,
23         Aborted,
24         MiscError
25     };
26
27     OptionsModel *getOptionsModel();
28     AddressTableModel *getAddressTableModel();
29     TransactionTableModel *getTransactionTableModel();
30
31     qint64 getBalance() const;
32     QString getAddress() const;
33     int getNumConnections() const;
34     int getNumBlocks() const;
35     int getNumTransactions() const;
36
37     /* Return true if core is doing initial block download */
38     bool inInitialBlockDownload() const;
39     /* Return conservative estimate of total number of blocks, or 0 if unknown */
40     int getTotalBlocksEstimate() const;
41
42     /* Set default address */
43     void setAddress(const QString &defaultAddress);
44     /* Send coins */
45     StatusCode sendCoins(const QString &payTo, qint64 payAmount);
46 private:
47     OptionsModel *optionsModel;
48     AddressTableModel *addressTableModel;
49     TransactionTableModel *transactionTableModel;
50
51 signals:
52     void balanceChanged(qint64 balance);
53     void addressChanged(const QString &address);
54     void numConnectionsChanged(int count);
55     void numBlocksChanged(int count);
56     void numTransactionsChanged(int count);
57     /* Asynchronous error notification */
58     void error(const QString &title, const QString &message);
59
60 public slots:
61
62 private slots:
63     void update();
64 };
65
66 #endif // CLIENTMODEL_H