Skip to content

Commit b7adb32

Browse files
committed
Change connect syntax to Qt 5 standard for bitcoingui.cpp
1 parent 3349bd4 commit b7adb32

File tree

3 files changed

+81
-67
lines changed

3 files changed

+81
-67
lines changed

src/qt/bitcoingui.cpp

Lines changed: 75 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,26 @@ BitcoinGUI::BitcoinGUI(QWidget* parent)
207207
statusBar()->setSizeGripEnabled(false);
208208

209209
// Clicking on a transaction on the overview page simply sends you to transaction history page
210-
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
211-
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
210+
connect(overviewPage, &OverviewPage::transactionClicked, this, &BitcoinGUI::gotoHistoryPage);
211+
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, &TransactionView::focusTransaction);
212212

213213
// Clicking on the current poll label on the overview page simply sends you to the voting page
214-
connect(overviewPage, SIGNAL(pollLabelClicked()), this, SLOT(gotoVotingPage()));
214+
connect(overviewPage, &OverviewPage::pollLabelClicked, this, &BitcoinGUI::gotoVotingPage);
215215

216216
// Double-clicking on a transaction on the transaction history page shows details
217-
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
217+
connect(transactionView, &TransactionView::doubleClicked, transactionView, &TransactionView::showDetails);
218218

219219
rpcConsole = new RPCConsole(this);
220-
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
220+
connect(openRPCConsoleAction, &QAction::triggered, rpcConsole, &QWidget::show);
221221

222222
diagnosticsDialog = new DiagnosticsDialog(this);
223223

224224
// Clicking on "Verify Message" in the address book sends you to the verify message tab
225-
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
225+
connect(addressBookPage, &FavoritesPage::verifyMessage, this, &BitcoinGUI::gotoVerifyMessageTab);
226226
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
227-
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
227+
connect(receiveCoinsPage, &ReceiveCoinsPage::signMessage, this, &BitcoinGUI::gotoSignMessageTab);
228228

229-
connect(openConfigAction, SIGNAL(triggered()), this, SLOT(openConfigClicked()));
229+
connect(openConfigAction, &QAction::triggered, this, &BitcoinGUI::openConfigClicked);
230230

231231
gotoOverviewPage();
232232
}
@@ -336,23 +336,23 @@ void BitcoinGUI::createActions()
336336
boincAction->setStatusTip(tr("Gridcoin rewards distributed computing with BOINC"));
337337
boincAction->setMenuRole(QAction::TextHeuristicRole);
338338

339-
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
340-
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
341-
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
342-
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
343-
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
344-
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
345-
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
346-
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
347-
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
348-
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
349-
connect(votingAction, SIGNAL(triggered()), this, SLOT(gotoVotingPage()));
350-
351-
connect(websiteAction, SIGNAL(triggered()), this, SLOT(websiteClicked()));
352-
connect(bxAction, SIGNAL(triggered()), this, SLOT(bxClicked()));
353-
connect(exchangeAction, SIGNAL(triggered()), this, SLOT(exchangeClicked()));
354-
connect(boincAction, SIGNAL(triggered()), this, SLOT(boincStatsClicked()));
355-
connect(chatAction, SIGNAL(triggered()), this, SLOT(chatClicked()));
339+
connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized);
340+
connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::gotoOverviewPage);
341+
connect(sendCoinsAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized);
342+
connect(sendCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoSendCoinsPage);
343+
connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized);
344+
connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage);
345+
connect(historyAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized);
346+
connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage);
347+
connect(addressBookAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized);
348+
connect(addressBookAction, &QAction::triggered, this, &BitcoinGUI::gotoAddressBookPage);
349+
connect(votingAction, &QAction::triggered, this, &BitcoinGUI::gotoVotingPage);
350+
351+
connect(websiteAction, &QAction::triggered, this, &BitcoinGUI::websiteClicked);
352+
connect(bxAction, &QAction::triggered, this, &BitcoinGUI::bxClicked);
353+
connect(exchangeAction, &QAction::triggered, this, &BitcoinGUI::exchangeClicked);
354+
connect(boincAction, &QAction::triggered, this, &BitcoinGUI::boincStatsClicked);
355+
connect(chatAction, &QAction::triggered, this, &BitcoinGUI::chatClicked);
356356

