libwalletqt: add a few daemon read access routines

This commit is contained in:
moneromooo.monero 2016-11-24 11:14:46 +00:00
parent af4e49cd0f
commit 87d07515a8
3 changed files with 40 additions and 0 deletions

View file

@ -176,6 +176,8 @@ ApplicationWindow {
}
walletManager.setDaemonAddress(persistentSettings.daemon_address)
// wallet already opened with wizard, we just need to initialize it
if (typeof wizard.settings['wallet'] !== 'undefined') {
console.log("using wizard wallet")

View file

@ -174,6 +174,36 @@ QString WalletManager::checkPayment(const QString &address, const QString &txid,
return QString::fromStdString(result);
}
void WalletManager::setDaemonAddress(const QString &address)
{
m_pimpl->setDaemonAddress(address.toStdString());
}
bool WalletManager::connected() const
{
return m_pimpl->connected();
}
quint64 WalletManager::networkDifficulty() const
{
return m_pimpl->networkDifficulty();
}
quint64 WalletManager::blockchainHeight() const
{
return m_pimpl->blockchainHeight();
}
quint64 WalletManager::blockchainTargetHeight() const
{
return m_pimpl->blockchainTargetHeight();
}
double WalletManager::miningHashRate() const
{
return m_pimpl->miningHashRate();
}
void WalletManager::setLogLevel(int logLevel)
{
Bitmonero::WalletManagerFactory::setLogLevel(logLevel);

View file

@ -13,6 +13,7 @@ namespace Bitmonero {
class WalletManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool connected READ connected)
public:
enum LogLevel {
@ -95,6 +96,13 @@ public:
Q_INVOKABLE QString checkPayment(const QString &address, const QString &txid, const QString &txkey, const QString &daemon_address) const;
Q_INVOKABLE void setDaemonAddress(const QString &address);
Q_INVOKABLE bool connected() const;
Q_INVOKABLE quint64 networkDifficulty() const;
Q_INVOKABLE quint64 blockchainHeight() const;
Q_INVOKABLE quint64 blockchainTargetHeight() const;
Q_INVOKABLE double miningHashRate() const;
// QML missing such functionality, implementing these helpers here
Q_INVOKABLE QString urlToLocalPath(const QUrl &url) const;
Q_INVOKABLE QUrl localPathToUrl(const QString &path) const;