forked from bitcoin-core/gui-qml
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnodemodel.h
52 lines (37 loc) · 1.25 KB
/
nodemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QML_NODEMODEL_H
#define BITCOIN_QML_NODEMODEL_H
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <memory>
#include <QObject>
namespace interfaces {
class Node;
}
/** Model for Bitcoin network client. */
class NodeModel : public QObject
{
Q_OBJECT
Q_PROPERTY(int blockTipHeight READ blockTipHeight NOTIFY blockTipHeightChanged)
public:
explicit NodeModel(interfaces::Node& node);
int blockTipHeight() const { return m_block_tip_height; }
void setBlockTipHeight(int new_height);
Q_INVOKABLE void startNodeInitializionThread();
void startNodeShutdown();
public Q_SLOTS:
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info);
Q_SIGNALS:
void blockTipHeightChanged();
void requestedInitialize();
void requestedShutdown();
private:
// Properties that are exposed to QML.
int m_block_tip_height{0};
interfaces::Node& m_node;
std::unique_ptr<interfaces::Handler> m_handler_notify_block_tip;
void ConnectToBlockTipSignal();
};
#endif // BITCOIN_QML_NODEMODEL_H