extra debug logging

This commit is contained in:
Ilya Kitaev 2016-08-23 10:32:01 +03:00
parent 8d93f01db4
commit 6b9afcf291
3 changed files with 24 additions and 9 deletions

View file

@ -111,5 +111,7 @@ int main(int argc, char *argv[])
QObject::connect(eventFilter, SIGNAL(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant)));
QObject::connect(eventFilter, SIGNAL(mouseReleased(QVariant,QVariant,QVariant)), rootObject, SLOT(mouseReleased(QVariant,QVariant,QVariant)));
WalletManager::instance()->setLogLevel(WalletManager::LogLevel_Max);
return app.exec();
}

View file

@ -8,14 +8,9 @@
#include <QUrl>
#include <QtConcurrent/QtConcurrent>
WalletManager * WalletManager::m_instance = nullptr;
WalletManager *WalletManager::instance()
{
if (!m_instance) {
@ -36,9 +31,11 @@ Wallet *WalletManager::createWallet(const QString &path, const QString &password
Wallet *WalletManager::openWallet(const QString &path, const QString &password, bool testnet)
{
// TODO: call the libwallet api here;
qDebug("%s: opening wallet at %s, testnet = %d ",
__PRETTY_FUNCTION__, qPrintable(path), testnet);
Bitmonero::Wallet * w = m_pimpl->openWallet(path.toStdString(), password.toStdString(), testnet);
qDebug("%s: opened wallet: %s, status: %d", __PRETTY_FUNCTION__, w->address().c_str(), w->status());
Wallet * wallet = new Wallet(w);
// move wallet to the GUI thread. Otherwise it wont be emitting signals
@ -46,7 +43,6 @@ Wallet *WalletManager::openWallet(const QString &path, const QString &password,
wallet->moveToThread(qApp->thread());
}
return wallet;
}
@ -141,9 +137,12 @@ quint64 WalletManager::amountFromDouble(double amount)
return Bitmonero::Wallet::amountFromDouble(amount);
}
void WalletManager::setLogLevel(int logLevel)
{
Bitmonero::WalletManagerFactory::setLogLevel(logLevel);
}
WalletManager::WalletManager(QObject *parent) : QObject(parent)
{
m_pimpl = Bitmonero::WalletManagerFactory::getWalletManager();
}

View file

@ -2,6 +2,7 @@
#define WALLETMANAGER_H
#include <QObject>
#include <wallet/wallet2_api.h>
class Wallet;
namespace Bitmonero {
@ -12,6 +13,17 @@ class WalletManager : public QObject
{
Q_OBJECT
public:
enum LogLevel {
LogLevel_Silent = Bitmonero::WalletManagerFactory::LogLevel_Silent,
LogLevel_0 = Bitmonero::WalletManagerFactory::LogLevel_0,
LogLevel_1 = Bitmonero::WalletManagerFactory::LogLevel_1,
LogLevel_2 = Bitmonero::WalletManagerFactory::LogLevel_2,
LogLevel_3 = Bitmonero::WalletManagerFactory::LogLevel_3,
LogLevel_4 = Bitmonero::WalletManagerFactory::LogLevel_4,
LogLevel_Min = Bitmonero::WalletManagerFactory::LogLevel_Min,
LogLevel_Max = Bitmonero::WalletManagerFactory::LogLevel_Max,
};
static WalletManager * instance();
// wizard: createWallet path;
Q_INVOKABLE Wallet * createWallet(const QString &path, const QString &password,
@ -71,6 +83,8 @@ public:
Q_INVOKABLE quint64 amountFromString(const QString &amount);
Q_INVOKABLE quint64 amountFromDouble(double amount);
void setLogLevel(int logLevel);
signals:
void walletOpened(Wallet * wallet);