f5f12fcfd908ae9b6c5a416859585e2249e7ebee
[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
40     /* Set default address */
41     void setAddress(const QString &defaultAddress);
42     /* Send coins */
43     StatusCode sendCoins(const QString &payTo, qint64 payAmount);
44 private:
45     OptionsModel *optionsModel;
46     AddressTableModel *addressTableModel;
47     TransactionTableModel *transactionTableModel;
48
49 signals:
50     void balanceChanged(qint64 balance);
51     void addressChanged(const QString &address);
52     void numConnectionsChanged(int count);
53     void numBlocksChanged(int count);
54     void numTransactionsChanged(int count);
55     /* Asynchronous error notification */
56     void error(const QString &title, const QString &message);
57
58 public slots:
59
60 private slots:
61     void update();
62 };
63
64 #endif // CLIENTMODEL_H