357357
quitAction = new QAction(tr("E&xit"), this);
358358
quitAction->setToolTip(tr("Quit application"));
@@ -407,21 +407,21 @@ void BitcoinGUI::createActions()
407407
resetblockchainAction = new QAction(tr("&Reset blockchain data"), this);
408408
resetblockchainAction->setToolTip(tr("Remove blockchain data and start chain from zero"));
409409

410-
connect(quitAction, SIGNAL(triggered()), this, SLOT(tryQuit()));
411-
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
412-
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
413-
connect(researcherAction, SIGNAL(triggered()), this, SLOT(researcherClicked()));
414-
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
415-
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
416-
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
417-
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
418-
connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet()));
419-
connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet()));
420-
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
421-
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
422-
connect(diagnosticsAction, SIGNAL(triggered()), this, SLOT(diagnosticsClicked()));
423-
connect(snapshotAction, SIGNAL(triggered()), this, SLOT(snapshotClicked()));
424-
connect(resetblockchainAction, SIGNAL(triggered()), this, SLOT(resetblockchainClicked()));
410+
connect(quitAction, &QAction::triggered, this, &BitcoinGUI::tryQuit);
411+
connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked);
412+
connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked);
413+
connect(researcherAction, &QAction::triggered, this, &BitcoinGUI::researcherClicked);
414+
connect(toggleHideAction, &QAction::triggered, this, &BitcoinGUI::toggleHidden);
415+
connect(encryptWalletAction, &QAction::triggered, this, &BitcoinGUI::encryptWallet);
416+
connect(backupWalletAction, &QAction::triggered, this, &BitcoinGUI::backupWallet);
417+
connect(changePassphraseAction, &QAction::triggered, this, &BitcoinGUI::changePassphrase);
418+
connect(unlockWalletAction, &QAction::triggered, this, &BitcoinGUI::unlockWallet);
419+
connect(lockWalletAction, &QAction::triggered, this, &BitcoinGUI::lockWallet);
420+
connect(signMessageAction, &QAction::triggered, this, &BitcoinGUI::gotoSignMessageTabDefault);
421+
connect(verifyMessageAction, &QAction::triggered, this, &BitcoinGUI::gotoVerifyMesageTabDefault);
422+
connect(diagnosticsAction, &QAction::triggered, this, &BitcoinGUI::diagnosticsClicked);
423+
connect(snapshotAction, &QAction::triggered, this, &BitcoinGUI::snapshotClicked);
424+
connect(resetblockchainAction, &QAction::triggered, this, &BitcoinGUI::resetblockchainClicked);
425425
}
426426

427427
void BitcoinGUI::setIcons()
@@ -734,28 +734,28 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
734734

735735
// set stylesheet
736736
setOptionsStyleSheet(this->clientModel->getOptionsModel()->getCurrentStyle());
737-
connect(this->clientModel->getOptionsModel(),SIGNAL(walletStylesheetChanged(QString)),this,SLOT(setOptionsStyleSheet(QString)));
737+
connect(this->clientModel->getOptionsModel(), &OptionsModel::walletStylesheetChanged,
738+
this, &BitcoinGUI::setOptionsStyleSheet);
738739

739740
// Keep up to date with client
740741
setNumConnections(clientModel->getNumConnections());
741-
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
742+
connect(clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections);
742743

