diff options
| author | Jaquee <jaquee.monero@gmail.com> | 2017-08-06 00:10:59 +0200 |
|---|---|---|
| committer | Jaquee <jaquee.monero@gmail.com> | 2017-08-06 00:10:59 +0200 |
| commit | 3f7e3ba3c40fb789af675e7754b09cb2dac336b2 (patch) | |
| tree | 624e741b2c575f2ba82d49f187b188ad0e777fd3 /src/libwalletqt/WalletManager.cpp | |
| parent | c68c31777693ae75b59c0d24c44195a97bbf0c1c (diff) | |
| download | monzero-gui-3f7e3ba3c40fb789af675e7754b09cb2dac336b2.tar.gz monzero-gui-3f7e3ba3c40fb789af675e7754b09cb2dac336b2.tar.xz monzero-gui-3f7e3ba3c40fb789af675e7754b09cb2dac336b2.zip | |
check updates async
Diffstat (limited to 'src/libwalletqt/WalletManager.cpp')
| -rw-r--r-- | src/libwalletqt/WalletManager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 300b3699..396274c6 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -331,8 +331,26 @@ bool WalletManager::saveQrCode(const QString &code, const QString &path) const return QRCodeImageProvider::genQrImage(code, &size).scaled(size.expandedTo(QSize(240, 240)), Qt::KeepAspectRatio).save(path, "PNG", 100); } +void WalletManager::checkUpdatesAsync(const QString &software, const QString &subdir) const +{ + QFuture<QString> future = QtConcurrent::run(this, &WalletManager::checkUpdates, + software, subdir); + QFutureWatcher<QString> * watcher = new QFutureWatcher<QString>(); + connect(watcher, &QFutureWatcher<Wallet*>::finished, + this, [this, watcher]() { + QFuture<QString> future = watcher->future(); + watcher->deleteLater(); + qDebug() << "Checking for updates - done"; + emit checkUpdatesComplete(future.result()); + }); + watcher->setFuture(future); +} + + + QString WalletManager::checkUpdates(const QString &software, const QString &subdir) const { + qDebug() << "Checking for updates"; const std::tuple<bool, std::string, std::string, std::string, std::string> result = Monero::WalletManager::checkUpdates(software.toStdString(), subdir.toStdString()); if (!std::get<0>(result)) return QString(""); |
