forked from cryptonotefoundation/cryptonotewallet
/
NodeAdapter.h
66 lines (48 loc) · 1.75 KB
/
NodeAdapter.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2011-2015 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include <QObject>
#include <QThread>
#include <INode.h>
#include <IWallet.h>
#include "CryptoNote.h"
namespace cryptonote {
class Currency;
}
namespace WalletGui {
class InProcessNodeInitializer;
class NodeAdapter : public QObject, public INodeCallback {
Q_OBJECT
Q_DISABLE_COPY(NodeAdapter)
public:
static NodeAdapter& instance();
quintptr getPeerCount() const;
std::string convertPaymentId(const QString& _payment_id_string) const;
QString extractPaymentId(const std::string& _extra) const;
CryptoNote::IWallet* createWallet() const;
bool init();
void deinit();
quint64 getLastKnownBlockHeight() const;
quint64 getLastLocalBlockHeight() const;
QDateTime getLastLocalBlockTimestamp() const;
void peerCountUpdated(Node& _node, size_t _count) Q_DECL_OVERRIDE;
void localBlockchainUpdated(Node& _node, uint64_t _height) Q_DECL_OVERRIDE;
void lastKnownBlockHeightUpdated(Node& _node, uint64_t _height) Q_DECL_OVERRIDE;
private:
Node* m_node;
QThread m_nodeInitializerThread;
InProcessNodeInitializer* m_nodeInitializer;
NodeAdapter();
~NodeAdapter();
bool initInProcessNode();
cryptonote::CoreConfig makeCoreConfig() const;
Q_SIGNALS:
void localBlockchainUpdatedSignal(quint64 _height);
void lastKnownBlockHeightUpdatedSignal(quint64 _height);
void nodeInitCompletedSignal();
void peerCountUpdatedSignal(quintptr _count);
void initNodeSignal(Node** _node, const cryptonote::Currency* currency, INodeCallback* _callback, const cryptonote::CoreConfig& _core_config);
void deinitNodeSignal(Node** _node);
};
}