refactor, qt: Use std::chrono for non-zero arguments in QTimer methods

This commit is contained in:
Hennadii Stepanov 2022-01-06 18:35:53 +02:00
parent 6f0da95811
commit 0e193deb52
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
4 changed files with 12 additions and 7 deletions

View file

@ -41,6 +41,7 @@
#endif // ENABLE_WALLET
#include <boost/signals2/connection.hpp>
#include <chrono>
#include <memory>
#include <QApplication>
@ -410,10 +411,10 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
window->message(title, message, style);
});
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
QTimer::singleShot(100ms, paymentServer, &PaymentServer::uiReady);
}
#endif
pollShutdownTimer->start(200);
pollShutdownTimer->start(200ms);
} else {
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
requestShutdown();

View file

@ -19,6 +19,8 @@
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
#include <chrono>
#include <QDataWidgetMapper>
#include <QDir>
#include <QIntValidator>
@ -362,7 +364,7 @@ void OptionsDialog::showRestartWarning(bool fPersistent)
ui->statusLabel->setText(tr("This change would require a client restart."));
// clear non-persistent status label after 10 seconds
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel);
QTimer::singleShot(10s, this, &OptionsDialog::clearStatusLabel);
}
}

View file

@ -24,11 +24,12 @@
#include <node/ui_interface.h>
#include <policy/fees.h>
#include <txmempool.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <wallet/wallet.h>
#include <validation.h>
#include <chrono>
#include <QFontMetrics>
#include <QScrollBar>
@ -1060,7 +1061,7 @@ SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QStri
int SendConfirmationDialog::exec()
{
updateButtons();
countDownTimer.start(1000);
countDownTimer.start(1s);
return QMessageBox::exec();
}

View file

@ -20,6 +20,7 @@
#include <wallet/wallet.h>
#include <algorithm>
#include <chrono>
#include <QApplication>
#include <QMessageBox>
@ -254,12 +255,12 @@ void CreateWalletActivity::createWallet()
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
}
QTimer::singleShot(500, worker(), [this, name, flags] {
QTimer::singleShot(500ms, worker(), [this, name, flags] {
std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
QTimer::singleShot(500, this, &CreateWalletActivity::finish);
QTimer::singleShot(500ms, this, &CreateWalletActivity::finish);
});
}