update core to d0d80170a2ca73004e08fb85007fe055cbf4e411 (CWallet class)
[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 class CWallet;
10
11 class ClientModel : public QObject
12 {
13     Q_OBJECT
14 public:
15     explicit ClientModel(CWallet *wallet, QObject *parent = 0);
16
17     enum StatusCode
18     {
19         OK,
20         InvalidAmount,
21         InvalidAddress,
22         AmountExceedsBalance,
23         AmountWithFeeExceedsBalance,
24         Aborted,
25         MiscError
26     };
27
28     OptionsModel *getOptionsModel();
29     AddressTableModel *getAddressTableModel();
30     TransactionTableModel *getTransactionTableModel();
31
32     qint64 getBalance() 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     /* Send coins */
43     StatusCode sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs=QString());
44 private:
45     CWallet *wallet;
46
47     OptionsModel *optionsModel;
48     AddressTableModel *addressTableModel;
49     TransactionTableModel *transactionTableModel;
50
51 signals:
52     void balanceChanged(qint64 balance);
53     void numConnectionsChanged(int count);
54     void numBlocksChanged(int count);
55     void numTransactionsChanged(int count);
56     /* Asynchronous error notification */
57     void error(const QString &title, const QString &message);
58
59 public slots:
60
61 private slots:
62     void update();
63 };
64
65 #endif // CLIENTMODEL_H