allow adding address to address book in send dialog
[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     int getNumConnections() const;
33     int getNumBlocks() const;
34     int getNumTransactions() const;
35
36     /* Return true if core is doing initial block download */
37     bool inInitialBlockDownload() const;
38     /* Return conservative estimate of total number of blocks, or 0 if unknown */
39     int getTotalBlocksEstimate() const;
40
41     /* Send coins */
42     StatusCode sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs=QString());
43 private:
44     OptionsModel *optionsModel;
45     AddressTableModel *addressTableModel;
46     TransactionTableModel *transactionTableModel;
47
48 signals:
49     void balanceChanged(qint64 balance);
50     void numConnectionsChanged(int count);
51     void numBlocksChanged(int count);
52     void numTransactionsChanged(int count);
53     /* Asynchronous error notification */
54     void error(const QString &title, const QString &message);
55
56 public slots:
57
58 private slots:
59     void update();
60 };
61
62 #endif // CLIENTMODEL_H