743744
setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
744-
connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
745+
connect(clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
745746

746747
setDifficulty(clientModel->getDifficulty());
747-
connect(clientModel, SIGNAL(difficultyChanged(double)), this, SLOT(setDifficulty(double)));
748+
connect(clientModel, &ClientModel::difficultyChanged, this, &BitcoinGUI::setDifficulty);
748749

749750
setMinerStatus(false, 0.0, 0.0, 0.0);
750-
connect(clientModel, SIGNAL(minerStatusChanged(bool, double, double, double)),
751-
this, SLOT(setMinerStatus(bool, double, double, double)));
751+
connect(clientModel, &ClientModel::minerStatusChanged, this, &BitcoinGUI::setMinerStatus);
752752

753753
// Start with out-of-sync message for scraper/NN.
754754
updateScraperIcon((int)scrapereventtypes::OutOfSync, CT_UPDATING);
755-
connect(clientModel, SIGNAL(updateScraperStatus(int, int)), this, SLOT(updateScraperIcon(int, int)));
755+
connect(clientModel, &ClientModel::updateScraperStatus, this, &BitcoinGUI::updateScraperIcon);
756756

757757
// Report errors from network/worker thread
758-
connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
758+
connect(clientModel, &ClientModel::error, this, &BitcoinGUI::error);
759759

760760
rpcConsole->setClientModel(clientModel);
761761
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
@@ -786,14 +786,14 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
786786
signVerifyMessageDialog->setModel(walletModel);
787787

788788
setEncryptionStatus(walletModel->getEncryptionStatus());
789-
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
789+
connect(walletModel, &WalletModel::encryptionStatusChanged, this, &BitcoinGUI::setEncryptionStatus);
790790

791791
// Balloon pop-up for new transaction
792-
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
793-
this, SLOT(incomingTransaction(QModelIndex,int,int)));
792+
connect(walletModel->getTransactionTableModel(), &TransactionTableModel::rowsInserted,
793+
this, &BitcoinGUI::incomingTransaction);
794794

795795
// Ask for passphrase if needed
796-
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
796+
connect(walletModel, &WalletModel::requireUnlock, this, &BitcoinGUI::unlockWallet);
797797
}
798798
}
799799

@@ -809,7 +809,7 @@ void BitcoinGUI::setResearcherModel(ResearcherModel *researcherModel)
809809
diagnosticsDialog->SetResearcherModel(researcherModel);
810810

811811
updateBeaconIcon();
812-
connect(researcherModel, SIGNAL(beaconChanged()), this, SLOT(updateBeaconIcon()));
812+
connect(researcherModel, &ResearcherModel::beaconChanged, this, &BitcoinGUI::updateBeaconIcon);
813813
}
814814

815815
void BitcoinGUI::setVotingModel(VotingModel *votingModel)
@@ -823,7 +823,7 @@ void BitcoinGUI::setVotingModel(VotingModel *votingModel)
823823

824824
overviewPage->setCurrentPollTitle(votingModel->getCurrentPollTitle());
825825

826-
connect(votingModel, SIGNAL(newPollReceived()), this, SLOT(handleNewPoll()));
826+
connect(votingModel, &VotingModel::newPollReceived, this, &BitcoinGUI::handleNewPoll);
827827
}
828828

829829
void BitcoinGUI::createTrayIcon()
@@ -848,8 +848,7 @@ void BitcoinGUI::createTrayIconMenu()
848848
trayIconMenu = new QMenu(this);
849849
trayIcon->setContextMenu(trayIconMenu);
850850

851-
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
852-
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
851+
connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated);
853852
#else
854853
// Note: On Mac, the dock icon is used to provide the tray's functionality.
855854
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
@@ -1098,7 +1097,7 @@ void BitcoinGUI::update(const QString &title, const QString& version, const QStr
10981097
// Due to slight delay in gui load this could appear behind the gui ui
10991098
// The only other option available would make the message box stay on top of all applications
11001099

1101-
QTimer::singleShot(5000, updateMessageDialog.get(), SLOT(show()));
1100+
QTimer::singleShot(5000, updateMessageDialog.get(), [this]() { updateMessageDialog->show(); });
11021101
}
11031102

11041103
void BitcoinGUI::changeEvent(QEvent *e)
@@ -1347,7 +1346,7 @@ void BitcoinGUI::gotoOverviewPage()
13471346
centralWidget->setCurrentWidget(overviewPage);
13481347

13491348
exportAction->setEnabled(false);
1350-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1349+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
13511350
}
13521351

13531352
void BitcoinGUI::gotoHistoryPage()
@@ -1356,8 +1355,8 @@ void BitcoinGUI::gotoHistoryPage()
13561355
centralWidget->setCurrentWidget(transactionView);
13571356

