67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
// 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);
|
|
};
|
|
|
|
}
|