diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 6177896a45..34c2d80330 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -52,8 +52,8 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break; case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break; } - connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept())); - connect(ui->tableViewPcodes, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept())); + connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept); + connect(ui->tableViewPcodes, &QTableView::doubleClicked, this, &QDialog::accept); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setFocus(); ui->closeButton->setText(tr("C&hoose")); @@ -72,8 +72,8 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, case SendingTab: ui->labelExplanation->setText(tr("These are your Firo addresses for sending payments. Always check the amount and the receiving address before sending coins.")); ui->deleteAddress->setVisible(true); - connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(selectionChanged())); - connect(ui->tableViewPcodes, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &AddressBookPage::selectionChanged); + connect(ui->tableViewPcodes, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu); break; case ReceivingTab: ui->labelExplanation->setText(tr("These are your Firo addresses for receiving payments. It is recommended to use a new receiving address for each transaction.")); @@ -99,14 +99,14 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, contextMenu->addSeparator(); // Connect signals for context menu actions - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction())); - connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction())); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked())); + connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyAddress_clicked); + connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction); + connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction); + connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked); - connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); + connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu); - connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept())); + connect(ui->closeButton, &QPushButton::clicked, this, &QDialog::accept); } AddressBookPage::~AddressBookPage() @@ -145,8 +145,7 @@ void AddressBookPage::setModel(AddressTableModel *_model) proxyModelPcode->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->tableViewPcodes->setModel(proxyModelPcode); ui->tableViewPcodes->sortByColumn(0, Qt::AscendingOrder); - connect(ui->tableViewPcodes->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged())); + connect(ui->tableViewPcodes->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AddressBookPage::selectionChanged); #if QT_VERSION < 0x050000 ui->tableViewPcodes->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch); @@ -169,11 +168,10 @@ void AddressBookPage::setModel(AddressTableModel *_model) ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents); #endif - connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged())); + connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AddressBookPage::selectionChanged); // Select row for newly created address - connect(_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(selectNewAddress(QModelIndex,int,int))); + connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress); selectionChanged(); } diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index 457c3db820..eb8c79aa74 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -72,9 +72,9 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, const QStr } textChanged(); adjustSize(); - connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); + connect(ui->passEdit1, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->passEdit2, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->passEdit3, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); } AskPassphraseDialog::~AskPassphraseDialog() diff --git a/src/qt/automintmodel.cpp b/src/qt/automintmodel.cpp index 75c9d1ac61..14aa84a77f 100644 --- a/src/qt/automintmodel.cpp +++ b/src/qt/automintmodel.cpp @@ -18,11 +18,7 @@ IncomingFundNotifier::IncomingFundNotifier( timer = new QTimer(this); timer->setSingleShot(true); - connect(timer, - SIGNAL(timeout()), - this, - SLOT(check()), - Qt::QueuedConnection); + connect(timer, &QTimer::timeout, this, &IncomingFundNotifier::check, Qt::QueuedConnection); importTransactions(); subscribeToCoreSignals(); @@ -187,13 +183,13 @@ AutoMintModel::AutoMintModel( autoMintCheckTimer = new QTimer(this); autoMintCheckTimer->setSingleShot(false); - connect(autoMintCheckTimer, SIGNAL(timeout()), this, SLOT(checkAutoMint())); + connect(autoMintCheckTimer, &QTimer::timeout, [this]{ checkAutoMint(); }); notifier = new IncomingFundNotifier(wallet, this); - connect(notifier, SIGNAL(matureFund(CAmount)), this, SLOT(startAutoMint())); + connect(notifier, &IncomingFundNotifier::matureFund, this, &AutoMintModel::startAutoMint); - connect(optionsModel, SIGNAL(autoAnonymizeChanged(bool)), this, SLOT(updateAutoMintOption(bool))); + connect(optionsModel, &OptionsModel::autoAnonymizeChanged, this, &AutoMintModel::updateAutoMintOption); } AutoMintModel::~AutoMintModel() diff --git a/src/qt/automintnotification.cpp b/src/qt/automintnotification.cpp index 3dd7277ccf..8db5469436 100644 --- a/src/qt/automintnotification.cpp +++ b/src/qt/automintnotification.cpp @@ -36,8 +36,7 @@ void AutomintNotification::setModel(WalletModel *model) return; } - connect(this, SIGNAL(ackMintAll(AutoMintAck, CAmount, QString)), - automintModel, SLOT(ackMintAll(AutoMintAck, CAmount, QString))); + connect(this, &AutomintNotification::ackMintAll, automintModel, &AutoMintModel::ackMintAll); } } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 2e1b3cd79e..cbea7f2b5b 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -387,7 +387,7 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle) window = new BitcoinGUI(platformStyle, networkStyle, 0); pollShutdownTimer = new QTimer(window); - connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown())); + connect(pollShutdownTimer, &QTimer::timeout, window, &BitcoinGUI::detectShutdown); pollShutdownTimer->start(200); } @@ -397,8 +397,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle) // We don't hold a direct pointer to the splash screen after creation, but the splash // screen will take care of deleting itself when slotFinish happens. splash->show(); - connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*))); - connect(this, SIGNAL(requestedShutdown()), splash, SLOT(close())); + connect(this, &BitcoinApplication::splashFinished, splash, &SplashScreen::slotFinish); + connect(this, &BitcoinApplication::requestedShutdown, splash, &QWidget::close); } void BitcoinApplication::startThread() @@ -410,14 +410,14 @@ void BitcoinApplication::startThread() executor->moveToThread(coreThread); /* communication to and from thread */ - connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int))); - connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int))); - connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString))); - connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize())); - connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown())); + connect(executor, &BitcoinCore::initializeResult, this, &BitcoinApplication::initializeResult); + connect(executor, &BitcoinCore::shutdownResult, this, &BitcoinApplication::shutdownResult); + connect(executor, &BitcoinCore::runawayException, this, &BitcoinApplication::handleRunawayException); + connect(this, &BitcoinApplication::requestedInitialize, executor, &BitcoinCore::initialize); + connect(this, &BitcoinApplication::requestedShutdown, executor, &BitcoinCore::shutdown); /* make sure executor object is deleted in its own thread */ - connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater())); - connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit())); + connect(this, &BitcoinApplication::stopThread, executor, &QObject::deleteLater); + connect(this, &BitcoinApplication::stopThread, coreThread, &QThread::quit); coreThread->start(); } @@ -487,8 +487,7 @@ void BitcoinApplication::initializeResult(int retval) window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel); window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET); - connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)), - paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray))); + connect(walletModel, &WalletModel::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); #endif @@ -510,13 +509,12 @@ void BitcoinApplication::initializeResult(int retval) // Now that initialization/startup is done, process any command-line // firo: URIs or payment requests: - connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)), - window, SLOT(handlePaymentRequest(SendCoinsRecipient))); - connect(window, SIGNAL(receivedURI(QString)), - paymentServer, SLOT(handleURIOrFile(QString))); - connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)), - window, SLOT(message(QString,QString,unsigned int))); - QTimer::singleShot(100, paymentServer, SLOT(uiReady())); + connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest); + connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile); + 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); #endif } else { quit(); // Exit main loop diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 5774a0f5ed..bacbc5063f 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -29,7 +29,7 @@ class AmountSpinBox: public QAbstractSpinBox { setAlignment(Qt::AlignRight); - connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged())); + connect(lineEdit(), &QLineEdit::textEdited, this, &AmountSpinBox::valueChanged); } QValidator::State validate(QString &text, int &pos) const @@ -216,8 +216,8 @@ BitcoinAmountField::BitcoinAmountField(QWidget *parent) : setFocusProxy(amount); // If one if the widgets changes, the combined content changes as well - connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged())); - connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); + connect(amount, &AmountSpinBox::valueChanged, this, &BitcoinAmountField::valueChanged); + connect(unit, qOverload(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged); // Set default based on configuration unitChanged(unit->currentIndex()); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 99fa850b0a..faaef4463e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -289,14 +289,14 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * // Subscribe to notifications from core subscribeToCoreSignals(); - connect(connectionsControl, SIGNAL(clicked(QPoint)), this, SLOT(toggleNetworkActive())); + connect(connectionsControl, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::toggleNetworkActive); modalOverlay = new ModalOverlay(this->centralWidget()); #ifdef ENABLE_WALLET if(enableWallet) { - connect(walletFrame, SIGNAL(requestedSyncWarningInfo()), this, SLOT(showModalOverlay())); - connect(labelBlocksIcon, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay())); - connect(progressBar, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay())); + connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &BitcoinGUI::showModalOverlay); + connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay); + connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay); } #endif } @@ -417,29 +417,29 @@ void BitcoinGUI::createActions() tabGroup->addAction(createPcodeAction); #ifdef ENABLE_WALLET - connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage())); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); - connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); - connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); - connect(sigmaAction, SIGNAL(triggered()), this, SLOT(gotoSigmaPage())); - connect(lelantusAction, SIGNAL(triggered()), this, SLOT(gotoLelantusPage())); - connect(createPcodeAction, SIGNAL(triggered()), this, SLOT(gotoCreatePcodePage())); + connect(masternodeAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(masternodeAction, &QAction::triggered, this, &BitcoinGUI::gotoMasternodePage); + connect(overviewAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::gotoOverviewPage); + connect(sendCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(sendCoinsAction, &QAction::triggered, [this]{ gotoSendCoinsPage(); }); + connect(sendCoinsMenuAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(sendCoinsMenuAction, &QAction::triggered, [this]{ gotoSendCoinsPage(); }); + connect(receiveCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage); + connect(receiveCoinsMenuAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(receiveCoinsMenuAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage); + connect(historyAction, &QAction::triggered, this, [this]{ showNormalIfMinimized(); }); + connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage); + connect(sigmaAction, &QAction::triggered, this, &BitcoinGUI::gotoSigmaPage); + connect(lelantusAction, &QAction::triggered, this, &BitcoinGUI::gotoLelantusPage); + connect(createPcodeAction, &QAction::triggered, this, &BitcoinGUI::gotoCreatePcodePage); #ifdef ENABLE_ELYSIUM if (elysiumEnabled) { - connect(elyAssetsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(elyAssetsAction, SIGNAL(triggered()), this, SLOT(gotoElyAssetsPage())); - connect(toolboxAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(toolboxAction, SIGNAL(triggered()), this, SLOT(gotoToolboxPage())); + connect(elyAssetsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(elyAssetsAction, &QAction::triggered, this, &BitcoinGUI::gotoElyAssetsPage); + connect(toolboxAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(toolboxAction, &QAction::triggered, this, &BitcoinGUI::gotoToolboxPage); } #endif #endif // ENABLE_WALLET @@ -491,32 +491,32 @@ void BitcoinGUI::createActions() showHelpMessageAction->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Firo command-line options").arg(tr(PACKAGE_NAME))); - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); - connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); - connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); - connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); - connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked())); - connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow())); + connect(quitAction, &QAction::triggered, qApp, QApplication::quit); + connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked); + connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt); + connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked); + connect(toggleHideAction, &QAction::triggered, this, &BitcoinGUI::toggleHidden); + connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked); + connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow); // prevents an open debug window from becoming stuck/unusable on client shutdown - connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); + connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide); #ifdef ENABLE_WALLET if(walletFrame) { - connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); - connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); - connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); - connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); - connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); - connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); - connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); - connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); + connect(encryptWalletAction, &QAction::triggered, walletFrame, &WalletFrame::encryptWallet); + connect(backupWalletAction, &QAction::triggered, walletFrame, &WalletFrame::backupWallet); + connect(changePassphraseAction, &QAction::triggered, walletFrame, &WalletFrame::changePassphrase); + connect(signMessageAction, &QAction::triggered, [this]{ gotoSignMessageTab(); }); + connect(verifyMessageAction, &QAction::triggered, [this]{ gotoVerifyMessageTab(); }); + connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses); + connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses); + connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked); } #endif // ENABLE_WALLET - new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showDebugWindowActivateConsole())); - new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this, SLOT(showDebugWindow())); + connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), &QShortcut::activated, this, &BitcoinGUI::showDebugWindowActivateConsole); + connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this), &QShortcut::activated, this, &BitcoinGUI::showDebugWindow); } void BitcoinGUI::createMenuBar() @@ -611,29 +611,32 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) // Keep up to date with client updateNetworkState(); - connect(_clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - connect(_clientModel, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool))); + connect(_clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections); + connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive); modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime())); setNumBlocks(_clientModel->getNumBlocks(), _clientModel->getLastBlockDate(), _clientModel->getVerificationProgress(NULL), false); - connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool))); + connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks); - connect(clientModel, SIGNAL(additionalDataSyncProgressChanged(double)), this, SLOT(setAdditionalDataSyncProgress(double))); + connect(clientModel, &ClientModel::additionalDataSyncProgressChanged, this, &BitcoinGUI::setAdditionalDataSyncProgress); // Receive and report messages from client model - connect(_clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); + connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){ + this->message(title, message, style); + }); // Show progress dialog - connect(_clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int))); + connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress); // Update progress bar label textw - connect(_clientModel, SIGNAL(updateProgressBarLabel(QString)), this, SLOT(updateProgressBarLabel(QString))); - - // Update Elysium pending status - connect(_clientModel, SIGNAL(refreshElysiumPending(bool)), this, SLOT(setElysiumPendingStatus(bool))); + connect(_clientModel, &ClientModel::updateProgressBarLabel, this, &BitcoinGUI::updateProgressBarLabel); rpcConsole->setClientModel(_clientModel); + #ifdef ENABLE_WALLET + // Update Elysium pending status + connect(_clientModel, &ClientModel::refreshElysiumPending, this, &BitcoinGUI::setElysiumPendingStatus); + if(walletFrame) { walletFrame->setClientModel(_clientModel); @@ -645,10 +648,10 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) if(optionsModel) { // be aware of the tray icon disable state change reported by the OptionsModel object. - connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool))); + connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &BitcoinGUI::setTrayIconVisible); // update lelantus page if option is changed. - connect(optionsModel,SIGNAL(lelantusPageChanged(bool)),this,SLOT(updateLelantusPage())); + connect(optionsModel, &OptionsModel::lelantusPageChanged, this, &BitcoinGUI::updateLelantusPage); // initialize the disable state of the tray icon with the current value in the model. setTrayIconVisible(optionsModel->getHideTrayIcon()); @@ -759,8 +762,7 @@ void BitcoinGUI::createTrayIconMenu() trayIconMenu = new QMenu(this); trayIcon->setContextMenu(trayIconMenu); - connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); + connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); @@ -1222,7 +1224,7 @@ void BitcoinGUI::changeEvent(QEvent *e) QWindowStateChangeEvent *wsevt = static_cast(e); if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - QTimer::singleShot(0, this, SLOT(hide())); + QTimer::singleShot(0, this, &BitcoinGUI::hide); e->ignore(); } } @@ -1569,7 +1571,7 @@ void UnitDisplayStatusBarControl::createContextMenu() menuAction->setData(QVariant(u)); menu->addAction(menuAction); } - connect(menu,SIGNAL(triggered(QAction*)),this,SLOT(onMenuSelection(QAction*))); + connect(menu, &QMenu::triggered, this, &UnitDisplayStatusBarControl::onMenuSelection); } /** Lets the control know about the Options Model (and its signals) */ @@ -1580,7 +1582,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *_optionsModel) this->optionsModel = _optionsModel; // be aware of a display unit change reported by the OptionsModel object. - connect(_optionsModel,SIGNAL(displayUnitChanged(int)),this,SLOT(updateDisplayUnit(int))); + connect(_optionsModel, &OptionsModel::displayUnitChanged, this, &UnitDisplayStatusBarControl::updateDisplayUnit); // initialize the display units label with the current value in the model. updateDisplayUnit(_optionsModel->getDisplayUnit()); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 8a6cf41adc..601c0473a7 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -39,6 +39,11 @@ class QProgressBar; class QProgressDialog; QT_END_NAMESPACE +namespace GUIUtil { + class ClickableLabel; + class ClickableProgressBar; +} + /** Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and wallet models to give the user an up-to-date view of the current core state. @@ -85,12 +90,12 @@ class BitcoinGUI : public QMainWindow UnitDisplayStatusBarControl *unitDisplayControl; QLabel *labelWalletEncryptionIcon; QLabel *labelWalletHDStatusIcon; - QLabel *connectionsControl; - QLabel *labelBlocksIcon; + GUIUtil::ClickableLabel *connectionsControl; + GUIUtil::ClickableLabel *labelBlocksIcon; QLabel *labelElysiumPendingIcon; QLabel *labelElysiumPendingText; QLabel *progressBarLabel; - QProgressBar *progressBar; + GUIUtil::ClickableProgressBar *progressBar; QProgressDialog *progressDialog; QMenuBar *appMenuBar; @@ -212,7 +217,7 @@ public Q_SLOTS: void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label); #endif // ENABLE_WALLET -private Q_SLOTS: +public Q_SLOTS: #ifdef ENABLE_WALLET /** Switch to overview (home) page */ void gotoOverviewPage(); @@ -265,7 +270,9 @@ private Q_SLOTS: #endif /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ - void showNormalIfMinimized(bool fToggleHidden = false); + void showNormalIfMinimized() { showNormalIfMinimized(false); } + void showNormalIfMinimized(bool fToggleHidden); + /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */ void toggleHidden(); diff --git a/src/qt/cancelpassworddialog.cpp b/src/qt/cancelpassworddialog.cpp index 1c816b0750..4a7b4831f6 100644 --- a/src/qt/cancelpassworddialog.cpp +++ b/src/qt/cancelpassworddialog.cpp @@ -9,7 +9,7 @@ CancelPasswordDialog::CancelPasswordDialog(const QString &title, const QString & setDefaultButton(QMessageBox::Yes); cancelButton = button(QMessageBox::Cancel); updateCancelButton(); - connect(&countDownTimer, SIGNAL(timeout()), this, SLOT(countDown())); + connect(&countDownTimer, &QTimer::timeout, this, &CancelPasswordDialog::countDown); } int CancelPasswordDialog::exec() diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index b30de476b4..870c0775d9 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -43,7 +43,7 @@ ClientModel::ClientModel(OptionsModel *_optionsModel, QObject *parent) : peerTableModel = new PeerTableModel(this); banTableModel = new BanTableModel(this); pollTimer = new QTimer(this); - connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer())); + connect(pollTimer, &QTimer::timeout, this, &ClientModel::updateTimer); pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index bb14ce8ecc..b9884b8465 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -71,13 +71,13 @@ CoinControlDialog::CoinControlDialog(bool anonymousMode, const PlatformStyle *_p contextMenu->addAction(unlockAction); // context menu signals - connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); - connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); - connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); + connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &CoinControlDialog::showMenu); + connect(copyAddressAction, &QAction::triggered, this, &CoinControlDialog::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &CoinControlDialog::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &CoinControlDialog::copyAmount); + connect(copyTransactionHashAction, &QAction::triggered, this, &CoinControlDialog::copyTransactionHash); + connect(lockAction, &QAction::triggered, this, &CoinControlDialog::lockCoin); + connect(unlockAction, &QAction::triggered, this, &CoinControlDialog::unlockCoin); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -88,13 +88,13 @@ CoinControlDialog::CoinControlDialog(bool anonymousMode, const PlatformStyle *_p QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &CoinControlDialog::clipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &CoinControlDialog::clipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &CoinControlDialog::clipboardBytes); + connect(clipboardLowOutputAction, &QAction::triggered, this, &CoinControlDialog::clipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &CoinControlDialog::clipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); @@ -105,11 +105,11 @@ CoinControlDialog::CoinControlDialog(bool anonymousMode, const PlatformStyle *_p ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode - connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool))); - connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool))); + connect(ui->radioTreeMode, &QRadioButton::toggled, this, &CoinControlDialog::radioTreeMode); + connect(ui->radioListMode, &QRadioButton::toggled, this, &CoinControlDialog::radioListMode); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &CoinControlDialog::viewItemChanged); // click on header #if QT_VERSION < 0x050000 @@ -117,13 +117,13 @@ CoinControlDialog::CoinControlDialog(bool anonymousMode, const PlatformStyle *_p #else ui->treeWidget->header()->setSectionsClickable(true); #endif - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &CoinControlDialog::headerSectionClicked); // ok button - connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &CoinControlDialog::buttonBoxClicked); // (un)select all - connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &CoinControlDialog::buttonSelectAllClicked); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 diff --git a/src/qt/createpcodedialog.cpp b/src/qt/createpcodedialog.cpp index a4aad4490b..06fc438864 100644 --- a/src/qt/createpcodedialog.cpp +++ b/src/qt/createpcodedialog.cpp @@ -52,12 +52,12 @@ CreatePcodeDialog::CreatePcodeDialog(const PlatformStyle *_platformStyle, QWidge contextMenu->addAction(showQrcodeAction); // context menu signals - connect(ui->pcodesView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyPcodeAction, SIGNAL(triggered()), this, SLOT(copyPcode())); - connect(copyNotificationAddrAction, SIGNAL(triggered()), this, SLOT(copyNotificationAddr())); - connect(showQrcodeAction, SIGNAL(triggered()), this, SLOT(showQrcode())); + connect(ui->pcodesView, &QWidget::customContextMenuRequested, this, &CreatePcodeDialog::showMenu); + connect(copyPcodeAction, &QAction::triggered, this, &CreatePcodeDialog::copyPcode); + connect(copyNotificationAddrAction, &QAction::triggered, this, &CreatePcodeDialog::copyNotificationAddr); + connect(showQrcodeAction, &QAction::triggered, this, &CreatePcodeDialog::showQrcode); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->clearButton, &QPushButton::clicked, this, &CreatePcodeDialog::clear); ui->statusLabel->setStyleSheet("QLabel { color: " + QColor(GUIUtil::GUIColors::warning).name() + "; }"); } @@ -82,8 +82,8 @@ void CreatePcodeDialog::setModel(WalletModel *_model) tableView->setColumnWidth(static_cast(PcodeModel::ColumnIndex::Pcode), static_cast(ColumnWidths::Pcode)); tableView->setItemDelegateForColumn(int(PcodeModel::ColumnIndex::Pcode), new GUIUtil::TextElideStyledItemDelegate(tableView)); - connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - this, SLOT(pcodesView_selectionChanged(QItemSelection const &, QItemSelection const &))); + connect(tableView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &CreatePcodeDialog::pcodesView_selectionChanged); // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, 70, 70, this, int(PcodeModel::ColumnIndex::Pcode)); columnResizingFixer->stretchColumnWidth(int(PcodeModel::ColumnIndex::Pcode)); diff --git a/src/qt/elyassetsdialog.cpp b/src/qt/elyassetsdialog.cpp index 49cdf5a47e..173dfbc92b 100644 --- a/src/qt/elyassetsdialog.cpp +++ b/src/qt/elyassetsdialog.cpp @@ -103,14 +103,14 @@ ElyAssetsDialog::ElyAssetsDialog(QWidget *parent) : contextMenuSummary->addAction(balancesCopyAvailableAmountAction); // Connect actions - connect(ui->balancesTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - connect(ui->propSelectorWidget, SIGNAL(activated(int)), this, SLOT(propSelectorChanged())); - connect(balancesCopyIDAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol0())); - connect(balancesCopyNameAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol1())); - connect(balancesCopyLabelAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol0())); - connect(balancesCopyAddressAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol1())); - connect(balancesCopyReservedAmountAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol2())); - connect(balancesCopyAvailableAmountAction, SIGNAL(triggered()), this, SLOT(balancesCopyCol3())); + connect(ui->balancesTable, &QWidget::customContextMenuRequested, this, &ElyAssetsDialog::contextualMenu); + connect(ui->propSelectorWidget, qOverload(&QComboBox::activated) , this, &ElyAssetsDialog::propSelectorChanged); + connect(balancesCopyIDAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol0); + connect(balancesCopyNameAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol1); + connect(balancesCopyLabelAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol0); + connect(balancesCopyAddressAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol1); + connect(balancesCopyReservedAmountAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol2); + connect(balancesCopyAvailableAmountAction, &QAction::triggered, this, &ElyAssetsDialog::balancesCopyCol3); } ElyAssetsDialog::~ElyAssetsDialog() @@ -130,8 +130,8 @@ void ElyAssetsDialog::setClientModel(ClientModel *model) { this->clientModel = model; if (model != NULL) { - connect(model, SIGNAL(refreshElysiumBalance()), this, SLOT(balancesUpdated())); - connect(model, SIGNAL(reinitElysiumState()), this, SLOT(reinitEly())); + connect(model, &ClientModel::refreshElysiumBalance, this, &ElyAssetsDialog::balancesUpdated); + connect(model, &ClientModel::reinitElysiumState, this, &ElyAssetsDialog::reinitEly); } } diff --git a/src/qt/elysium_qtutils.cpp b/src/qt/elysium_qtutils.cpp index 37152660f0..5cd342c782 100644 --- a/src/qt/elysium_qtutils.cpp +++ b/src/qt/elysium_qtutils.cpp @@ -53,7 +53,7 @@ void PopulateSimpleDialog(const std::string& content, const std::string& title, QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox->addButton(closeButton, QDialogButtonBox::AcceptRole); dlgLayout->addWidget(buttonBox); - QObject::connect(buttonBox, SIGNAL(accepted()), simpleDlg, SLOT(accept())); + QObject::connect(buttonBox, &QDialogButtonBox::accepted, simpleDlg, &QDialog::accept); simpleDlg->setAttribute(Qt::WA_DeleteOnClose); simpleDlg->setWindowTitle(QString::fromStdString(title)); simpleDlg->setLayout(dlgLayout); diff --git a/src/qt/forms/sigmadialog.ui b/src/qt/forms/sigmadialog.ui index c4def5b0a7..e097709002 100644 --- a/src/qt/forms/sigmadialog.ui +++ b/src/qt/forms/sigmadialog.ui @@ -1020,26 +1020,7 @@ - - - - 120 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 2 - - - 21000000.000000000000000 - - - 0.050000000000000 - - + diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index e7fa980768..a551a3f2d1 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -491,15 +491,15 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) void TableViewLastColumnResizingFixer::connectViewHeadersSignals() { - connect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); - connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); + connect(tableView->horizontalHeader(), &QHeaderView::sectionResized, this, &TableViewLastColumnResizingFixer::on_sectionResized); + connect(tableView->horizontalHeader(), &QHeaderView::geometriesChanged, this, &TableViewLastColumnResizingFixer::on_geometriesChanged); } // We need to disconnect these while handling the resize events, otherwise we can enter infinite loops. void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() { - disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); - disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); + disconnect(tableView->horizontalHeader(), &QHeaderView::sectionResized, this, &TableViewLastColumnResizingFixer::on_sectionResized); + disconnect(tableView->horizontalHeader(), &QHeaderView::geometriesChanged, this, &TableViewLastColumnResizingFixer::on_geometriesChanged); } // Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed. diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index a5ea1e25e5..7917656310 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -286,11 +286,11 @@ void Intro::startThread() FreespaceChecker *executor = new FreespaceChecker(this); executor->moveToThread(thread); - connect(executor, SIGNAL(reply(int,QString,quint64)), this, SLOT(setStatus(int,QString,quint64))); - connect(this, SIGNAL(requestCheck()), executor, SLOT(check())); + connect(executor, &FreespaceChecker::reply, this, &Intro::setStatus); + connect(this, &Intro::requestCheck, executor, &FreespaceChecker::check); /* make sure executor object is deleted in its own thread */ - connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater())); - connect(this, SIGNAL(stopThread()), thread, SLOT(quit())); + connect(this, &Intro::stopThread, executor, &QObject::deleteLater); + connect(this, &Intro::stopThread, thread, &QThread::quit); thread->start(); } diff --git a/src/qt/lelantuscoincontroldialog.cpp b/src/qt/lelantuscoincontroldialog.cpp index a7ebe38ee5..930268ca39 100644 --- a/src/qt/lelantuscoincontroldialog.cpp +++ b/src/qt/lelantuscoincontroldialog.cpp @@ -285,13 +285,13 @@ LelantusCoinControlDialog::LelantusCoinControlDialog( contextMenu->addAction(unlockAction); // context menu signals - connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); - connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); - connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); + connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &LelantusCoinControlDialog::showMenu); + connect(copyAddressAction, &QAction::triggered, this, &LelantusCoinControlDialog::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &LelantusCoinControlDialog::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &LelantusCoinControlDialog::copyAmount); + connect(copyTransactionHashAction, &QAction::triggered, this, &LelantusCoinControlDialog::copyTransactionHash); + connect(lockAction, &QAction::triggered, this, &LelantusCoinControlDialog::lockCoin); + connect(unlockAction, &QAction::triggered, this, &LelantusCoinControlDialog::unlockCoin); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -302,13 +302,13 @@ LelantusCoinControlDialog::LelantusCoinControlDialog( QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardBytes); + connect(clipboardLowOutputAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &LelantusCoinControlDialog::clipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); @@ -319,11 +319,11 @@ LelantusCoinControlDialog::LelantusCoinControlDialog( ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode - connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool))); - connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool))); + connect(ui->radioTreeMode, &QRadioButton::toggled, this, &LelantusCoinControlDialog::radioTreeMode); + connect(ui->radioListMode, &QRadioButton::toggled, this, &LelantusCoinControlDialog::radioListMode); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &LelantusCoinControlDialog::viewItemChanged); // click on header #if QT_VERSION < 0x050000 @@ -331,13 +331,13 @@ LelantusCoinControlDialog::LelantusCoinControlDialog( #else ui->treeWidget->header()->setSectionsClickable(true); #endif - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &LelantusCoinControlDialog::headerSectionClicked); // ok button - connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &LelantusCoinControlDialog::buttonBoxClicked); // (un)select all - connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &LelantusCoinControlDialog::buttonSelectAllClicked); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 diff --git a/src/qt/lelantusdialog.cpp b/src/qt/lelantusdialog.cpp index 1dab8fac00..4694cf56f3 100644 --- a/src/qt/lelantusdialog.cpp +++ b/src/qt/lelantusdialog.cpp @@ -37,19 +37,9 @@ LelantusDialog::LelantusDialog(const PlatformStyle *platformStyle, QWidget *pare ui->globalUnspentAmount->setVisible(false); // Coin Control - connect( - ui->pushButtonCoinControl, SIGNAL(clicked()), - this, SLOT(coinControlButtonClicked())); - - connect( - ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), - this, SLOT(coinControlChangeChecked(int))); - - connect( - ui->lineEditCoinControlChange, - SIGNAL(textEdited(const QString &)), - this, - SLOT(coinControlChangeEdited(const QString &))); + connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, &LelantusDialog::coinControlButtonClicked); + connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, &LelantusDialog::coinControlChangeChecked); + connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, this, &LelantusDialog::coinControlChangeEdited); // Coin Control: clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -59,13 +49,13 @@ LelantusDialog::LelantusDialog(const PlatformStyle *platformStyle, QWidget *pare QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardBytes())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardBytes); + connect(clipboardLowOutputAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &LelantusDialog::coinControlClipboardChange); // init transaction fee section. QSettings settings; @@ -121,19 +111,8 @@ void LelantusDialog::setClientModel(ClientModel *_clientModel) this->clientModel = _clientModel; if (_clientModel) { - connect( - _clientModel, - SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), - this, - SLOT(updateSmartFeeLabel())); - - connect( - _clientModel, - SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), - this, - SLOT(updateGlobalState())); - - updateGlobalState(); + connect(_clientModel, &ClientModel::numBlocksChanged, this, &LelantusDialog::updateSmartFeeLabel); + connect(_clientModel, &ClientModel::numBlocksChanged, this, &LelantusDialog::updateGlobalState); } } @@ -142,17 +121,8 @@ void LelantusDialog::setWalletModel(WalletModel *_walletModel) this->walletModel = _walletModel; if (_walletModel) { - connect( - _walletModel, - SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, - SLOT(setBalance(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount))); - - connect( - _walletModel->getOptionsModel(), - SIGNAL(displayUnitChanged(int)), - this, - SLOT(updateDisplayUnit(int))); + connect(_walletModel, &WalletModel::balanceChanged, this, &LelantusDialog::setBalance); + connect(_walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &LelantusDialog::updateDisplayUnit); auto privateBalance = _walletModel->getLelantusModel()->getPrivateBalance(); setBalance(0, 0, 0, 0, 0, 0, @@ -161,15 +131,8 @@ void LelantusDialog::setWalletModel(WalletModel *_walletModel) _walletModel->getAnonymizableBalance()); // Coin Control - connect( - _walletModel->getOptionsModel(), - SIGNAL(displayUnitChanged(int)), - this, SLOT(coinControlUpdateLabels())); - connect( - _walletModel->getOptionsModel(), - SIGNAL(coinControlFeaturesChanged(bool)), - this, - SLOT(coinControlFeatureChanged(bool))); + connect(_walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &LelantusDialog::coinControlUpdateLabels); + connect(_walletModel->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, this, &LelantusDialog::coinControlFeatureChanged); ui->frameCoinControl->setVisible( _walletModel->getOptionsModel()->getCoinControlFeatures()); coinControlUpdateLabels(); @@ -179,20 +142,20 @@ void LelantusDialog::setWalletModel(WalletModel *_walletModel) updateDisplayUnit(unit); // fee section - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateFeeSectionControls())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->groupCustomFee, SIGNAL(buttonClicked(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->groupCustomFee, SIGNAL(buttonClicked(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->customFee, SIGNAL(valueChanged()), this, SLOT(updateGlobalFeeVariables())); - connect(ui->customFee, SIGNAL(valueChanged()), this, SLOT(coinControlUpdateLabels())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &LelantusDialog::updateSmartFeeLabel); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &LelantusDialog::updateGlobalFeeVariables); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &LelantusDialog::coinControlUpdateLabels); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &LelantusDialog::updateFeeSectionControls); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &LelantusDialog::updateGlobalFeeVariables); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &LelantusDialog::coinControlUpdateLabels); + connect(ui->groupCustomFee, qOverload(&QButtonGroup::buttonClicked), this, &LelantusDialog::updateGlobalFeeVariables); + connect(ui->groupCustomFee, qOverload(&QButtonGroup::buttonClicked), this, &LelantusDialog::coinControlUpdateLabels); + connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &LelantusDialog::updateGlobalFeeVariables); + connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &LelantusDialog::coinControlUpdateLabels); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &LelantusDialog::setMinimumFee); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &LelantusDialog::updateFeeSectionControls); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &LelantusDialog::updateGlobalFeeVariables); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &LelantusDialog::coinControlUpdateLabels); ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); diff --git a/src/qt/lelantusmodel.cpp b/src/qt/lelantusmodel.cpp index b0cc7aed90..f6795e3ebd 100644 --- a/src/qt/lelantusmodel.cpp +++ b/src/qt/lelantusmodel.cpp @@ -20,14 +20,12 @@ LelantusModel::LelantusModel( { autoMintModel = new AutoMintModel(this, optionsModel, wallet, this); - connect(this, SIGNAL(ackMintAll(AutoMintAck, CAmount, QString)), - autoMintModel, SLOT(ackMintAll(AutoMintAck, CAmount, QString))); + connect(this, &LelantusModel::ackMintAll, autoMintModel, &AutoMintModel::ackMintAll); } LelantusModel::~LelantusModel() { - disconnect(this, SIGNAL(ackMintAll(AutoMintAck, CAmount, QString)), - autoMintModel, SLOT(ackMintAll(AutoMintAck, CAmount, QString))); + disconnect(this, &LelantusModel::ackMintAll, autoMintModel, &AutoMintModel::ackMintAll); delete autoMintModel; @@ -73,7 +71,7 @@ bool LelantusModel::unlockWallet(SecureString const &passphase, size_t msecs) return false; } - QTimer::singleShot(msecs, this, SLOT(lock())); + QTimer::singleShot(msecs, this, &LelantusModel::lock); return true; } @@ -121,7 +119,7 @@ void LelantusModel::lock() { LOCK2(wallet->cs_wallet, cs); if (autoMintModel->isAnonymizing()) { - QTimer::singleShot(MODEL_UPDATE_DELAY, this, SLOT(lock())); + QTimer::singleShot(MODEL_UPDATE_DELAY, this, &LelantusModel::lock); return; } diff --git a/src/qt/lookupaddressdialog.cpp b/src/qt/lookupaddressdialog.cpp index 8e5f96a229..f60afb6d85 100644 --- a/src/qt/lookupaddressdialog.cpp +++ b/src/qt/lookupaddressdialog.cpp @@ -50,10 +50,10 @@ MPQRImageWidget::MPQRImageWidget(QWidget *parent): { contextMenu = new QMenu(); QAction *saveImageAction = new QAction(tr("&Save Image..."), this); - connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); + connect(saveImageAction, &QAction::triggered, this, &MPQRImageWidget::saveImage); contextMenu->addAction(saveImageAction); QAction *copyImageAction = new QAction(tr("&Copy Image"), this); - connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage())); + connect(copyImageAction, &QAction::triggered, this, &MPQRImageWidget::copyImage); contextMenu->addAction(copyImageAction); } @@ -116,7 +116,7 @@ LookupAddressDialog::LookupAddressDialog(QWidget *parent) : #endif // connect actions - connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(searchButtonClicked())); + connect(ui->searchButton, &QPushButton::clicked, this, &LookupAddressDialog::searchButtonClicked); // hide balance labels QLabel* balances[] = { ui->propertyLabel1, ui->propertyLabel2, ui->propertyLabel3, ui->propertyLabel4, ui->propertyLabel5, ui->propertyLabel6, ui->propertyLabel7, ui->propertyLabel8, ui->propertyLabel9, ui->propertyLabel10 }; diff --git a/src/qt/lookupspdialog.cpp b/src/qt/lookupspdialog.cpp index 256e8b09a8..9c29c28bfa 100644 --- a/src/qt/lookupspdialog.cpp +++ b/src/qt/lookupspdialog.cpp @@ -40,8 +40,8 @@ LookupSPDialog::LookupSPDialog(QWidget *parent) : #endif // connect actions - connect(ui->matchingComboBox, SIGNAL(activated(int)), this, SLOT(matchingComboBoxChanged(int))); - connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(searchButtonClicked())); + connect(ui->matchingComboBox, qOverload(&QComboBox::activated), this, &LookupSPDialog::matchingComboBoxChanged); + connect(ui->searchButton, &QPushButton::clicked, this, &LookupSPDialog::searchButtonClicked); // hide crowd info ui->desired->setVisible(false); diff --git a/src/qt/lookuptxdialog.cpp b/src/qt/lookuptxdialog.cpp index efcf4502fa..95d39d4be9 100644 --- a/src/qt/lookuptxdialog.cpp +++ b/src/qt/lookuptxdialog.cpp @@ -37,7 +37,7 @@ LookupTXDialog::LookupTXDialog(QWidget *parent) : #endif // connect actions - connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(searchButtonClicked())); + connect(ui->searchButton, &QPushButton::clicked, this, &LookupTXDialog::searchButtonClicked); } LookupTXDialog::~LookupTXDialog() diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 8d368130dd..08b9199511 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -66,15 +66,15 @@ MasternodeList::MasternodeList(const PlatformStyle* platformStyle, QWidget* pare contextMenuDIP3 = new QMenu(); contextMenuDIP3->addAction(copyProTxHashAction); contextMenuDIP3->addAction(copyCollateralOutpointAction); - connect(ui->tableWidgetMasternodesDIP3, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenuDIP3(const QPoint&))); - connect(ui->tableWidgetMasternodesDIP3, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(extraInfoDIP3_clicked())); - connect(copyProTxHashAction, SIGNAL(triggered()), this, SLOT(copyProTxHash_clicked())); - connect(copyCollateralOutpointAction, SIGNAL(triggered()), this, SLOT(copyCollateralOutpoint_clicked())); + connect(ui->tableWidgetMasternodesDIP3, &QWidget::customContextMenuRequested, this, &MasternodeList::showContextMenuDIP3); + connect(ui->tableWidgetMasternodesDIP3, &QAbstractItemView::doubleClicked, this, &MasternodeList::extraInfoDIP3_clicked); + connect(copyProTxHashAction, &QAction::triggered, this, &MasternodeList::copyProTxHash_clicked); + connect(copyCollateralOutpointAction, &QAction::triggered, this, &MasternodeList::copyCollateralOutpoint_clicked); //always start with "my znodes only" checked ui->checkBoxMyMasternodesOnly->setChecked(true); timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(updateDIP3ListScheduled())); + connect(timer, &QTimer::timeout, this, &MasternodeList::updateDIP3ListScheduled); timer->start(1000); } @@ -88,7 +88,7 @@ void MasternodeList::setClientModel(ClientModel* model) this->clientModel = model; if (model) { // try to update list when masternode count changes - connect(clientModel, SIGNAL(masternodeListChanged()), this, SLOT(handleMasternodeListChanged())); + connect(clientModel, &ClientModel::masternodeListChanged, this, &MasternodeList::handleMasternodeListChanged); } } diff --git a/src/qt/metadexcanceldialog.cpp b/src/qt/metadexcanceldialog.cpp index dcdebc6b60..03cab0a302 100755 --- a/src/qt/metadexcanceldialog.cpp +++ b/src/qt/metadexcanceldialog.cpp @@ -44,11 +44,11 @@ MetaDExCancelDialog::MetaDExCancelDialog(QWidget *parent) : { ui->setupUi(this); - connect(ui->radioCancelPair, SIGNAL(clicked()),this, SLOT(UpdateCancelCombo())); - connect(ui->radioCancelPrice, SIGNAL(clicked()),this, SLOT(UpdateCancelCombo())); - connect(ui->radioCancelEverything, SIGNAL(clicked()),this, SLOT(UpdateCancelCombo())); - connect(ui->cancelButton, SIGNAL(clicked()),this, SLOT(SendCancelTransaction())); - connect(ui->fromCombo, SIGNAL(activated(int)), this, SLOT(fromAddressComboBoxChanged(int))); + connect(ui->radioCancelPair, &QRadioButton::clicked,this, &MetaDExCancelDialog::UpdateCancelCombo); + connect(ui->radioCancelPrice, &QRadioButton::clicked,this, &MetaDExCancelDialog::UpdateCancelCombo); + connect(ui->radioCancelEverything, &QRadioButton::clicked,this, &MetaDExCancelDialog::UpdateCancelCombo); + connect(ui->cancelButton, &QPushButton::clicked,this, &MetaDExCancelDialog::SendCancelTransaction); + connect(ui->fromCombo, qOverload(&QComboBox::activated), this, &MetaDExCancelDialog::fromAddressComboBoxChanged); // perform initial from address population UpdateAddressSelector(); diff --git a/src/qt/metadexdialog.cpp b/src/qt/metadexdialog.cpp index 9ab3121844..16f309f66f 100755 --- a/src/qt/metadexdialog.cpp +++ b/src/qt/metadexdialog.cpp @@ -76,17 +76,17 @@ MetaDExDialog::MetaDExDialog(QWidget *parent) : ui->sellList->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->sellList->setSelectionMode(QAbstractItemView::SingleSelection); - connect(ui->comboPairTokenA, SIGNAL(activated(int)), this, SLOT(SwitchMarket())); - connect(ui->comboPairTokenB, SIGNAL(activated(int)), this, SLOT(SwitchMarket())); - connect(ui->comboAddress, SIGNAL(activated(int)), this, SLOT(UpdateBalance())); - connect(ui->chkTestEco, SIGNAL(clicked(bool)), this, SLOT(FullRefresh())); - connect(ui->buttonInvertPair, SIGNAL(clicked(bool)), this, SLOT(InvertPair())); - connect(ui->buttonTradeHistory, SIGNAL(clicked(bool)), this, SLOT(ShowHistory())); - connect(ui->sellAmountSaleLE, SIGNAL(textEdited(const QString &)), this, SLOT(RecalcSellValues())); - connect(ui->sellAmountDesiredLE, SIGNAL(textEdited(const QString &)), this, SLOT(RecalcSellValues())); - connect(ui->sellUnitPriceLE, SIGNAL(textEdited(const QString &)), this, SLOT(RecalcSellValues())); - connect(ui->sellList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(ShowDetails())); - connect(ui->sellButton, SIGNAL(clicked()), this, SLOT(sendTrade())); + connect(ui->comboPairTokenA, qOverload(&QComboBox::activated), this, &MetaDExDialog::SwitchMarket); + connect(ui->comboPairTokenB, qOverload(&QComboBox::activated), this, &MetaDExDialog::SwitchMarket); + connect(ui->comboAddress, qOverload(&QComboBox::activated), this, &MetaDExDialog::UpdateBalance); + connect(ui->chkTestEco, &QCheckBox::clicked, this, &MetaDExDialog::FullRefresh); + connect(ui->buttonInvertPair, &QPushButton::clicked, this, &MetaDExDialog::InvertPair); + connect(ui->buttonTradeHistory, &QPushButton::clicked, this, &MetaDExDialog::ShowHistory); + connect(ui->sellAmountSaleLE, &QLineEdit::textEdited, this, &MetaDExDialog::RecalcSellValues); + connect(ui->sellAmountDesiredLE, &QLineEdit::textEdited, this, &MetaDExDialog::RecalcSellValues); + connect(ui->sellUnitPriceLE, &QLineEdit::textEdited, this, &MetaDExDialog::RecalcSellValues); + connect(ui->sellList, &QAbstractItemView::doubleClicked, this, &MetaDExDialog::ShowDetails); + connect(ui->sellButton, &QPushButton::clicked, this, &MetaDExDialog::sendTrade); FullRefresh(); } @@ -114,9 +114,9 @@ void MetaDExDialog::setClientModel(ClientModel *model) { this->clientModel = model; if (NULL != model) { - connect(model, SIGNAL(refreshElysiumState()), this, SLOT(UpdateOffers())); - connect(model, SIGNAL(refreshElysiumBalance()), this, SLOT(BalanceOrderRefresh())); - connect(model, SIGNAL(reinitElysiumState()), this, SLOT(FullRefresh())); + connect(model, &ClientModel::refreshElysiumState, this, &MetaDExDialog::UpdateOffers); + connect(model, &ClientModel::refreshElysiumBalance, this, &MetaDExDialog::BalanceOrderRefresh); + connect(model, &ClientModel::reinitElysiumState, this, &MetaDExDialog::FullRefresh); } } @@ -125,7 +125,7 @@ void MetaDExDialog::setWalletModel(WalletModel *model) // use wallet model to get visibility into FIRO balance changes for fees this->walletModel = model; if (model != NULL) { - connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(UpdateBalances())); + connect(model, &WalletModel::balanceChanged, this, &MetaDExDialog::UpdateBalance); } } diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index bd29007b1f..174ec0df80 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -22,7 +22,7 @@ userClosed(false), foreverHidden(false) { ui->setupUi(this); - connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeClicked())); + connect(ui->closeButton, &QPushButton::clicked, this, &ModalOverlay::closeClicked); if (parent) { parent->installEventFilter(this); raise(); diff --git a/src/qt/notifymnemonic.cpp b/src/qt/notifymnemonic.cpp index 9c322ce33e..92ee78f37f 100644 --- a/src/qt/notifymnemonic.cpp +++ b/src/qt/notifymnemonic.cpp @@ -19,8 +19,8 @@ NotifyMnemonic::NotifyMnemonic(QWidget *parent) : ui(new Ui::NotifyMnemonic) { ui->setupUi(this); - disconnect(QWizard::button(QWizard::CancelButton), SIGNAL(clicked()), this, SLOT(reject())); - connect(QWizard::button(QWizard::CancelButton), SIGNAL(clicked()), this, SLOT( cancelEvent())); + disconnect(QWizard::button(QWizard::CancelButton), &QAbstractButton::clicked, this, &QDialog::reject); + connect(QWizard::button(QWizard::CancelButton), &QAbstractButton::clicked, this, &NotifyMnemonic::cancelEvent); } NotifyMnemonic::~NotifyMnemonic() diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index ed223fca34..e3a50531b1 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -57,13 +57,13 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : ui->proxyPortTor->setEnabled(false); ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this)); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState())); + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyIp, &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyPort, &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); - connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, SLOT(setEnabled(bool))); - connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, SLOT(setEnabled(bool))); - connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState())); + connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyIpTor, &QWidget::setEnabled); + connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, &QWidget::setEnabled); + connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); /* Window elements init */ #ifdef Q_OS_MAC @@ -124,10 +124,10 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : /* setup/change UI elements when proxy IPs are invalid/valid */ ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent)); ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent)); - connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState())); - connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState())); - connect(ui->proxyPort, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState())); - connect(ui->proxyPortTor, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState())); + connect(ui->proxyIp, &QValidatedLineEdit::validationDidChange, this, &OptionsDialog::updateProxyValidationState); + connect(ui->proxyIpTor, &QValidatedLineEdit::validationDidChange, this, &OptionsDialog::updateProxyValidationState); + connect(ui->proxyPort, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState); + connect(ui->proxyPortTor, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState); } OptionsDialog::~OptionsDialog() @@ -160,18 +160,18 @@ void OptionsDialog::setModel(OptionsModel *_model) /* warn when one of the following settings changes by user action (placed here so init via mapper doesn't trigger them) */ /* Main */ - connect(ui->databaseCache, SIGNAL(valueChanged(int)), this, SLOT(showRestartWarning())); - connect(ui->threadsScriptVerif, SIGNAL(valueChanged(int)), this, SLOT(showRestartWarning())); + connect(ui->databaseCache, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); + connect(ui->threadsScriptVerif, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); /* Wallet */ - connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); - connect(ui->reindexLelantus, SIGNAL(clicked(bool)), this, SLOT(handleEnabledZapChanged())); + connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); + connect(ui->reindexLelantus, &QCheckBox::clicked, this, &OptionsDialog::handleEnabledZapChanged); /* Network */ - connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); - connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); - connect(ui->connectSocksTor, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); + connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); + connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); + connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Display */ - connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); - connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning())); + connect(ui->lang, qOverload<>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); + connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); } void OptionsDialog::setMapper() @@ -293,7 +293,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, SLOT(clearStatusLabel())); + QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel); } } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 2dca7e6767..fe90a55429 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -159,13 +159,13 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); - connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); - connect(ui->checkboxEnabledTor, SIGNAL(toggled(bool)), this, SLOT(handleEnabledTorChanged())); + connect(ui->listTransactions, &QListView::clicked, this, &OverviewPage::handleTransactionClicked); + connect(ui->checkboxEnabledTor, &QCheckBox::toggled, this, &OverviewPage::handleEnabledTorChanged); // start with displaying the "out of sync" warnings showOutOfSyncWarning(true); - connect(ui->labelWalletStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); - connect(ui->labelTransactionsStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); + connect(ui->labelWalletStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks); + connect(ui->labelTransactionsStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks); } void OverviewPage::handleTransactionClicked(const QModelIndex &index) @@ -272,7 +272,7 @@ void OverviewPage::setClientModel(ClientModel *model) if(model) { // Show warning if this is a prerelease version - connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString))); + connect(model, &ClientModel::alertsChanged, this, &OverviewPage::updateAlerts); updateAlerts(model->getStatusBarWarnings()); } } @@ -307,16 +307,12 @@ void OverviewPage::setWalletModel(WalletModel *model) privateBalance.first, privateBalance.second, model->getAnonymizableBalance()); - connect( - model, - SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, - SLOT(setBalance(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount))); + connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance); - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit); updateWatchOnlyLabels(model->haveWatchOnly()); - connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool))); + connect(model, &WalletModel::notifyWatchonlyChanged, this, &OverviewPage::updateWatchOnlyLabels); } // update the display unit, to not use the default ("BTC") diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index d8c343c881..bd0400fb8a 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -327,8 +327,8 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : tr("Cannot start firo: click-to-pay handler")); } else { - connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection())); - connect(this, SIGNAL(receivedPaymentACK(QString)), this, SLOT(handlePaymentACK(QString))); + connect(uriServer, &QLocalServer::newConnection, this, &PaymentServer::handleURIConnection); + connect(this, &PaymentServer::receivedPaymentACK, this, &PaymentServer::handlePaymentACK); } } } @@ -379,10 +379,8 @@ void PaymentServer::initNetManager() else qDebug() << "PaymentServer::initNetManager: No active proxy server found."; - connect(netManager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(netRequestFinished(QNetworkReply*))); - connect(netManager, SIGNAL(sslErrors(QNetworkReply*, const QList &)), - this, SLOT(reportSslErrors(QNetworkReply*, const QList &))); + connect(netManager, &QNetworkAccessManager::finished, this, &PaymentServer::netRequestFinished); + connect(netManager, &QNetworkAccessManager::sslErrors, this, &PaymentServer::reportSslErrors); } void PaymentServer::uiReady() @@ -480,8 +478,7 @@ void PaymentServer::handleURIConnection() while (clientConnection->bytesAvailable() < (int)sizeof(quint32)) clientConnection->waitForReadyRead(); - connect(clientConnection, SIGNAL(disconnected()), - clientConnection, SLOT(deleteLater())); + connect(clientConnection, &QLocalSocket::disconnected, clientConnection, &QLocalSocket::deleteLater); QDataStream in(clientConnection); in.setVersion(QDataStream::Qt_4_0); diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index fff072fd4c..088be1a150 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -121,7 +121,7 @@ PeerTableModel::PeerTableModel(ClientModel *parent) : // set up timer for auto refresh timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(refresh())); + connect(timer, &QTimer::timeout, this, &PeerTableModel::refresh); timer->setInterval(MODEL_UPDATE_DELAY); // load initial data diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp index 179ecdc8b3..cd8f994586 100644 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -12,7 +12,7 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : valid(true), checkValidator(0) { - connect(this, SIGNAL(textChanged(QString)), this, SLOT(markValid())); + connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid); } void QValidatedLineEdit::setValid(bool _valid) diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index a3b9b994ec..2eb165871f 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -7,7 +7,7 @@ QValueComboBox::QValueComboBox(QWidget *parent) : QComboBox(parent), role(Qt::UserRole) { - connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); + connect(this, qOverload(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); } QVariant QValueComboBox::value() const diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index e98f4d3347..2ca8ae1342 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -57,13 +57,13 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid contextMenu->addAction(copyAmountAction); // context menu signals - connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); + connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu); + connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI); + connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel); + connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage); + connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->clearButton, &QPushButton::clicked, this, &ReceiveCoinsDialog::clear); } void ReceiveCoinsDialog::setModel(WalletModel *_model) @@ -73,7 +73,7 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model) if(_model && _model->getOptionsModel()) { _model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder); - connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveCoinsDialog::updateDisplayUnit); updateDisplayUnit(); QTableView* tableView = ui->recentRequestsView; @@ -88,9 +88,8 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model) tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH); tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); - connect(tableView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, - SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); + connect(tableView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &ReceiveCoinsDialog::recentRequestsView_selectionChanged); // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this); } diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 3752fa4b66..e95ad831a0 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -34,10 +34,10 @@ QRImageWidget::QRImageWidget(QWidget *parent): { contextMenu = new QMenu(this); QAction *saveImageAction = new QAction(tr("&Save Image..."), this); - connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); + connect(saveImageAction, &QAction::triggered, this, &QRImageWidget::saveImage); contextMenu->addAction(saveImageAction); QAction *copyImageAction = new QAction(tr("&Copy Image"), this); - connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage())); + connect(copyImageAction, &QAction::triggered, this, &QRImageWidget::copyImage); contextMenu->addAction(copyImageAction); } @@ -101,7 +101,7 @@ ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : ui->lblQRCode->setVisible(false); #endif - connect(ui->btnSaveAs, SIGNAL(clicked()), ui->lblQRCode, SLOT(saveImage())); + connect(ui->btnSaveAs, &QPushButton::clicked, ui->lblQRCode, &QRImageWidget::saveImage); } ReceiveRequestDialog::~ReceiveRequestDialog() @@ -114,7 +114,7 @@ void ReceiveRequestDialog::setModel(OptionsModel *_model) this->model = _model; if (_model) - connect(_model, SIGNAL(displayUnitChanged(int)), this, SLOT(update())); + connect(_model, &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::update); // update the display unit if necessary update(); diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index dac3979290..a0d0ad0007 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -28,7 +28,7 @@ RecentRequestsTableModel::RecentRequestsTableModel(CWallet *wallet, WalletModel /* These columns must match the indices in the ColumnIndex enumeration */ columns << tr("Date") << tr("Label") << tr("Message") << getAmountTitle(); - connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &RecentRequestsTableModel::updateDisplayUnit); } RecentRequestsTableModel::~RecentRequestsTableModel() diff --git a/src/qt/recover.cpp b/src/qt/recover.cpp index e9bbe6f8c9..8ac7ba9106 100644 --- a/src/qt/recover.cpp +++ b/src/qt/recover.cpp @@ -27,7 +27,7 @@ Recover::Recover(QWidget *parent) : setCreateNew(); thread = new QThread(this); - connect(this, SIGNAL(stopThread()), thread, SLOT(quit())); + connect(this, &Recover::stopThread, thread, &QThread::quit); thread->start(); } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c76e60d7f7..91518ea340 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -102,7 +101,7 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase func(_func) { timer.setSingleShot(true); - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + connect(&timer, &QTimer::timeout, this, &QtRPCTimerBase::timeout); timer.start(millis); } ~QtRPCTimerBase() {} @@ -436,10 +435,10 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) : ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); - connect(ui->fontBiggerButton, SIGNAL(clicked()), this, SLOT(fontBigger())); - connect(ui->fontSmallerButton, SIGNAL(clicked()), this, SLOT(fontSmaller())); - connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear())); + connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear); + connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger); + connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller); + connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); // set library version labels #ifdef ENABLE_WALLET @@ -523,18 +522,18 @@ void RPCConsole::setClientModel(ClientModel *model) if (model && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) { // Keep up to date with client setNumConnections(model->getNumConnections()); - connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); + connect(model, &ClientModel::numConnectionsChanged, this, &RPCConsole::setNumConnections); setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getVerificationProgress(NULL), false); - connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool))); + connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks); updateNetworkState(); - connect(model, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool))); + connect(model, &ClientModel::networkActiveChanged, this, &RPCConsole::setNetworkActive); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); - connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); + connect(model, &ClientModel::bytesChanged, this, &RPCConsole::updateTrafficStats); - connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t))); + connect(model, &ClientModel::mempoolSizeChanged, this, &RPCConsole::setMempoolSize); // set up peer table ui->peerWidget->setModel(model->getPeerTableModel()); @@ -563,31 +562,21 @@ void RPCConsole::setClientModel(ClientModel *model) peersTableContextMenu->addAction(banAction7d); peersTableContextMenu->addAction(banAction365d); - // Add a signal mapping to allow dynamic context menu arguments. - // We need to use int (instead of int64_t), because signal mapper only supports - // int or objects, which is okay because max bantime (1 year) is < int_max. - QSignalMapper* signalMapper = new QSignalMapper(this); - signalMapper->setMapping(banAction1h, 60*60); - signalMapper->setMapping(banAction24h, 60*60*24); - signalMapper->setMapping(banAction7d, 60*60*24*7); - signalMapper->setMapping(banAction365d, 60*60*24*365); - connect(banAction1h, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(banAction7d, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(banAction365d, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(banSelectedNode(int))); + connect(banAction1h, &QAction::triggered, [this] { banSelectedNode(60 * 60); }); + connect(banAction24h, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24); }); + connect(banAction7d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 7); }); + connect(banAction365d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 365); }); // peer table context menu signals - connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&))); - connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode())); + connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu); + connect(disconnectAction, &QAction::triggered, this, &RPCConsole::disconnectSelectedNode); // peer table signal handling - update peer details when selecting new node - connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), - this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &))); + connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::peerSelected); // peer table signal handling - update peer details when new nodes are added to the model - connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged())); + connect(model->getPeerTableModel(), &PeerTableModel::layoutChanged, this, &RPCConsole::peerLayoutChanged); // peer table signal handling - cache selected node ids - connect(model->getPeerTableModel(), SIGNAL(layoutAboutToBeChanged()), this, SLOT(peerLayoutAboutToChange())); + connect(model->getPeerTableModel(), &PeerTableModel::layoutAboutToBeChanged, this, &RPCConsole::peerLayoutAboutToChange); // set up ban table ui->banlistWidget->setModel(model->getBanTableModel()); @@ -608,13 +597,13 @@ void RPCConsole::setClientModel(ClientModel *model) banTableContextMenu->addAction(unbanAction); // ban table context menu signals - connect(ui->banlistWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showBanTableContextMenu(const QPoint&))); - connect(unbanAction, SIGNAL(triggered()), this, SLOT(unbanSelectedNode())); + connect(ui->banlistWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showBanTableContextMenu); + connect(unbanAction, &QAction::triggered, this, &RPCConsole::unbanSelectedNode); // ban table signal handling - clear peer details when clicking a peer in the ban table - connect(ui->banlistWidget, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clearSelectedNode())); + connect(ui->banlistWidget, &QTableView::clicked, this, &RPCConsole::clearSelectedNode); // ban table signal handling - ensure ban table is shown or hidden (if empty) - connect(model->getBanTableModel(), SIGNAL(layoutChanged()), this, SLOT(showOrHideBanTableIfRequired())); + connect(model->getBanTableModel(), &BanTableModel::layoutChanged, this, &RPCConsole::showOrHideBanTableIfRequired); showOrHideBanTableIfRequired(); // Provide initial values @@ -873,15 +862,15 @@ void RPCConsole::startExecutor() executor->moveToThread(&thread); // Replies from executor object must go to this object - connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString))); + connect(executor, &RPCExecutor::reply, this, qOverload(&RPCConsole::message)); // Requests from this object must go to executor - connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString))); + connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request); // On stopExecutor signal // - quit the Qt event loop in the execution thread - connect(this, SIGNAL(stopExecutor()), &thread, SLOT(quit())); + connect(this, &RPCConsole::stopExecutor, &thread, &QThread::quit); // - queue executor for deletion (in execution thread) - connect(&thread, SIGNAL(finished()), executor, SLOT(deleteLater()), Qt::DirectConnection); + connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater, Qt::DirectConnection); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index ec531c99c8..1e8894f717 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -89,7 +89,8 @@ public Q_SLOTS: void fontSmaller(); void setFontSize(int newSize); /** Append the message to the message widget */ - void message(int category, const QString &message, bool html = false); + void message(int category, const QString &msg) { message(category, msg, false); } + void message(int category, const QString &message, bool html); /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set network state shown in the UI */ diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 85e8363d9f..2f6157df0f 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -62,12 +62,12 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p addEntry(); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry())); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->addButton, &QPushButton::clicked, this, &SendCoinsDialog::addEntry); + connect(ui->clearButton, &QPushButton::clicked, this, &SendCoinsDialog::clear); // Coin Control - connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked())); - connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int))); - connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &))); + connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, &SendCoinsDialog::coinControlButtonClicked); + connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlChangeChecked); + connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, this, &SendCoinsDialog::coinControlChangeEdited); // Coin Control: clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); @@ -76,13 +76,13 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardBytes())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardBytes); + connect(clipboardLowOutputAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); ui->labelCoinControlFee->addAction(clipboardFeeAction); @@ -137,9 +137,8 @@ void SendCoinsDialog::setClientModel(ClientModel *_clientModel) if (_clientModel) { - connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(updateSmartFeeLabel())); - connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), - this, SLOT(updateBlocks(int,QDateTime,double,bool))); + connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateSmartFeeLabel); + connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateBlocks); } } @@ -164,36 +163,32 @@ void SendCoinsDialog::setModel(WalletModel *_model) _model->getBalance(), _model->getUnconfirmedBalance(), _model->getImmatureBalance(), _model->getWatchBalance(), _model->getWatchUnconfirmedBalance(), _model->getWatchImmatureBalance(), privateBalance.first, privateBalance.second, _model->getAnonymizableBalance()); - connect( - _model, - SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, - SLOT(setBalance(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount))); - connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(_model, &WalletModel::balanceChanged, this, &SendCoinsDialog::setBalance); + connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::updateDisplayUnit); updateDisplayUnit(); // Coin Control - connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(_model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool))); + connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + connect(_model->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, this, &SendCoinsDialog::coinControlFeatureChanged); ui->frameCoinControl->setVisible(_model->getOptionsModel()->getCoinControlFeatures()); coinControlUpdateLabels(); // fee section - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateFeeSectionControls())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->groupCustomFee, SIGNAL(buttonClicked(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->groupCustomFee, SIGNAL(buttonClicked(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->customFee, SIGNAL(valueChanged()), this, SLOT(updateGlobalFeeVariables())); - connect(ui->customFee, SIGNAL(valueChanged()), this, SLOT(coinControlUpdateLabels())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateGlobalFeeVariables())); - connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &SendCoinsDialog::updateSmartFeeLabel); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &SendCoinsDialog::updateGlobalFeeVariables); + connect(ui->sliderSmartFee, &QSlider::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateGlobalFeeVariables); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->groupCustomFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateGlobalFeeVariables); + connect(ui->groupCustomFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::updateGlobalFeeVariables); + connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::setMinimumFee); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateFeeSectionControls); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateGlobalFeeVariables); + connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels); ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); @@ -455,9 +450,9 @@ SendCoinsEntry *SendCoinsDialog::addEntry() SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this); entry->setModel(model); ui->entries->addWidget(entry); - connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); - connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels())); - connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, SLOT(coinControlUpdateLabels())); + connect(entry, &SendCoinsEntry::removeEntry, this, &SendCoinsDialog::removeEntry); + connect(entry, &SendCoinsEntry::payAmountChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + connect(entry, &SendCoinsEntry::subtractFeeFromAmountChanged, this, &SendCoinsDialog::coinControlUpdateLabels); // Focus the field, so that entry can start immediately entry->clear(); @@ -1031,7 +1026,7 @@ SendConfirmationDialog::SendConfirmationDialog(const QString &title, const QStri setDefaultButton(QMessageBox::Cancel); yesButton = button(QMessageBox::Yes); updateYesButton(); - connect(&countDownTimer, SIGNAL(timeout()), this, SLOT(countDown())); + connect(&countDownTimer, &QTimer::timeout, this, &SendConfirmationDialog::countDown); } int SendConfirmationDialog::exec() diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index bb984a3b66..36b5d866c6 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -44,11 +44,11 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par ui->payTo_is->setFont(GUIUtil::fixedPitchFont()); // Connect signals - connect(ui->payAmount, SIGNAL(valueChanged()), this, SIGNAL(payAmountChanged())); - connect(ui->checkboxSubtractFeeFromAmount, SIGNAL(toggled(bool)), this, SIGNAL(subtractFeeFromAmountChanged())); - connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked())); - connect(ui->deleteButton_is, SIGNAL(clicked()), this, SLOT(deleteClicked())); - connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked())); + connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged); + connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged); + connect(ui->deleteButton, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); + connect(ui->deleteButton_is, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); + connect(ui->deleteButton_s, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); } SendCoinsEntry::~SendCoinsEntry() @@ -85,7 +85,7 @@ void SendCoinsEntry::setModel(WalletModel *_model) this->model = _model; if (_model && _model->getOptionsModel()) - connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); clear(); } diff --git a/src/qt/sendmpdialog.cpp b/src/qt/sendmpdialog.cpp index 60c1e5ec3f..1c7b6ebfbe 100644 --- a/src/qt/sendmpdialog.cpp +++ b/src/qt/sendmpdialog.cpp @@ -73,10 +73,10 @@ SendMPDialog::SendMPDialog(const PlatformStyle *platformStyle, QWidget *parent) #endif // connect actions - connect(ui->propertyComboBox, SIGNAL(activated(int)), this, SLOT(propertyComboBoxChanged(int))); - connect(ui->sendFromComboBox, SIGNAL(activated(int)), this, SLOT(sendFromComboBoxChanged(int))); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked())); - connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendButtonClicked())); + connect(ui->propertyComboBox, qOverload(&QComboBox::activated), this, &SendMPDialog::propertyComboBoxChanged); + connect(ui->sendFromComboBox, qOverload(&QComboBox::activated), this, &SendMPDialog::sendFromComboBoxChanged); + connect(ui->clearButton, &QPushButton::clicked, this, &SendMPDialog::clearButtonClicked); + connect(ui->sendButton, &QPushButton::clicked, this, &SendMPDialog::sendButtonClicked); // initial update balancesUpdated(); @@ -91,8 +91,8 @@ void SendMPDialog::setClientModel(ClientModel *model) { this->clientModel = model; if (model != NULL) { - connect(model, SIGNAL(refreshElysiumBalance()), this, SLOT(balancesUpdated())); - connect(model, SIGNAL(reinitElysiumState()), this, SLOT(balancesUpdated())); + connect(model, &ClientModel::refreshElysiumBalance, this, &SendMPDialog::balancesUpdated); + connect(model, &ClientModel::reinitElysiumState, this, &SendMPDialog::balancesUpdated); } } @@ -101,7 +101,7 @@ void SendMPDialog::setWalletModel(WalletModel *model) // use wallet model to get visibility into BTC balance changes for fees this->walletModel = model; if (model != NULL) { - connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(updateFrom())); + connect(model, &WalletModel::balanceChanged, this, &SendMPDialog::updateFrom); } } diff --git a/src/qt/sendtopcodedialog.cpp b/src/qt/sendtopcodedialog.cpp index de75359b28..9d39171037 100644 --- a/src/qt/sendtopcodedialog.cpp +++ b/src/qt/sendtopcodedialog.cpp @@ -91,11 +91,7 @@ void SendtoPcodeDialog::setModel(WalletModel *_model) std::pair lelantusBalance = model->getLelantusModel()->getPrivateBalance(); setLelantusBalance(lelantusBalance.first, lelantusBalance.second); - connect( - model, - SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, - SLOT(onBalanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount))); + connect(model, &WalletModel::balanceChanged, this, &SendtoPcodeDialog::onBalanceChanged); updateButtons(); @@ -239,7 +235,7 @@ void SendtoPcodeDialog::showEvent( QShowEvent* event ) { adjustSize(); ui->balanceSpacer->sizeHint().setHeight(ui->sendButton->size().height()); - QTimer::singleShot(10, this, SLOT(onWindowShown())); + QTimer::singleShot(10, this, &SendtoPcodeDialog::onWindowShown); } void SendtoPcodeDialog::setNotifTxId() diff --git a/src/qt/sigmacoincontroldialog.cpp b/src/qt/sigmacoincontroldialog.cpp index f7c284dd6f..f9800a3d7e 100644 --- a/src/qt/sigmacoincontroldialog.cpp +++ b/src/qt/sigmacoincontroldialog.cpp @@ -72,13 +72,13 @@ SigmaCoinControlDialog::SigmaCoinControlDialog(const PlatformStyle *platformStyl contextMenu->addAction(unlockAction); // context menu signals - connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); - connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); - connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); + connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &SigmaCoinControlDialog::showMenu); + connect(copyAddressAction, &QAction::triggered, this, &SigmaCoinControlDialog::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &SigmaCoinControlDialog::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &SigmaCoinControlDialog::copyAmount); + connect(copyTransactionHashAction, &QAction::triggered, this, &SigmaCoinControlDialog::copyTransactionHash); + connect(lockAction, &QAction::triggered, this, &SigmaCoinControlDialog::lockCoin); + connect(unlockAction, &QAction::triggered, this, &SigmaCoinControlDialog::unlockCoin); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -90,14 +90,13 @@ SigmaCoinControlDialog::SigmaCoinControlDialog(const PlatformStyle *platformStyl QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); - connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardBytes); + connect(clipboardLowOutputAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &SigmaCoinControlDialog::clipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); @@ -109,11 +108,11 @@ SigmaCoinControlDialog::SigmaCoinControlDialog(const PlatformStyle *platformStyl ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode - connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool))); - connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool))); + connect(ui->radioTreeMode, &QRadioButton::toggled, this, &SigmaCoinControlDialog::radioTreeMode); + connect(ui->radioListMode, &QRadioButton::toggled, this, &SigmaCoinControlDialog::radioListMode); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &SigmaCoinControlDialog::viewItemChanged); // click on header #if QT_VERSION < 0x050000 @@ -121,13 +120,13 @@ SigmaCoinControlDialog::SigmaCoinControlDialog(const PlatformStyle *platformStyl #else ui->treeWidget->header()->setSectionsClickable(true); #endif - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &SigmaCoinControlDialog::headerSectionClicked); // ok button - connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &SigmaCoinControlDialog::buttonBoxClicked); // (un)select all - connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &SigmaCoinControlDialog::buttonSelectAllClicked); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 diff --git a/src/qt/sigmadialog.cpp b/src/qt/sigmadialog.cpp index c936885cf0..cd5c09aa74 100644 --- a/src/qt/sigmadialog.cpp +++ b/src/qt/sigmadialog.cpp @@ -75,12 +75,12 @@ SigmaDialog::SigmaDialog(const PlatformStyle *platformStyle, QWidget *parent) : // init coin control section GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry())); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->addButton, &QPushButton::clicked, this, &SigmaDialog::addEntry); + connect(ui->clearButton, &QPushButton::clicked, this, &SigmaDialog::clear); // Coin Control - connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked())); - connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int))); - connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &))); + connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, &SigmaDialog::coinControlButtonClicked); + connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, &SigmaDialog::coinControlChangeChecked); + connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, this, &SigmaDialog::coinControlChangeEdited); // Coin Control: clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); @@ -90,14 +90,14 @@ SigmaDialog::SigmaDialog(const PlatformStyle *platformStyle, QWidget *parent) : QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardBytes())); - connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardPriority())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardBytes); + connect(clipboardPriorityAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardPriority); + connect(clipboardLowOutputAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &SigmaDialog::coinControlClipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); ui->labelCoinControlFee->addAction(clipboardFeeAction); @@ -107,11 +107,10 @@ SigmaDialog::SigmaDialog(const PlatformStyle *platformStyle, QWidget *parent) : ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); ui->labelCoinControlChange->addAction(clipboardChangeAction); - ui->amountToMint->setLocale(QLocale::c()); - connect(ui->amountToMint, SIGNAL(valueChanged(double)), this, SLOT(coinControlUpdateLabels())); + connect(ui->amountToMint, &BitcoinAmountField::valueChanged, this, &SigmaDialog::coinControlUpdateLabels); //check if user clicked at a tab - connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabSelected())); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &SigmaDialog::tabSelected); } void SigmaDialog::setClientModel(ClientModel *model) @@ -121,7 +120,7 @@ void SigmaDialog::setClientModel(ClientModel *model) if (model) { bool sigmaAllowed = sigma::IsSigmaAllowed(model->getNumBlocks()); - connect(model, SIGNAL(numBlocksChanged(int, const QDateTime&, double, bool)), this, SLOT(numBlocksChanged(int, const QDateTime&, double, bool))); + connect(model, &ClientModel::numBlocksChanged, this, &SigmaDialog::numBlocksChanged); ui->mintButton->setEnabled(sigmaAllowed); ui->sendButton->setEnabled(sigmaAllowed); @@ -133,12 +132,9 @@ void SigmaDialog::setWalletModel(WalletModel *model) this->walletModel = model; if (model && model->getOptionsModel()) { - connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, SLOT(updateMintableBalance())); - connect(model, SIGNAL(updateMintable()), this, SLOT(updateMintableBalance())); - updateMintableBalance(); - connect(model, SIGNAL(notifySigmaChanged(const std::vector, const std::vector)), - this, SLOT(updateCoins(const std::vector, const std::vector))); + connect(model, &WalletModel::balanceChanged, this, &SigmaDialog::updateMintableBalance); + connect(model, &WalletModel::updateMintable, this, &SigmaDialog::updateMintableBalance); + connect(model, &WalletModel::notifySigmaChanged, this, &SigmaDialog::updateCoins); model->checkSigmaAmount(true); for (int i = 0; i < ui->entries->count(); ++i) { SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget()); @@ -150,8 +146,8 @@ void SigmaDialog::setWalletModel(WalletModel *model) } // Coin Control - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool))); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SigmaDialog::coinControlUpdateLabels); + connect(model->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, this, &SigmaDialog::coinControlFeatureChanged); ui->frameCoinControl->setVisible(model->getOptionsModel()->getCoinControlFeatures()); coinControlUpdateLabels(); } @@ -475,9 +471,9 @@ SendCoinsEntry *SigmaDialog::addEntry() { SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this); entry->setModel(walletModel); ui->entries->addWidget(entry); - connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); - connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels())); - connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, SLOT(coinControlUpdateLabels())); + connect(entry, &SendCoinsEntry::removeEntry, this, &SigmaDialog::removeEntry); + connect(entry, &SendCoinsEntry::payAmountChanged, this, &SigmaDialog::coinControlUpdateLabels); + connect(entry, &SendCoinsEntry::subtractFeeFromAmountChanged, this, &SigmaDialog::coinControlUpdateLabels); // Focus the field, so that entry can start immediately entry->clear(); diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index 84ccfea730..afe4de1b66 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -37,8 +37,7 @@ X509 *parse_b64der_cert(const char* cert_data) static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector& data) { RecipientCatcher sigCatcher; - QObject::connect(server, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)), - &sigCatcher, SLOT(getRecipient(SendCoinsRecipient))); + QObject::connect(server, &PaymentServer::receivedPaymentRequest, &sigCatcher, &RecipientCatcher::getRecipient); // Write data to a temp file: QTemporaryFile f; @@ -55,8 +54,7 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vectoraddAction(copyTxIDAction); contextMenu->addAction(showDetailsAction); - connect(ui->tradeHistoryTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - connect(ui->tradeHistoryTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showDetails())); - connect(ui->hideInactiveTrades, SIGNAL(stateChanged(int)), this, SLOT(RepopulateTradeHistoryTable(int))); - connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); - connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); + connect(ui->tradeHistoryTable, &QWidget::customContextMenuRequested, this, &TradeHistoryDialog::contextualMenu); + connect(ui->tradeHistoryTable, &QAbstractItemView::doubleClicked, this, &TradeHistoryDialog::showDetails); + connect(ui->hideInactiveTrades, &QCheckBox::stateChanged, this, &TradeHistoryDialog::RepopulateTradeHistoryTable); + connect(copyTxIDAction, &QAction::triggered, this, &TradeHistoryDialog::copyTxID); + connect(showDetailsAction, &QAction::triggered, this, &TradeHistoryDialog::showDetails); } TradeHistoryDialog::~TradeHistoryDialog() diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 3eeef3786f..78e4fc4d99 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -30,7 +30,7 @@ TrafficGraphWidget::TrafficGraphWidget(QWidget *parent) : clientModel(0) { timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(updateRates())); + connect(timer, &QTimer::timeout, this, &TrafficGraphWidget::updateRates); } void TrafficGraphWidget::setClientModel(ClientModel *model) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index e3d25758a8..1013b7e960 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -247,8 +247,8 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle columns << QString() << QString() << QString() << tr("Date") << tr("Type") << tr("Address / Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); priv->refreshWallet(); - connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); - + connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit); + subscribeToCoreSignals(); } diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index bd38accdbd..3d86797da2 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -184,33 +183,32 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa contextMenu->addAction(resendAction); contextMenu->addAction(reconsiderBip47TxAction); - mapperThirdPartyTxUrls = new QSignalMapper(this); // Connect actions - connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString))); - - connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); - connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); - connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int))); - connect(instantsendWidget, SIGNAL(activated(int)), this, SLOT(chooseInstantSend(int))); - connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); - connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); - - connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); - connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - connect(view->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(updateHeaderSizes(int,int,int))); - - connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); - connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex())); - connect(copyTxPlainText, SIGNAL(triggered()), this, SLOT(copyTxPlainText())); - connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); - connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); - connect(resendAction, SIGNAL(triggered()), this, SLOT(rebroadcastTx())); - connect(reconsiderBip47TxAction, SIGNAL(triggered()), this, SLOT(reconsiderBip47Tx())); + + connect(dateWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseDate); + connect(typeWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseType); + connect(watchOnlyWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseWatchonly); + connect(instantsendWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseInstantSend); + connect(addressWidget, &QLineEdit::textChanged, this, &TransactionView::changedPrefix); + connect(amountWidget, &QLineEdit::textChanged, this, &TransactionView::changedAmount); + + connect(view, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); + connect(view, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu); + connect(view->horizontalHeader(), &QHeaderView::sectionResized, this, &TransactionView::updateHeaderSizes); + + connect(abandonAction, &QAction::triggered, this, &TransactionView::abandonTx); + connect(copyAddressAction, &QAction::triggered, this, &TransactionView::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &TransactionView::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &TransactionView::copyAmount); + connect(copyTxIDAction, &QAction::triggered, this, &TransactionView::copyTxID); + connect(copyTxHexAction, &QAction::triggered, this, &TransactionView::copyTxHex); + connect(copyTxPlainText, &QAction::triggered, this, &TransactionView::copyTxPlainText); + connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel); + connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails); + connect(this, &TransactionView::doubleClicked, this, &TransactionView::showDetails); + connect(resendAction, &QAction::triggered, this, &TransactionView::rebroadcastTx); + connect(reconsiderBip47TxAction, &QAction::triggered, this, &TransactionView::reconsiderBip47Tx); } void TransactionView::setModel(WalletModel *_model) @@ -250,15 +248,15 @@ void TransactionView::setModel(WalletModel *_model) QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); for (int i = 0; i < listUrls.size(); ++i) { - QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); + QString url = listUrls[i].trimmed(); + QString host = QUrl(url, QUrl::StrictMode).host(); if (!host.isEmpty()) { QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label if (i == 0) contextMenu->addSeparator(); contextMenu->addAction(thirdPartyTxUrlAction); - connect(thirdPartyTxUrlAction, SIGNAL(triggered()), mapperThirdPartyTxUrls, SLOT(map())); - mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed()); + connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); }); } } } @@ -267,7 +265,7 @@ void TransactionView::setModel(WalletModel *_model) updateWatchOnlyColumn(_model->haveWatchOnly()); // Watch-only signal - connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool))); + connect(_model, &WalletModel::notifyWatchonlyChanged, this, &TransactionView::updateWatchOnlyColumn); } } @@ -640,8 +638,8 @@ QWidget *TransactionView::createDateRangeWidget() dateRangeWidget->setVisible(false); // Notify on change - connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); - connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); + connect(dateFrom, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); + connect(dateTo, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); updateCalendarWidgets(); return dateRangeWidget; @@ -688,9 +686,9 @@ void TransactionView::resizeEvent(QResizeEvent* event) return; QWidget::resizeEvent(event); - disconnect(transactionView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(updateHeaderSizes(int,int,int))); + disconnect(transactionView->horizontalHeader(), &QHeaderView::sectionResized, this, &TransactionView::updateHeaderSizes); columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); - connect(transactionView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(updateHeaderSizes(int,int,int))); + connect(transactionView->horizontalHeader(), &QHeaderView::sectionResized, this, &TransactionView::updateHeaderSizes); } // Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index 958be234ec..6a0a806a2d 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -21,7 +21,6 @@ class QFrame; class QLineEdit; class QMenu; class QModelIndex; -class QSignalMapper; class QTableView; class QSpacerItem; class QHBoxLayout; @@ -76,7 +75,6 @@ class TransactionView : public QWidget QLineEdit *amountWidget; QMenu *contextMenu; - QSignalMapper *mapperThirdPartyTxUrls; QFrame *dateRangeWidget; QDateTimeEdit *dateFrom; diff --git a/src/qt/txhistorydialog.cpp b/src/qt/txhistorydialog.cpp index 15721475bc..7decc1c85c 100644 --- a/src/qt/txhistorydialog.cpp +++ b/src/qt/txhistorydialog.cpp @@ -109,13 +109,13 @@ TXHistoryDialog::TXHistoryDialog(QWidget *parent) : contextMenu->addAction(copyTxIDAction); contextMenu->addAction(showDetailsAction); // Connect actions - connect(ui->txHistoryTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - connect(ui->txHistoryTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showDetails())); - connect(ui->txHistoryTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(checkSort(int))); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); - connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); + connect(ui->txHistoryTable, &QWidget::customContextMenuRequested, this, &TXHistoryDialog::contextualMenu); + connect(ui->txHistoryTable, &QAbstractItemView::doubleClicked, this, &TXHistoryDialog::showDetails); + connect(ui->txHistoryTable->horizontalHeader(), &QHeaderView::sectionClicked, this, &TXHistoryDialog::checkSort); + connect(copyAddressAction, &QAction::triggered, this, &TXHistoryDialog::copyAddress); + connect(copyAmountAction, &QAction::triggered, this, &TXHistoryDialog::copyAmount); + connect(copyTxIDAction, &QAction::triggered, this, &TXHistoryDialog::copyTxID); + connect(showDetailsAction, &QAction::triggered, this, &TXHistoryDialog::showDetails); // Perform initial population and update of history table UpdateHistory(); @@ -163,9 +163,9 @@ void TXHistoryDialog::setClientModel(ClientModel *model) { this->clientModel = model; if (model != NULL) { - connect(model, SIGNAL(refreshElysiumBalance()), this, SLOT(UpdateHistory())); - connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(UpdateConfirmations())); - connect(model, SIGNAL(reinitElysiumState()), this, SLOT(ReinitTXHistoryTable())); + connect(model, &ClientModel::refreshElysiumBalance, this, &TXHistoryDialog::UpdateHistory); + connect(model, &ClientModel::numBlocksChanged, this, &TXHistoryDialog::UpdateConfirmations); + connect(model, &ClientModel::reinitElysiumState, this, &TXHistoryDialog::ReinitTXHistoryTable); } } diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 3c8d13fe0f..21b38c56d7 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -55,9 +55,9 @@ bool WalletFrame::addWallet(const QString& name, WalletModel *walletModel) mapWalletViews[name] = walletView; // Ensure a walletView is able to show the main window - connect(walletView, SIGNAL(showNormalIfMinimized()), gui, SLOT(showNormalIfMinimized())); + connect(walletView, &WalletView::showNormalIfMinimized, [this]{ gui->showNormalIfMinimized(); }); - connect(walletView, SIGNAL(outOfSyncWarningClicked()), this, SLOT(outOfSyncWarningClicked())); + connect(walletView, &WalletView::outOfSyncWarningClicked, this, &WalletFrame::outOfSyncWarningClicked); // Ensure walletview is able to response to resize and move events gui->installEventFilter(walletView); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 0206c16eb8..9c72d9bbcd 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -64,7 +64,7 @@ WalletModel::WalletModel(const PlatformStyle *platformStyle, CWallet *_wallet, O // This timer will be fired repeatedly to update the balance pollTimer = new QTimer(this); - connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged())); + connect(pollTimer, &QTimer::timeout, this, &WalletModel::pollBalanceChanged); pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); @@ -881,7 +881,7 @@ bool WalletModel::lockWallet() void WalletModel::lockWalletDelayed(int seconds) { - QTimer::singleShot(seconds * 1000, this, SLOT(lockWallet())); + QTimer::singleShot(seconds * 1000, this, &WalletModel::lockWallet); } bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass) diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 5b3b3c6c5d..7d085f9203 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -115,9 +115,10 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): addWidget(masternodeListPage); // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page - connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(focusBitcoinHistoryTab(QModelIndex))); + connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::focusBitcoinHistoryTab); + #ifdef ENABLE_ELYSIUM - connect(overviewPage, SIGNAL(elysiumTransactionClicked(uint256)), this, SLOT(focusElysiumTransaction(uint256))); + connect(overviewPage, &OverviewPage::elysiumTransactionClicked, this, &WalletView::focusElysiumTransaction); #endif } @@ -130,8 +131,7 @@ void WalletView::setupTransactionPage() // Create Firo transactions list firoTransactionList = new TransactionView(platformStyle); - connect(firoTransactionList, SIGNAL(doubleClicked(QModelIndex)), firoTransactionList, SLOT(showDetails())); - connect(firoTransactionList, SIGNAL(message(QString, QString, unsigned int)), this, SIGNAL(message(QString, QString, unsigned int))); + connect(firoTransactionList, &TransactionView::message, this, &WalletView::message); // Create export panel for Firo transactions auto exportButton = new QPushButton(tr("&Export")); @@ -142,7 +142,7 @@ void WalletView::setupTransactionPage() exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export")); } - connect(exportButton, SIGNAL(clicked()), firoTransactionList, SLOT(exportClicked())); + connect(exportButton, &QPushButton::clicked, firoTransactionList, &TransactionView::exportClicked); auto exportLayout = new QHBoxLayout(); exportLayout->addStretch(); @@ -153,8 +153,8 @@ void WalletView::setupTransactionPage() firoLayout->addWidget(firoTransactionList); firoLayout->addLayout(exportLayout); // TODO: fix this - //connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); - connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, SLOT(requestedSyncWarningInfo())); + connect(overviewPage, &OverviewPage::transactionClicked, firoTransactionList, qOverload(&TransactionView::focusTransaction)); + connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo); firoTransactionsView = new QWidget(); firoTransactionsView->setLayout(firoLayout); @@ -187,7 +187,7 @@ void WalletView::setupSendCoinPage() { sendFiroView = new SendCoinsDialog(platformStyle); - connect(sendFiroView, SIGNAL(message(QString, QString, unsigned int)), this, SIGNAL(message(QString, QString, unsigned int))); + connect(sendFiroView, &SendCoinsDialog::message, this, &WalletView::message); #ifdef ENABLE_ELYSIUM // Create tab for coin type @@ -220,7 +220,7 @@ void WalletView::setupSigmaPage() if (pwalletMain->IsHDSeedAvailable()) { sigmaView = new SigmaDialog(platformStyle); - connect(sigmaView, SIGNAL(message(QString, QString, unsigned int)), this, SIGNAL(message(QString, QString, unsigned int))); + connect(sigmaView, &SigmaDialog::message, this, &WalletView::message); pageLayout->addWidget(sigmaView); sigmaPage->setLayout(pageLayout); } else { @@ -236,11 +236,7 @@ void WalletView::setupLelantusPage() if (pwalletMain->IsHDSeedAvailable()) { lelantusView = new LelantusDialog(platformStyle); - connect(lelantusView, - SIGNAL(message(QString, QString, unsigned int)), - this, - SIGNAL(message(QString, QString, unsigned int))); - + connect(lelantusView, &LelantusDialog::message, this, &WalletView::message); pageLayout->addWidget(lelantusView); } else { @@ -278,22 +274,24 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui) if (gui) { // Clicking on a transaction on the overview page simply sends you to transaction history page - connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoBitcoinHistoryTab())); + connect(overviewPage, &OverviewPage::transactionClicked, gui, &BitcoinGUI::gotoHistoryPage); #ifdef ENABLE_ELYSIUM - connect(overviewPage, SIGNAL(elysiumTransactionClicked(uint256)), gui, SLOT(gotoElysiumHistoryTab())); + connect(overviewPage, &OverviewPage::elysiumTransactionClicked, gui, &BitcoinGUI::gotoElysiumHistoryTab); #endif // Receive and report messages - connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int))); + connect(this, &WalletView::message, [gui](const QString &title, const QString &message, unsigned int style) { + gui->message(title, message, style); + }); // Pass through encryption status changed signals - connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int))); + connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::setEncryptionStatus); // Pass through transaction notifications - connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString,QString))); + connect(this, &WalletView::incomingTransaction, gui, &BitcoinGUI::incomingTransaction); // Connect HD enabled state signal - connect(this, SIGNAL(hdEnabledStatusChanged(int)), gui, SLOT(setHDStatus(int))); + connect(this, &WalletView::hdEnabledStatusChanged, gui, &BitcoinGUI::setHDStatus); } } @@ -358,40 +356,35 @@ void WalletView::setWalletModel(WalletModel *_walletModel) if (_walletModel) { // Receive and pass through messages from wallet model - connect(_walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int))); + connect(_walletModel, &WalletModel::message, this, &WalletView::message); // Handle changes in encryption status - connect(_walletModel, SIGNAL(encryptionStatusChanged(int)), this, SIGNAL(encryptionStatusChanged(int))); + connect(_walletModel, &WalletModel::encryptionStatusChanged, this, &WalletView::encryptionStatusChanged); updateEncryptionStatus(); // update HD status Q_EMIT hdEnabledStatusChanged(_walletModel->hdEnabled()); // Balloon pop-up for new transaction - connect(_walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(processNewTransaction(QModelIndex,int,int))); + connect(_walletModel->getTransactionTableModel(), &TransactionTableModel::rowsInserted, this, &WalletView::processNewTransaction); // Ask for passphrase if needed - connect(_walletModel, SIGNAL(requireUnlock(QString)), this, SLOT(unlockWallet(QString))); + connect(_walletModel, &WalletModel::requireUnlock, this, &WalletView::unlockWallet); // Show progress dialog - connect(_walletModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int))); + connect(_walletModel, &WalletModel::showProgress, this, &WalletView::showProgress); // Check mintable amount - connect(_walletModel, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), - this, SLOT(checkMintableAmount(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount))); + connect(_walletModel, &WalletModel::balanceChanged, this, &WalletView::checkMintableAmount); auto lelantusModel = _walletModel->getLelantusModel(); if (lelantusModel) { - connect(lelantusModel, SIGNAL(askMintAll(AutoMintMode)), this, SLOT(askMintAll(AutoMintMode))); + connect(lelantusModel, &LelantusModel::askMintAll, this, &WalletView::askMintAll); auto autoMintModel = lelantusModel->getAutoMintModel(); - connect(autoMintModel, SIGNAL(message(QString,QString,unsigned int)), - this, SIGNAL(message(QString,QString,unsigned int))); - connect(autoMintModel, SIGNAL(requireShowAutomintNotification()), - this, SLOT(showAutomintNotification())); - connect(autoMintModel, SIGNAL(closeAutomintNotification()), - this, SLOT(closeAutomintNotification())); + connect(autoMintModel, &AutoMintModel::message, this, &WalletView::message); + connect(autoMintModel, &AutoMintModel::requireShowAutomintNotification, this, &WalletView::showAutomintNotification); + connect(autoMintModel, &AutoMintModel::closeAutomintNotification, this, &WalletView::closeAutomintNotification); } } }