13581357
exportAction->setEnabled(true);
1359-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1360-
connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
1358+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
1359+
connect(exportAction, &QAction::triggered, transactionView, &TransactionView::exportClicked);
13611360
}
13621361

13631362
void BitcoinGUI::gotoAddressBookPage()
@@ -1366,8 +1365,8 @@ void BitcoinGUI::gotoAddressBookPage()
13661365
centralWidget->setCurrentWidget(addressBookPage);
13671366

13681367
exportAction->setEnabled(true);
1369-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1370-
connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
1368+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
1369+
connect(exportAction, &QAction::triggered, addressBookPage, &FavoritesPage::exportClicked);
13711370
}
13721371

13731372
void BitcoinGUI::gotoReceiveCoinsPage()
@@ -1376,8 +1375,8 @@ void BitcoinGUI::gotoReceiveCoinsPage()
13761375
centralWidget->setCurrentWidget(receiveCoinsPage);
13771376

13781377
exportAction->setEnabled(true);
1379-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1380-
connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
1378+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
1379+
connect(exportAction, &QAction::triggered, receiveCoinsPage, &ReceiveCoinsPage::exportClicked);
13811380
}
13821381

13831382
void BitcoinGUI::gotoSendCoinsPage()
@@ -1386,7 +1385,7 @@ void BitcoinGUI::gotoSendCoinsPage()
13861385
centralWidget->setCurrentWidget(sendCoinsPage);
13871386

13881387
exportAction->setEnabled(false);
1389-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1388+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
13901389
}
13911390

13921391
void BitcoinGUI::gotoVotingPage()
@@ -1395,7 +1394,7 @@ void BitcoinGUI::gotoVotingPage()
13951394
centralWidget->setCurrentWidget(votingPage);
13961395

13971396
exportAction->setEnabled(false);
1398-
disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr);
1397+
disconnect(exportAction, &QAction::triggered, nullptr, nullptr);
13991398
}
14001399

14011400
void BitcoinGUI::gotoSignMessageTab(QString addr)
@@ -1407,6 +1406,11 @@ void BitcoinGUI::gotoSignMessageTab(QString addr)
14071406
signVerifyMessageDialog->setAddress_SM(addr);
14081407
}
14091408

1409+
void BitcoinGUI::gotoSignMessageTabDefault()
1410+
{
1411+
gotoSignMessageTab(QString {});
1412+
}
1413+
14101414
void BitcoinGUI::gotoVerifyMessageTab(QString addr)
14111415
{
14121416
// call show() in showTab_VM()
@@ -1416,6 +1420,11 @@ void BitcoinGUI::gotoVerifyMessageTab(QString addr)
14161420
signVerifyMessageDialog->setAddress_VM(addr);
14171421
}
14181422

1423+
void BitcoinGUI::gotoVerifyMesageTabDefault()
1424+
{
1425+
gotoVerifyMessageTab(QString {});
1426+
}
1427+
14191428
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
14201429
{
14211430
// Accept only URIs

src/qt/bitcoingui.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,13 @@ private slots:
221221

222222
/** Show Sign/Verify Message dialog and switch to sign message tab */
223223
void gotoSignMessageTab(QString addr = "");
224+
/** Show Sign/Verify Message dialog and switch to sign message tab with no address */
225+
void gotoSignMessageTabDefault();
226+
224227
/** Show Sign/Verify Message dialog and switch to verify message tab */
225228
void gotoVerifyMessageTab(QString addr = "");
229+
/** Show Sign/Verify Message dialog and switch to verify message tab with no address */
230+
void gotoVerifyMesageTabDefault();
226231

227232
/** Show configuration dialog */
228233
void optionsClicked();

src/qt/transactionview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class TransactionView : public QFrame
6161
private slots:
6262
void contextualMenu(const QPoint &);
6363
void dateRangeChanged();
64-
void showDetails();
6564
void copyAddress();
6665
void editLabel();
6766
void copyLabel();
@@ -73,6 +72,7 @@ private slots:
7372
void doubleClicked(const QModelIndex&);
7473

7574
public slots:
75+
void showDetails();
7676
void chooseDate(int idx);
7777
void chooseType(int idx);
7878
void changedPrefix(const QString &prefix);

0 commit comments

Comments
 (0)