2015-04-29 17:03:08 +00:00
|
|
|
// 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>
|
2015-09-18 12:37:30 +00:00
|
|
|
#include <IWalletLegacy.h>
|
2015-04-29 17:03:08 +00:00
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
#include "CryptoNoteWrapper.h"
|
2015-04-29 17:03:08 +00:00
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
namespace CryptoNote {
|
2015-04-29 17:03:08 +00:00
|
|
|
|
|
|
|
class Currency;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
namespace Logging {
|
|
|
|
class LoggerManager;
|
|
|
|
}
|
|
|
|
|
2015-04-29 17:03:08 +00:00
|
|
|
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;
|
2015-09-18 12:37:30 +00:00
|
|
|
CryptoNote::IWalletLegacy* createWallet() const;
|
2015-04-29 17:03:08 +00:00
|
|
|
|
|
|
|
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();
|
2015-09-18 12:37:30 +00:00
|
|
|
CryptoNote::CoreConfig makeCoreConfig() const;
|
|
|
|
CryptoNote::NetNodeConfig makeNetNodeConfig() const;
|
2015-04-29 17:03:08 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void localBlockchainUpdatedSignal(quint64 _height);
|
|
|
|
void lastKnownBlockHeightUpdatedSignal(quint64 _height);
|
|
|
|
void nodeInitCompletedSignal();
|
|
|
|
void peerCountUpdatedSignal(quintptr _count);
|
2015-09-18 12:37:30 +00:00
|
|
|
void initNodeSignal(Node** _node, const CryptoNote::Currency* currency, INodeCallback* _callback, Logging::LoggerManager* _loggerManager,
|
|
|
|
const CryptoNote::CoreConfig& _coreConfig, const CryptoNote::NetNodeConfig& _netNodeConfig);
|
2015-04-29 17:03:08 +00:00
|
|
|
void deinitNodeSignal(Node** _node);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|