Skip to content

Commit 0e193de

Browse files
committed
refactor, qt: Use std::chrono for non-zero arguments in QTimer methods
1 parent 6f0da95 commit 0e193de

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

src/qt/bitcoin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#endif // ENABLE_WALLET
4242

4343
#include <boost/signals2/connection.hpp>
44+
#include <chrono>
4445
#include <memory>
4546

4647
#include <QApplication>
@@ -410,10 +411,10 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
410411
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
411412
window->message(title, message, style);
412413
});
413-
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
414+
QTimer::singleShot(100ms, paymentServer, &PaymentServer::uiReady);
414415
}
415416
#endif
416-
pollShutdownTimer->start(200);
417+
pollShutdownTimer->start(200ms);
417418
} else {
418419
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
419420
requestShutdown();

src/qt/optionsdialog.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <netbase.h>
2020
#include <txdb.h> // for -dbcache defaults
2121

22+
#include <chrono>
23+
2224
#include <QDataWidgetMapper>
2325
#include <QDir>
2426
#include <QIntValidator>
@@ -362,7 +364,7 @@ void OptionsDialog::showRestartWarning(bool fPersistent)
362364
ui->statusLabel->setText(tr("This change would require a client restart."));
363365
// clear non-persistent status label after 10 seconds
364366
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
365-
QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel);
367+
QTimer::singleShot(10s, this, &OptionsDialog::clearStatusLabel);
366368
}
367369
}
368370

src/qt/sendcoinsdialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
#include <node/ui_interface.h>
2525
#include <policy/fees.h>
2626
#include <txmempool.h>
27+
#include <validation.h>
2728
#include <wallet/coincontrol.h>
2829
#include <wallet/fees.h>
2930
#include <wallet/wallet.h>
3031

31-
#include <validation.h>
32+
#include <chrono>
3233

3334
#include <QFontMetrics>
3435
#include <QScrollBar>
@@ -1060,7 +1061,7 @@ SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QStri
10601061
int SendConfirmationDialog::exec()
10611062
{
10621063
updateButtons();
1063-
countDownTimer.start(1000);
1064+
countDownTimer.start(1s);
10641065
return QMessageBox::exec();
10651066
}
10661067

src/qt/walletcontroller.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <wallet/wallet.h>
2121

2222
#include <algorithm>
23+
#include <chrono>
2324

2425
#include <QApplication>
2526
#include <QMessageBox>
@@ -254,12 +255,12 @@ void CreateWalletActivity::createWallet()
254255
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
255256
}
256257

257-
QTimer::singleShot(500, worker(), [this, name, flags] {
258+
QTimer::singleShot(500ms, worker(), [this, name, flags] {
258259
std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
259260

260261
if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
261262

262-
QTimer::singleShot(500, this, &CreateWalletActivity::finish);
263+
QTimer::singleShot(500ms, this, &CreateWalletActivity::finish);
263264
});
264265
}
265266

0 commit comments

Comments
 (0)