From c85388815bc6b10df6077c00ce0b5549c550ffbb Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 4 Mar 2018 18:12:44 +0000 Subject: [PATCH] WalletManager: add logging API from QML requires #3345 --- main.cpp | 2 +- src/libwalletqt/WalletManager.cpp | 20 ++++++++++++++++++++ src/libwalletqt/WalletManager.h | 5 +++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 08bcb9e3..c068990a 100644 --- a/main.cpp +++ b/main.cpp @@ -67,7 +67,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { // Send all message types to logger - Monero::Wallet::debug(msg.toStdString()); + Monero::Wallet::debug("qml", msg.toStdString()); } int main(int argc, char *argv[]) diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 73b0a006..133853ae 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -372,6 +372,26 @@ bool WalletManager::clearWalletCache(const QString &wallet_path) const return walletCache.rename(newFileName); } +void WalletManager::debug(const QString &s) +{ + Monero::Wallet::debug("qml", s.toStdString()); +} + +void WalletManager::info(const QString &s) +{ + Monero::Wallet::info("qml", s.toStdString()); +} + +void WalletManager::warning(const QString &s) +{ + Monero::Wallet::warning("qml", s.toStdString()); +} + +void WalletManager::error(const QString &s) +{ + Monero::Wallet::error("qml", s.toStdString()); +} + WalletManager::WalletManager(QObject *parent) : QObject(parent) { m_pimpl = Monero::WalletManagerFactory::getWalletManager(); diff --git a/src/libwalletqt/WalletManager.h b/src/libwalletqt/WalletManager.h index 90c56152..006b790e 100644 --- a/src/libwalletqt/WalletManager.h +++ b/src/libwalletqt/WalletManager.h @@ -141,6 +141,11 @@ public: // clear/rename wallet cache Q_INVOKABLE bool clearWalletCache(const QString &fileName) const; + Q_INVOKABLE void debug(const QString &s); + Q_INVOKABLE void info(const QString &s); + Q_INVOKABLE void warning(const QString &s); + Q_INVOKABLE void error(const QString &s); + signals: void walletOpened(Wallet * wallet);