diff --git a/.travis/lint_06_script.sh b/.travis/lint_06_script.sh new file mode 100755 index 000000000..d44445bfc --- /dev/null +++ b/.travis/lint_06_script.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2018 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +export LC_ALL=C + + +contrib/devtools/git-subtree-check.sh src/secp256k1 +contrib/devtools/git-subtree-check.sh src/univalue +contrib/devtools/git-subtree-check.sh src/leveldb +contrib/devtools/check-doc.py +contrib/devtools/logprint-scanner.py + +if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then + contrib/devtools/lint-whitespace.sh + test/lint/lint-qt.sh +fi diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 0ff7e72bf..453702642 100755 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -48,7 +48,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget* parent) : QDialog setWindowTitle(tr("Choose the address to receive coins with")); break; } - connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept())); + connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setFocus(); ui->closeButton->setText(tr("C&hoose")); @@ -92,14 +92,14 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget* parent) : QDialog 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() @@ -137,11 +137,11 @@ void AddressBookPage::setModel(AddressTableModel* model) ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch); ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents); - 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 32bf10b7a..abfc04a67 100755 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -130,12 +130,12 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel ui->labelTitle->setText(title); textChanged(); - connect(btnWatch, SIGNAL(clicked()), this, SLOT(onWatchClicked())); - 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->pushButtonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); + connect(btnWatch, &QCheckBox::clicked, this, &AskPassphraseDialog::onWatchClicked); + connect(ui->passEdit1, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->passEdit2, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->passEdit3, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->pushButtonOk, &QPushButton::clicked, this, &AskPassphraseDialog::accept); + connect(ui->btnEsc, &QPushButton::clicked, this, &AskPassphraseDialog::close); } void AskPassphraseDialog::onWatchClicked() diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index b0b62251a..c9bd193e8 100755 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -31,7 +31,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 @@ -213,8 +213,8 @@ BitcoinAmountField::BitcoinAmountField(QWidget* parent) : 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, static_cast(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged); // Set default based on configuration unitChanged(unit->currentIndex()); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index d607229d4..4814406b6 100755 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -45,11 +45,11 @@ ClientModel::ClientModel(OptionsModel* optionsModel, QObject* parent) : QObject( 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); pollMnTimer = new QTimer(this); - connect(pollMnTimer, SIGNAL(timeout()), this, SLOT(updateMnTimer())); + connect(pollMnTimer, &QTimer::timeout, this, &ClientModel::updateMnTimer); // no need to update as frequent as data for balances/txes/blocks pollMnTimer->start(MODEL_UPDATE_DELAY * 4); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 472887aa5..171101f33 100755 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -116,7 +116,7 @@ class ClientModel : public QObject void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); //! Fired when a message should be reported to the user - void message(const QString& title, const QString& message, unsigned int style); + void message(const QString& title, const QString& message, unsigned int style, bool* ret = nullptr); // Show progress dialog e.g. for verifychain void showProgress(const QString& title, int nProgress); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index e45ae72ec..9cd2fde47 100755 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -100,7 +100,7 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q ui->btnEsc->setProperty("cssClass", "ic-close"); ui->pushButtonOk->setProperty("cssClass", "btn-primary"); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnEsc, &QPushButton::clicked, this, &CoinControlDialog::close); this->fMultisigEnabled = fMultisigEnabled; @@ -123,13 +123,13 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q 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 setCssProperty({ @@ -159,24 +159,24 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q } // 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 ui->treeWidget->header()->setSectionsClickable(true); - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &CoinControlDialog::headerSectionClicked); // ok button - connect(ui->pushButtonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(ui->pushButtonOk, &QPushButton::clicked, this, &CoinControlDialog::accept); // (un)select all - connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &CoinControlDialog::buttonSelectAllClicked); // Toggle lock state - connect(ui->pushButtonToggleLock, SIGNAL(clicked()), this, SLOT(buttonToggleLockClicked())); + connect(ui->pushButtonToggleLock, &QPushButton::clicked, this, &CoinControlDialog::buttonToggleLockClicked); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 diff --git a/src/qt/governancepage.cpp b/src/qt/governancepage.cpp index ddce27548..0ee0b44d6 100644 --- a/src/qt/governancepage.cpp +++ b/src/qt/governancepage.cpp @@ -29,7 +29,7 @@ GovernancePage::GovernancePage(QWidget* parent) : QWidget(parent), ui->setupUi(this); timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(updateProposalList())); + connect(timer, &QTimer::timeout, this, &GovernancePage::updateProposalList); timer->start(100000); fLockUpdating = false; } diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 97a9ea1a9..1d1fd7cdc 100755 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -486,15 +486,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 8e7ebe963..2831d275d 100755 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -129,8 +129,8 @@ Intro::Intro(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::W setCssBtnPrimary(ui->pushButtonOk); setCssBtnSecondary(ui->pushButtonCancel); - connect(ui->pushButtonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui->pushButtonCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->pushButtonOk, &QPushButton::clicked, this, &Intro::accept); + connect(ui->pushButtonCancel, &QPushButton::clicked, this, &Intro::close); ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(BLOCK_CHAIN_SIZE / GB_BYTES)); startThread(); @@ -290,11 +290,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/openuridialog.cpp b/src/qt/openuridialog.cpp index 9e44e00cb..a63bba3ef 100755 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -32,8 +32,8 @@ OpenURIDialog::OpenURIDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystem setCssProperty(ui->pushButtonCancel, "btn-dialog-cancel"); initCssEditLine(ui->uriEdit, true); - connect(ui->pushButtonOK, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui->pushButtonCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->pushButtonOK, &QPushButton::clicked, this, &OpenURIDialog::accept); + connect(ui->pushButtonCancel, &QPushButton::clicked, this, &OpenURIDialog::close); } void OpenURIDialog::showEvent(QShowEvent *event) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 0c89219cf..b62ba6f4e 100755 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -55,8 +55,8 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) : QDialog(paren ui->proxyPort->setEnabled(false); ui->proxyPort->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, &QCheckBox::toggled, ui->proxyIp, &QWidget::setEnabled); + connect(ui->connectSocks, &QCheckBox::toggled, ui->proxyPort, &QWidget::setEnabled); ui->proxyIp->installEventFilter(this); ui->proxyPort->installEventFilter(this); @@ -137,7 +137,7 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) : QDialog(paren mapper->setOrientation(Qt::Vertical); /* setup/change UI elements when proxy IP is invalid/valid */ - connect(this, SIGNAL(proxyIpChecks(QValidatedLineEdit*, QLineEdit*)), this, SLOT(doProxyIpChecks(QValidatedLineEdit*, QLineEdit*))); + connect(this, &OptionsDialog::proxyIpChecks, this, &OptionsDialog::doProxyIpChecks); } OptionsDialog::~OptionsDialog() @@ -163,27 +163,24 @@ void OptionsDialog::setModel(OptionsModel* model) mapper->setModel(model); setMapper(); mapper->toFirst(); - - /* keep consistency for action triggered elsewhere */ - connect(model, SIGNAL(hideOrphansChanged(bool)), this, SLOT(updateHideOrphans(bool))); } /* 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, static_cast(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); + connect(ui->threadsScriptVerif, static_cast(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); /* Wallet */ - connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); + connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Network */ - connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); - connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); + connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); + connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Display */ - connect(ui->digits, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); - connect(ui->theme, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); - connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); - connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString&)), this, SLOT(showRestartWarning())); - connect(ui->showFundamentalnodesTab, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); + connect(ui->digits, static_cast(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); + connect(ui->theme, static_cast(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); + connect(ui->lang, static_cast(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); + connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); + connect(ui->showFundamentalnodesTab, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); } void OptionsDialog::setMapper() @@ -290,7 +287,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/paymentserver.cpp b/src/qt/paymentserver.cpp index 0d7d430ae..3c5c9ff21 100755 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -287,8 +287,8 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(p QMessageBox::critical(0, tr("Payment request error"), tr("Cannot start vitae: 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); } } } @@ -338,10 +338,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() @@ -424,8 +422,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 74c18ceb2..cea608ad3 100755 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -119,7 +119,7 @@ PeerTableModel::PeerTableModel(ClientModel* parent) : QAbstractTableModel(parent // set up timer for auto refresh timer = new QTimer(); - 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 a08ca46ed..b581eac09 100755 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -13,7 +13,7 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget* parent) : QLineEdit(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 e14647c50..45f5df36c 100755 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -8,7 +8,7 @@ QValueComboBox::QValueComboBox(QWidget* parent) : QComboBox(parent), role(Qt::UserRole) { - connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); + connect(this, static_cast(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); } QVariant QValueComboBox::value() const diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index 5ff933fcc..2dfa5a872 100755 --- 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("Address") << 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/rpcconsole.cpp b/src/qt/rpcconsole.cpp index f114a26b1..c128d4fd9 100755 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -85,19 +85,18 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase { Q_OBJECT public: - QtRPCTimerBase(boost::function& func, int64_t millis): - func(func) + QtRPCTimerBase(boost::function& _func, int64_t millis): + func(_func) { timer.setSingleShot(true); - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + connect(&timer, &QTimer::timeout, [this]{ func(); }); timer.start(millis); } ~QtRPCTimerBase() {} -private Q_SLOTS: - void timeout() { func(); } + private: QTimer timer; - boost::function func; + std::function func; }; class QtRPCTimerInterface: public RPCTimerInterface @@ -271,17 +270,17 @@ RPCConsole::RPCConsole(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHi ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); - connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear())); + connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear); + connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); // Wallet Repair Buttons - connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(walletSalvage())); - connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(walletRescan())); - connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(walletZaptxes1())); - connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(walletZaptxes2())); - connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(walletUpgrade())); - connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(walletReindex())); - connect(ui->btn_resync, SIGNAL(clicked()), this, SLOT(walletResync())); + connect(ui->btn_salvagewallet, &QPushButton::clicked, this, &RPCConsole::walletSalvage); + connect(ui->btn_rescan, &QPushButton::clicked, this, &RPCConsole::walletRescan); + connect(ui->btn_zapwallettxes1, &QPushButton::clicked, this, &RPCConsole::walletZaptxes1); + connect(ui->btn_zapwallettxes2, &QPushButton::clicked, this, &RPCConsole::walletZaptxes2); + connect(ui->btn_upgradewallet, &QPushButton::clicked, this, &RPCConsole::walletUpgrade); + connect(ui->btn_reindex, &QPushButton::clicked, this, &RPCConsole::walletReindex); + connect(ui->btn_resync, &QPushButton::clicked, this, &RPCConsole::walletResync); // set library version labels #ifdef ENABLE_WALLET @@ -386,19 +385,19 @@ 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()); - connect(model, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); + connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks); setFundamentalnodeCount(model->getFundamentalnodeCountString()); - connect(model, SIGNAL(strFundamentalnodesChanged(QString)), this, SLOT(setFundamentalnodeCount(QString))); + connect(model, &ClientModel::strFundamentalnodesChanged, this, &RPCConsole::setFundamentalnodeCount); setMasternodeCount(model->getMasternodeCountString()); - connect(model, SIGNAL(strMasternodesChanged(QString)), this, SLOT(setMasternodeCount(QString))); + connect(model, &ClientModel::strMasternodesChanged, this, &RPCConsole::setMasternodeCount); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); - connect(model, SIGNAL(bytesChanged(quint64, quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); + connect(model, &ClientModel::bytesChanged, this, &RPCConsole::updateTrafficStats); // set up peer table ui->peerWidget->setModel(model->getPeerTableModel()); @@ -435,21 +434,20 @@ void RPCConsole::setClientModel(ClientModel* model) 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, signalMapper, static_cast(&QSignalMapper::map)); + connect(banAction24h, &QAction::triggered, signalMapper, static_cast(&QSignalMapper::map)); + connect(banAction7d, &QAction::triggered, signalMapper, static_cast(&QSignalMapper::map)); + connect(banAction365d, &QAction::triggered, signalMapper, static_cast(&QSignalMapper::map)); + connect(signalMapper, static_cast(&QSignalMapper::mapped), this, &RPCConsole::banSelectedNode); // 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); // set up ban table ui->banlistWidget->setModel(model->getBanTableModel()); @@ -470,13 +468,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 @@ -737,17 +735,17 @@ 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, static_cast(&RPCConsole::message)); // Requests from this object must go to executor - connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(TEMPrequest(QString))); + connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::TEMPrequest); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread - connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); - connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); + connect(this, &RPCConsole::stopExecutor, executor, &RPCExecutor::deleteLater); + connect(this, &RPCConsole::stopExecutor, thread, &QThread::quit); // Queue the thread for deletion (in this thread) when it is finished - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + connect(thread, &QThread::finished, thread, &QThread::deleteLater); // 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 7806151d9..3f46a8bbf 100755 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -82,7 +82,8 @@ public Q_SLOTS: void walletResync(); void reject(); - 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 number of blocks shown in the UI */ diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index 9b3c474bf..27ee1df95 100755 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -33,8 +33,8 @@ 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; @@ -51,8 +51,8 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vectorgetOptionsModel()->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/vitae.cpp b/src/qt/vitae.cpp index 5042877fd..6acc66bf9 100755 --- a/src/qt/vitae.cpp +++ b/src/qt/vitae.cpp @@ -359,7 +359,7 @@ void BitcoinApplication::createWindow(const NetworkStyle* networkStyle) window = new VITAEGUI(networkStyle, 0); pollShutdownTimer = new QTimer(window); - connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown())); + connect(pollShutdownTimer, &QTimer::timeout, window, &PIVXGUI::detectShutdown); pollShutdownTimer->start(200); } @@ -370,7 +370,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle* networkStyle) // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually. splash->setAttribute(Qt::WA_DeleteOnClose); splash->show(); - connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*))); + connect(this, &BitcoinApplication::splashFinished, splash, &Splash::slotFinish); + connect(this, &BitcoinApplication::requestedShutdown, splash, &QWidget::close); } bool BitcoinApplication::createTutorialScreen() @@ -401,15 +402,15 @@ 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(window, SIGNAL(requestedRestart(QStringList)), executor, SLOT(restart(QStringList))); + 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); + connect(window, &PIVXGUI::requestedRestart, executor, &BitcoinCore::restart); /* 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(); } @@ -471,8 +472,8 @@ void BitcoinApplication::initializeResult(int retval) window->addWallet(VITAEGUI::DEFAULT_WALLET, walletModel); window->setCurrentWallet(VITAEGUI::DEFAULT_WALLET); - connect(walletModel, SIGNAL(coinsSent(CWallet*, SendCoinsRecipient, QByteArray)), - paymentServer, SLOT(fetchPaymentACK(CWallet*, const SendCoinsRecipient&, QByteArray))); + connect(walletModel, &WalletModel::coinsSent, + paymentServer, &PaymentServer::fetchPaymentACK); } #endif @@ -487,12 +488,12 @@ void BitcoinApplication::initializeResult(int retval) #ifdef ENABLE_WALLET // Now that initialization/startup is done, process any command-line // VITAE: 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))); + connect(paymentServer, &PaymentServer::receivedPaymentRequest, + window, &VITAEGUI::handlePaymentRequest); + connect(window, &VITAEGUI::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, SLOT(uiReady())); #endif } else { diff --git a/src/qt/vitae/addnewcontactdialog.cpp b/src/qt/vitae/addnewcontactdialog.cpp index cc1927d05..db7856e8c 100644 --- a/src/qt/vitae/addnewcontactdialog.cpp +++ b/src/qt/vitae/addnewcontactdialog.cpp @@ -35,9 +35,9 @@ AddNewContactDialog::AddNewContactDialog(QWidget *parent) : ui->btnOk->setText(tr("SAVE")); ui->btnOk->setProperty("cssClass", "btn-primary"); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnOk, SIGNAL(clicked()), this, SLOT(ok())); + connect(ui->btnEsc, &QPushButton::clicked, this, &AddNewContactDialog::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &AddNewContactDialog::close); + connect(ui->btnOk, &QPushButton::clicked, this, &AddNewContactDialog::ok); } void AddNewContactDialog::setTexts(QString title, const char* message) { diff --git a/src/qt/vitae/addresseswidget.cpp b/src/qt/vitae/addresseswidget.cpp index 6abb6c68e..9d1ca9ddb 100644 --- a/src/qt/vitae/addresseswidget.cpp +++ b/src/qt/vitae/addresseswidget.cpp @@ -123,9 +123,9 @@ AddressesWidget::AddressesWidget(VITAEGUI* parent) : ui->btnSave->setText(tr("SAVE")); setCssBtnPrimary(ui->btnSave); - connect(ui->listAddresses, SIGNAL(clicked(QModelIndex)), this, SLOT(handleAddressClicked(QModelIndex))); - connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(onStoreContactClicked())); - connect(ui->btnAddContact, SIGNAL(clicked()), this, SLOT(onAddContactShowHideClicked())); + connect(ui->listAddresses, &QListView::clicked, this, &AddressesWidget::handleAddressClicked); + connect(ui->btnSave, &QPushButton::clicked, this, &AddressesWidget::onStoreContactClicked); + connect(ui->btnAddContact, &OptionButton::clicked, this, &AddressesWidget::onAddContactShowHideClicked); } void AddressesWidget::handleAddressClicked(const QModelIndex &index){ @@ -140,9 +140,9 @@ void AddressesWidget::handleAddressClicked(const QModelIndex &index){ if(!this->menu){ this->menu = new TooltipMenu(window, this); connect(this->menu, &TooltipMenu::message, this, &AddressesWidget::message); - connect(this->menu, SIGNAL(onEditClicked()), this, SLOT(onEditClicked())); - connect(this->menu, SIGNAL(onDeleteClicked()), this, SLOT(onDeleteClicked())); - connect(this->menu, SIGNAL(onCopyClicked()), this, SLOT(onCopyClicked())); + connect(this->menu, &TooltipMenu::onEditClicked, this, &AddressesWidget::onEditClicked); + connect(this->menu, &TooltipMenu::onDeleteClicked, this, &AddressesWidget::onDeleteClicked); + connect(this->menu, &TooltipMenu::onCopyClicked, this, &AddressesWidget::onCopyClicked); }else { this->menu->hide(); } diff --git a/src/qt/vitae/coincontrolvitwidget.cpp b/src/qt/vitae/coincontrolvitwidget.cpp index 9de61cd49..2b1921975 100644 --- a/src/qt/vitae/coincontrolvitwidget.cpp +++ b/src/qt/vitae/coincontrolvitwidget.cpp @@ -78,8 +78,8 @@ CoinControlVitWidget::CoinControlVitWidget(QWidget *parent) : ui->btnSave->setText("SAVE"); ui->btnSave->setProperty("cssClass", "btn-primary"); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnEsc, &QPushButton::clicked, this, &CoinControlPivWidget::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &CoinControlPivWidget::close); } diff --git a/src/qt/vitae/coldstakingwidget.cpp b/src/qt/vitae/coldstakingwidget.cpp index 4e320bf7d..f15f2dce1 100644 --- a/src/qt/vitae/coldstakingwidget.cpp +++ b/src/qt/vitae/coldstakingwidget.cpp @@ -121,7 +121,7 @@ ColdStakingWidget::ColdStakingWidget(VITAEGUI* parent) : setCssBtnPrimary(ui->pushButtonSend); setCssBtnSecondary(ui->pushButtonClear); - connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(clearAll())); + connect(ui->pushButtonClear, &QPushButton::clicked, this, &ColdStakingWidget::clearAll); ui->labelEditTitle->setText(tr("Cold Staking address")); setCssProperty(ui->labelEditTitle, "text-title"); @@ -145,8 +145,8 @@ ColdStakingWidget::ColdStakingWidget(VITAEGUI* parent) : ui->btnColdStaking->setSubTitleClassAndText("text-subtitle", "Creates an address to receive delegated coins\nand stake them on their owner's behalf."); ui->btnColdStaking->layout()->setMargin(0); - connect(ui->btnCoinControl, SIGNAL(clicked()), this, SLOT(onCoinControlClicked())); - connect(ui->btnColdStaking, SIGNAL(clicked()), this, SLOT(onColdStakeClicked())); + connect(ui->btnCoinControl, &OptionButton::clicked, this, &ColdStakingWidget::onCoinControlClicked); + connect(ui->btnColdStaking, &OptionButton::clicked, this, &ColdStakingWidget::onColdStakeClicked); onDelegateSelected(true); ui->pushRight->setChecked(true); @@ -194,9 +194,9 @@ ColdStakingWidget::ColdStakingWidget(VITAEGUI* parent) : connect(ui->pushButtonSend, &QPushButton::clicked, this, &ColdStakingWidget::onSendClicked); connect(btnOwnerContact, &QAction::triggered, [this](){ onContactsClicked(true); }); - connect(ui->listView, SIGNAL(clicked(QModelIndex)), this, SLOT(handleAddressClicked(QModelIndex))); - connect(ui->listViewStakingAddress, SIGNAL(clicked(QModelIndex)), this, SLOT(handleMyColdAddressClicked(QModelIndex))); - connect(ui->btnMyStakingAddresses, SIGNAL(clicked()), this, SLOT(onMyStakingAddressesClicked())); + connect(ui->listView, &QListView::clicked, this, &ColdStakingWidget::handleAddressClicked); + connect(ui->listViewStakingAddress, &QListView::clicked, this, &ColdStakingWidget::handleMyColdAddressClicked); + connect(ui->btnMyStakingAddresses, &OptionButton::clicked, this, &ColdStakingWidget::onMyStakingAddressesClicked); } void ColdStakingWidget::loadWalletModel() @@ -591,8 +591,8 @@ void ColdStakingWidget::handleMyColdAddressClicked(const QModelIndex &_index) menuAddresses->setCopyBtnVisible(false); menuAddresses->adjustSize(); connect(menuAddresses, &TooltipMenu::message, this, &AddressesWidget::message); - connect(menuAddresses, SIGNAL(onEditClicked()), this, SLOT(onAddressCopyClicked())); - connect(menuAddresses, SIGNAL(onDeleteClicked()), this, SLOT(onAddressEditClicked())); + connect(menuAddresses, &TooltipMenu::onEditClicked, this, &ColdStakingWidget::onAddressCopyClicked); + connect(menuAddresses, &TooltipMenu::onDeleteClicked, this, &ColdStakingWidget::onAddressEditClicked); } else { menuAddresses->hide(); } @@ -624,10 +624,10 @@ void ColdStakingWidget::handleAddressClicked(const QModelIndex &rIndex) this->menu->setFixedHeight(157); this->menu->setMinimumWidth(125); connect(this->menu, &TooltipMenu::message, this, &AddressesWidget::message); - connect(this->menu, SIGNAL(onEditClicked()), this, SLOT(onEditClicked())); - connect(this->menu, SIGNAL(onDeleteClicked()), this, SLOT(onDeleteClicked())); - connect(this->menu, SIGNAL(onCopyClicked()), this, SLOT(onLabelClicked())); - connect(this->menu, SIGNAL(onLastClicked()), this, SLOT(onCopyOwnerClicked())); + connect(this->menu, &TooltipMenu::onEditClicked, this, &ColdStakingWidget::onEditClicked); + connect(this->menu, &TooltipMenu::onDeleteClicked, this, &ColdStakingWidget::onDeleteClicked); + //connect(this->menu, &TooltipMenu::onCopyClicked, this, &ColdStakingWidget::onLabelClicked); + connect(this->menu, &TooltipMenu::onLastClicked, this, &ColdStakingWidget::onCopyOwnerClicked); } else { this->menu->hide(); } diff --git a/src/qt/vitae/contactsdropdown.cpp b/src/qt/vitae/contactsdropdown.cpp index 8a755a384..de4f771e4 100644 --- a/src/qt/vitae/contactsdropdown.cpp +++ b/src/qt/vitae/contactsdropdown.cpp @@ -78,7 +78,7 @@ ContactsDropdown::ContactsDropdown(int minWidth, int minHeight, PWidget *parent) list->setAttribute(Qt::WA_MacShowFocusRect, false); list->setSelectionBehavior(QAbstractItemView::SelectRows); - connect(list, SIGNAL(clicked(QModelIndex)), this, SLOT(handleClick(QModelIndex))); + connect(list, &QListView::clicked, this, &ContactsDropdown::handleClick); } void ContactsDropdown::setWalletModel(WalletModel* _model, const QString& type){ diff --git a/src/qt/vitae/dashboardwidget.cpp b/src/qt/vitae/dashboardwidget.cpp index 74492192b..e1d4491ca 100644 --- a/src/qt/vitae/dashboardwidget.cpp +++ b/src/qt/vitae/dashboardwidget.cpp @@ -85,20 +85,24 @@ DashboardWidget::DashboardWidget(VITAEGUI* parent) : setCssProperty(ui->pushButtonChartArrow, "btn-chart-arrow"); setCssProperty(ui->pushButtonChartRight, "btn-chart-arrow-right"); - connect(ui->comboBoxYears, SIGNAL(currentIndexChanged(const QString&)), this,SLOT(onChartYearChanged(const QString&))); +#ifdef USE_QTCHARTS + connect(ui->comboBoxYears, static_cast(&QComboBox::currentIndexChanged), + this, &DashboardWidget::onChartYearChanged); +#endif // USE_QTCHARTS // Sort Transactions SortEdit* lineEdit = new SortEdit(ui->comboBoxSort); connect(lineEdit, &SortEdit::Mouse_Pressed, [this](){ui->comboBoxSort->showPopup();}); setSortTx(ui->comboBoxSort, lineEdit); - connect(ui->comboBoxSort, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onSortChanged(const QString&))); + connect(ui->comboBoxSort, static_cast(&QComboBox::currentIndexChanged), this, &DashboardWidget::onSortChanged); // Sort type SortEdit* lineEditType = new SortEdit(ui->comboBoxSortType); connect(lineEditType, &SortEdit::Mouse_Pressed, [this](){ui->comboBoxSortType->showPopup();}); setSortTxTypeFilter(ui->comboBoxSortType, lineEditType); ui->comboBoxSortType->setCurrentIndex(0); - connect(ui->comboBoxSortType, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onSortTypeChanged(const QString&))); + connect(ui->comboBoxSortType, static_cast(&QComboBox::currentIndexChanged), + this, &DashboardWidget::onSortTypeChanged); // Transactions setCssProperty(ui->listTransactions, "container"); @@ -139,9 +143,7 @@ DashboardWidget::DashboardWidget(VITAEGUI* parent) : ui->emptyContainerChart->setVisible(true); setShadow(ui->layoutShadow); - connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); - if (window) - connect(window, SIGNAL(windowResizeEvent(QResizeEvent*)), this, SLOT(windowResizeEvent(QResizeEvent*))); + connect(ui->listTransactions, &QListView::clicked, this, &DashboardWidget::handleTransactionClicked); bool hasCharts = false; #ifdef USE_QTCHARTS @@ -151,6 +153,8 @@ bool hasCharts = false; connect(ui->pushButtonYear, &QPushButton::clicked, [this](){setChartShow(YEAR);}); connect(ui->pushButtonMonth, &QPushButton::clicked, [this](){setChartShow(MONTH);}); connect(ui->pushButtonAll, &QPushButton::clicked, [this](){setChartShow(ALL);}); + if (window) + connect(window, &PIVXGUI::windowResizeEvent, this, &DashboardWidget::windowResizeEvent); #endif if (hasCharts) { @@ -199,13 +203,12 @@ void DashboardWidget::loadWalletModel(){ ui->comboBoxSort->setVisible(false); } - connect(ui->pushImgEmpty, SIGNAL(clicked()), window, SLOT(openFAQ())); - connect(ui->btnHowTo, SIGNAL(clicked()), window, SLOT(openFAQ())); + connect(ui->pushImgEmpty, &QPushButton::clicked, window, &PIVXGUI::openFAQ); + connect(ui->btnHowTo, &QPushButton::clicked, window, &PIVXGUI::openFAQ); connect(txModel, &TransactionTableModel::txArrived, this, &DashboardWidget::onTxArrived); // Notification pop-up for new transaction - connect(txModel, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(processNewTransaction(QModelIndex, int, int))); + connect(txModel, &TransactionTableModel::rowsInserted, this, &DashboardWidget::processNewTransaction); #ifdef USE_QTCHARTS // chart filter stakesFilter = new TransactionFilterProxy(); @@ -364,7 +367,8 @@ void DashboardWidget::loadChart(){ yearFilter = currentDate.year(); for (int i = 1; i < 13; ++i) ui->comboBoxMonths->addItem(QString(monthsNames[i-1]), QVariant(i)); ui->comboBoxMonths->setCurrentIndex(monthFilter - 1); - connect(ui->comboBoxMonths, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onChartMonthChanged(const QString&))); + connect(ui->comboBoxMonths, static_cast(&QComboBox::currentIndexChanged), + this, &DashboardWidget::onChartMonthChanged); connect(ui->pushButtonChartArrow, &QPushButton::clicked, [this](){ onChartArrowClicked(true); }); connect(ui->pushButtonChartRight, &QPushButton::clicked, [this](){ onChartArrowClicked(false); }); } @@ -756,7 +760,7 @@ void DashboardWidget::onChartArrowClicked(bool goLeft) { refreshChart(); } -void DashboardWidget::windowResizeEvent(QResizeEvent *event){ +void DashboardWidget::windowResizeEvent(QResizeEvent* event) { if (hasStakes && axisX) { if (width() > 1300) { if (isChartMin) { diff --git a/src/qt/vitae/dashboardwidget.h b/src/qt/vitae/dashboardwidget.h index eef4c2eb6..c36cb2a61 100644 --- a/src/qt/vitae/dashboardwidget.h +++ b/src/qt/vitae/dashboardwidget.h @@ -125,7 +125,7 @@ private Q_SLOTS: void onTxArrived(const QString& hash, const bool& isCoinStake, const bool& isCSAnyType); #ifdef USE_QTCHARTS - void windowResizeEvent(QResizeEvent *event); + void windowResizeEvent(QResizeEvent* event); void changeChartColors(); void onChartYearChanged(const QString&); void onChartMonthChanged(const QString&); diff --git a/src/qt/vitae/defaultdialog.cpp b/src/qt/vitae/defaultdialog.cpp index d04373749..d62df164b 100644 --- a/src/qt/vitae/defaultdialog.cpp +++ b/src/qt/vitae/defaultdialog.cpp @@ -35,8 +35,8 @@ DefaultDialog::DefaultDialog(QWidget *parent) : ui->btnSave->setText("OK"); ui->btnSave->setProperty("cssClass", "btn-primary"); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnEsc, &QPushButton::clicked, this, &DefaultDialog::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &DefaultDialog::close); connect(ui->btnSave, &QPushButton::clicked, this, &DefaultDialog::accept); } diff --git a/src/qt/vitae/expandablebutton.cpp b/src/qt/vitae/expandablebutton.cpp index 2041e4eba..1ec44e3ce 100644 --- a/src/qt/vitae/expandablebutton.cpp +++ b/src/qt/vitae/expandablebutton.cpp @@ -21,7 +21,7 @@ ExpandableButton::ExpandableButton(QWidget *parent) : ui->pushButton->setCheckable(true); this->layout()->setSizeConstraint(QLayout::SetFixedSize); - connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(mousePressEvent())); + connect(ui->pushButton, &QPushButton::clicked, this, &ExpandableButton::mousePressEvent); } void ExpandableButton::setButtonClassStyle(const char *name, const QVariant &value, bool forceUpdate) @@ -104,11 +104,6 @@ void ExpandableButton::mousePressEvent(){ Q_EMIT Mouse_Pressed(); } -void ExpandableButton::mousePressEvent(QMouseEvent *ev) -{ - Q_EMIT Mouse_Pressed(); -} - void ExpandableButton::on_pushButton_clicked(bool checked) { // TODO: Add callback event diff --git a/src/qt/vitae/expandablebutton.h b/src/qt/vitae/expandablebutton.h index aa8e35055..588ade919 100644 --- a/src/qt/vitae/expandablebutton.h +++ b/src/qt/vitae/expandablebutton.h @@ -53,9 +53,6 @@ public Q_SLOTS: virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); - //virtual void mouseMoveEvent(QMouseEvent *ev); - virtual void mousePressEvent(QMouseEvent *ev); - private Q_SLOTS: void on_pushButton_clicked(bool checked); diff --git a/src/qt/vitae/loadingdialog.cpp b/src/qt/vitae/loadingdialog.cpp index 223713fb1..2c1f34292 100644 --- a/src/qt/vitae/loadingdialog.cpp +++ b/src/qt/vitae/loadingdialog.cpp @@ -47,7 +47,7 @@ LoadingDialog::LoadingDialog(QWidget *parent) : void LoadingDialog::execute(Runnable *runnable, int type){ loadingTimer = new QTimer(this); - connect(loadingTimer, SIGNAL(timeout()), this, SLOT(loadingTextChange())); + connect(loadingTimer, &QTimer::timeout, this, &LoadingDialog::loadingTextChange); loadingTimer->start(250); QThread* thread = new QThread; diff --git a/src/qt/vitae/lockunlock.cpp b/src/qt/vitae/lockunlock.cpp index 2592770a7..cf4940027 100644 --- a/src/qt/vitae/lockunlock.cpp +++ b/src/qt/vitae/lockunlock.cpp @@ -28,9 +28,9 @@ LockUnlock::LockUnlock(QWidget *parent) : ui->pushButtonStaking->setText(tr("Staking Only")); // Connect - connect(ui->pushButtonUnlocked, SIGNAL(clicked()), this, SLOT(onUnlockClicked())); - connect(ui->pushButtonLocked, SIGNAL(clicked()), this, SLOT(onLockClicked())); - connect(ui->pushButtonStaking, SIGNAL(clicked()), this, SLOT(onStakingClicked())); + connect(ui->pushButtonUnlocked, &QPushButton::clicked, this, &LockUnlock::onUnlockClicked); + connect(ui->pushButtonLocked, &QPushButton::clicked, this, &LockUnlock::onLockClicked); + connect(ui->pushButtonStaking, &QPushButton::clicked, this, &LockUnlock::onStakingClicked); } LockUnlock::~LockUnlock() diff --git a/src/qt/vitae/masternodeswidget.cpp b/src/qt/vitae/masternodeswidget.cpp index 168f99579..d84e48d84 100644 --- a/src/qt/vitae/masternodeswidget.cpp +++ b/src/qt/vitae/masternodeswidget.cpp @@ -124,14 +124,14 @@ MasterNodesWidget::MasterNodesWidget(VITAEGUI *parent) : ui->labelEmpty->setText(tr("No active Masternode yet")); setCssProperty(ui->labelEmpty, "text-empty"); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onCreateMNClicked())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &MasterNodesWidget::onCreateMNClicked); connect(ui->pushButtonStartAll, &QPushButton::clicked, [this]() { onStartAllClicked(REQUEST_START_ALL); }); connect(ui->pushButtonStartMissing, &QPushButton::clicked, [this]() { onStartAllClicked(REQUEST_START_MISSING); }); - connect(ui->listMn, SIGNAL(clicked(QModelIndex)), this, SLOT(onMNClicked(QModelIndex))); + connect(ui->listMn, &QListView::clicked, this, &MasterNodesWidget::onMNClicked); connect(ui->btnAbout, &OptionButton::clicked, [this](){window->openFAQ(9);}); connect(ui->btnAboutController, &OptionButton::clicked, [this](){window->openFAQ(10);}); } @@ -181,9 +181,9 @@ void MasterNodesWidget::onMNClicked(const QModelIndex &index) this->menu->setDeleteBtnText(tr("Delete")); this->menu->setCopyBtnText(tr("Info")); connect(this->menu, &TooltipMenu::message, this, &AddressesWidget::message); - connect(this->menu, SIGNAL(onEditClicked()), this, SLOT(onEditMNClicked())); - connect(this->menu, SIGNAL(onDeleteClicked()), this, SLOT(onDeleteMNClicked())); - connect(this->menu, SIGNAL(onCopyClicked()), this, SLOT(onInfoMNClicked())); + connect(this->menu, &TooltipMenu::onEditClicked, this, &MasterNodesWidget::onEditMNClicked); + connect(this->menu, &TooltipMenu::onDeleteClicked, this, &MasterNodesWidget::onDeleteMNClicked); + connect(this->menu, &TooltipMenu::onCopyClicked, this, &MasterNodesWidget::onInfoMNClicked); this->menu->adjustSize(); } else { this->menu->hide(); diff --git a/src/qt/vitae/masternodewizarddialog.cpp b/src/qt/vitae/masternodewizarddialog.cpp index 3a54cefaa..29e17ffd2 100644 --- a/src/qt/vitae/masternodewizarddialog.cpp +++ b/src/qt/vitae/masternodewizarddialog.cpp @@ -88,9 +88,9 @@ MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *pare ui->btnBack->setText(tr("BACK")); setCssProperty(ui->pushButtonSkip, "ic-close"); - connect(ui->pushButtonSkip, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnNext, SIGNAL(clicked()), this, SLOT(onNextClicked())); - connect(ui->btnBack, SIGNAL(clicked()), this, SLOT(onBackClicked())); + connect(ui->pushButtonSkip, &QPushButton::clicked, this, &MasterNodeWizardDialog::close); + connect(ui->btnNext, &QPushButton::clicked, this, &MasterNodeWizardDialog::onNextClicked); + connect(ui->btnBack, &QPushButton::clicked, this, &MasterNodeWizardDialog::onBackClicked); } void MasterNodeWizardDialog::showEvent(QShowEvent *event) diff --git a/src/qt/vitae/mninfodialog.cpp b/src/qt/vitae/mninfodialog.cpp index 6c29ca20e..597af9f70 100644 --- a/src/qt/vitae/mninfodialog.cpp +++ b/src/qt/vitae/mninfodialog.cpp @@ -23,7 +23,7 @@ MnInfoDialog::MnInfoDialog(QWidget *parent) : setCssTextBodyDialog({ui->textAmount, ui->textAddress, ui->textInputs, ui->textStatus, ui->textId, ui->textExport}); setCssProperty({ui->pushCopy, ui->pushCopyId, ui->pushExport}, "ic-copy-big"); setCssProperty(ui->btnEsc, "ic-close"); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(closeDialog())); + connect(ui->btnEsc, &QPushButton::clicked, this, &MnInfoDialog::closeDialog); connect(ui->pushCopy, &QPushButton::clicked, [this](){ copyInform(pubKey, "Masternode public key copied"); }); connect(ui->pushCopyId, &QPushButton::clicked, [this](){ copyInform(txId, "Collateral tx id copied"); }); connect(ui->pushExport, &QPushButton::clicked, [this](){ exportMN = true; accept(); }); diff --git a/src/qt/vitae/navmenuwidget.cpp b/src/qt/vitae/navmenuwidget.cpp index 39e812a70..493f5907f 100644 --- a/src/qt/vitae/navmenuwidget.cpp +++ b/src/qt/vitae/navmenuwidget.cpp @@ -79,7 +79,7 @@ void NavMenuWidget::loadWalletModel() { if (walletModel->getZerocoinBalance() > 0) { ui->btnPrivacy->setText("PRIVACY\n"); ui->btnPrivacy->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - connect(ui->btnPrivacy,SIGNAL(clicked()),this, SLOT(onPrivacyClicked())); + connect(ui->btnPrivacy, &QPushButton::clicked, this, &NavMenuWidget::onPrivacyClicked); } else { ui->btnPrivacy->setVisible(false); } @@ -93,14 +93,14 @@ void NavMenuWidget::loadWalletModel() { * Actions */ void NavMenuWidget::connectActions() { - connect(ui->btnDashboard,SIGNAL(clicked()),this, SLOT(onDashboardClicked())); - connect(ui->btnSend,SIGNAL(clicked()),this, SLOT(onSendClicked())); - connect(ui->btnAddress,SIGNAL(clicked()),this, SLOT(onAddressClicked())); - connect(ui->btnFundamental,SIGNAL(clicked()),this, SLOT(onFundamentalNodesClicked())); - connect(ui->btnMaster,SIGNAL(clicked()),this, SLOT(onMasterNodesClicked())); - connect(ui->btnSettings,SIGNAL(clicked()),this, SLOT(onSettingsClicked())); - connect(ui->btnReceive,SIGNAL(clicked()),this, SLOT(onReceiveClicked())); - connect(ui->btnColdStaking,SIGNAL(clicked()),this, SLOT(onColdStakingClicked())); + connect(ui->btnDashboard, &QPushButton::clicked, this, &NavMenuWidget::onDashboardClicked); + connect(ui->btnSend, &QPushButton::clicked, this, &NavMenuWidget::onSendClicked); + connect(ui->btnAddress, &QPushButton::clicked, this, &NavMenuWidget::onAddressClicked); + connect(ui->btnFundamental,&QPushButton::clicked,this, &NavMenuWidget::onFundamentalNodesClicked); + connect(ui->btnMaster, &QPushButton::clicked, this, &NavMenuWidget::onMasterNodesClicked); + connect(ui->btnSettings, &QPushButton::clicked, this, &NavMenuWidget::onSettingsClicked); + connect(ui->btnReceive, &QPushButton::clicked, this, &NavMenuWidget::onReceiveClicked); + connect(ui->btnColdStaking, &QPushButton::clicked, this, &NavMenuWidget::onColdStakingClicked); ui->btnDashboard->setShortcut(QKeySequence(SHORT_KEY + Qt::Key_1)); ui->btnSend->setShortcut(QKeySequence(SHORT_KEY + Qt::Key_2)); diff --git a/src/qt/vitae/privacywidget.cpp b/src/qt/vitae/privacywidget.cpp index 417b00f64..e530471d1 100644 --- a/src/qt/vitae/privacywidget.cpp +++ b/src/qt/vitae/privacywidget.cpp @@ -128,10 +128,10 @@ PrivacyWidget::PrivacyWidget(VITAEGUI* parent) : ui->btnResetZerocoin->setTitleClassAndText("btn-title-grey", "Reset Spent zVIT"); ui->btnResetZerocoin->setSubTitleClassAndText("text-subtitle", "Reset zerocoin database."); - connect(ui->btnTotalzVIT, SIGNAL(clicked()), this, SLOT(onTotalZvitClicked())); - connect(ui->btnCoinControl, SIGNAL(clicked()), this, SLOT(onCoinControlClicked())); - connect(ui->btnRescanMints, SIGNAL(clicked()), this, SLOT(onRescanMintsClicked())); - connect(ui->btnResetZerocoin, SIGNAL(clicked()), this, SLOT(onResetZeroClicked())); + connect(ui->btnTotalzVIT, &OptionButton::clicked, this, &PrivacyWidget::onTotalZvitClicked); + connect(ui->btnCoinControl, &OptionButton::clicked, this, &PrivacyWidget::onCoinControlClicked); + connect(ui->btnRescanMints, &OptionButton::clicked, this, &PrivacyWidget::onRescanMintsClicked); + connect(ui->btnResetZerocoin, &OptionButton::clicked, this, &PrivacyWidget::onResetZeroClicked); ui->pushRight->setChecked(true); connect(ui->pushLeft, &QPushButton::clicked, [this](){onMintSelected(false);}); @@ -183,7 +183,7 @@ void PrivacyWidget::loadWalletModel() showList(); } - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onSendClicked())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &PrivacyWidget::onSendClicked); } } diff --git a/src/qt/vitae/pwidget.cpp b/src/qt/vitae/pwidget.cpp index d56b11c99..6f039d6d6 100644 --- a/src/qt/vitae/pwidget.cpp +++ b/src/qt/vitae/pwidget.cpp @@ -14,7 +14,7 @@ PWidget::PWidget(PWidget* parent) : QWidget(parent), window(parent->getWindow()) void PWidget::init() { if (window) - connect(window, SIGNAL(themeChanged(bool, QString&)), this, SLOT(onChangeTheme(bool, QString&))); + connect(window, &PIVXGUI::themeChanged, this, &PWidget::onChangeTheme); } void PWidget::setClientModel(ClientModel* model) diff --git a/src/qt/vitae/receivedialog.cpp b/src/qt/vitae/receivedialog.cpp index ddcd2a46a..0e4f8400a 100644 --- a/src/qt/vitae/receivedialog.cpp +++ b/src/qt/vitae/receivedialog.cpp @@ -50,8 +50,8 @@ ReceiveDialog::ReceiveDialog(QWidget *parent) : ui->btnCancel->setVisible(false); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(onCopy())); + connect(ui->btnEsc, &QPushButton::clicked, this, &ReceiveDialog::close); + connect(ui->btnSave, &QPushButton::clicked, this, &ReceiveDialog::onCopy); } void ReceiveDialog::updateQr(QString address){ diff --git a/src/qt/vitae/receivewidget.cpp b/src/qt/vitae/receivewidget.cpp index e1deabb0b..8e6b63e09 100644 --- a/src/qt/vitae/receivewidget.cpp +++ b/src/qt/vitae/receivewidget.cpp @@ -92,12 +92,12 @@ ReceiveWidget::ReceiveWidget(VITAEGUI* parent) : ui->listViewAddress->setVisible(false); // Connect - connect(ui->pushButtonLabel, SIGNAL(clicked()), this, SLOT(onLabelClicked())); - connect(ui->pushButtonCopy, SIGNAL(clicked()), this, SLOT(onCopyClicked())); - connect(ui->pushButtonNewAddress, SIGNAL(clicked()), this, SLOT(onNewAddressClicked())); - connect(ui->listViewAddress, SIGNAL(clicked(QModelIndex)), this, SLOT(handleAddressClicked(QModelIndex))); - connect(ui->btnRequest, SIGNAL(clicked()), this, SLOT(onRequestClicked())); - connect(ui->btnMyAddresses, SIGNAL(clicked()), this, SLOT(onMyAddressesClicked())); + connect(ui->pushButtonLabel, &QPushButton::clicked, this, &ReceiveWidget::onLabelClicked); + connect(ui->pushButtonCopy, &QPushButton::clicked, this, &ReceiveWidget::onCopyClicked); + connect(ui->pushButtonNewAddress, &QPushButton::clicked, this, &ReceiveWidget::onNewAddressClicked); + connect(ui->listViewAddress, &QListView::clicked, this, &ReceiveWidget::handleAddressClicked); + connect(ui->btnRequest, &OptionButton::clicked, this, &ReceiveWidget::onRequestClicked); + connect(ui->btnMyAddresses, &OptionButton::clicked, this, &ReceiveWidget::onMyAddressesClicked); } void ReceiveWidget::loadWalletModel() @@ -113,7 +113,7 @@ void ReceiveWidget::loadWalletModel() refreshView(); // data change - connect(this->addressTableModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(refreshView(QModelIndex, QModelIndex))); + connect(this->addressTableModel, &AddressTableModel::dataChanged, [this](const QModelIndex& tl, const QModelIndex& br){ refreshView(tl, br); }); } } diff --git a/src/qt/vitae/requestdialog.cpp b/src/qt/vitae/requestdialog.cpp index b6672284e..6ecdc28bb 100644 --- a/src/qt/vitae/requestdialog.cpp +++ b/src/qt/vitae/requestdialog.cpp @@ -67,12 +67,12 @@ RequestDialog::RequestDialog(QWidget *parent) : setCssBtnPrimary(ui->btnCopyAddress); setCssBtnPrimary(ui->btnCopyUrl); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(onNextClicked())); + connect(ui->btnCancel, &QPushButton::clicked, this, &RequestDialog::close); + connect(ui->btnEsc, &QPushButton::clicked, this, &RequestDialog::close); + connect(ui->btnSave, &QPushButton::clicked, this, &RequestDialog::onNextClicked); // TODO: Change copy address for save image (the method is already implemented in other class called exportQr or something like that) - connect(ui->btnCopyAddress, SIGNAL(clicked()), this, SLOT(onCopyClicked())); - connect(ui->btnCopyUrl, SIGNAL(clicked()), this, SLOT(onCopyUriClicked())); + connect(ui->btnCopyAddress, &QPushButton::clicked, this, &RequestDialog::onCopyClicked); + connect(ui->btnCopyUrl, &QPushButton::clicked, this, &RequestDialog::onCopyUriClicked); } void RequestDialog::setWalletModel(WalletModel *model){ diff --git a/src/qt/vitae/send.cpp b/src/qt/vitae/send.cpp index 4f544100b..0932a904f 100644 --- a/src/qt/vitae/send.cpp +++ b/src/qt/vitae/send.cpp @@ -94,10 +94,10 @@ SendWidget::SendWidget(VITAEGUI* parent) : ui->btnUri->setTitleClassAndText("btn-title-grey", "Open URI"); ui->btnUri->setSubTitleClassAndText("text-subtitle", "Parse a payment request."); - connect(ui->pushButtonFee, SIGNAL(clicked()), this, SLOT(onChangeCustomFeeClicked())); - connect(ui->btnCoinControl, SIGNAL(clicked()), this, SLOT(onCoinControlClicked())); - connect(ui->btnChangeAddress, SIGNAL(clicked()), this, SLOT(onChangeAddressClicked())); - connect(ui->btnUri, SIGNAL(clicked()), this, SLOT(onOpenUriClicked())); + connect(ui->pushButtonFee, &QPushButton::clicked, this, &SendWidget::onChangeCustomFeeClicked); + connect(ui->btnCoinControl, &OptionButton::clicked, this, &SendWidget::onCoinControlClicked); + connect(ui->btnChangeAddress, &OptionButton::clicked, this, &SendWidget::onChangeAddressClicked); + connect(ui->btnUri, &OptionButton::clicked, this, &SendWidget::onOpenUriClicked); connect(ui->pushButtonReset, &QPushButton::clicked, [this](){ onResetCustomOptions(true); }); setCssProperty(ui->coinWidget, "container-coin-type"); @@ -137,9 +137,9 @@ SendWidget::SendWidget(VITAEGUI* parent) : // Connect connect(ui->pushLeft, &QPushButton::clicked, [this](){onVITSelected(true);}); connect(ui->pushRight, &QPushButton::clicked, [this](){onVITSelected(false);}); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onSendClicked())); - connect(ui->pushButtonAddRecipient, SIGNAL(clicked()), this, SLOT(onAddEntryClicked())); - connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(clearAll())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &SendWidget::onSendClicked); + connect(ui->pushButtonAddRecipient, &QPushButton::clicked, this, &SendWidget::onAddEntryClicked); + connect(ui->pushButtonClear, &QPushButton::clicked, this, &SendWidget::clearAll); } void SendWidget::refreshView() @@ -217,7 +217,7 @@ void SendWidget::loadWalletModel() { // TODO: This only happen when the coin control features are modified in other screen, check before do this if the wallet has another screen modifying it. // Coin Control - //connect(model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool))); + //connect(walletModel->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, [this](){}); //ui->frameCoinControl->setVisible(model->getOptionsModel()->getCoinControlFeatures()); //coinControlUpdateLabels(); } @@ -724,8 +724,8 @@ void SendWidget::onMenuClicked(SendMultiRow* entry) this->menu->setEditBtnText(tr("Save contact")); this->menu->setMinimumSize(this->menu->width() + 30,this->menu->height()); connect(this->menu, &TooltipMenu::message, this, &AddressesWidget::message); - connect(this->menu, SIGNAL(onEditClicked()), this, SLOT(onContactMultiClicked())); - connect(this->menu, SIGNAL(onDeleteClicked()), this, SLOT(onDeleteClicked())); + connect(this->menu, &TooltipMenu::onEditClicked, this, &SendWidget::onContactMultiClicked); + connect(this->menu, &TooltipMenu::onDeleteClicked, this, &SendWidget::onDeleteClicked); } else { this->menu->hide(); } diff --git a/src/qt/vitae/sendchangeaddressdialog.cpp b/src/qt/vitae/sendchangeaddressdialog.cpp index aa20f8516..575f0c3ee 100644 --- a/src/qt/vitae/sendchangeaddressdialog.cpp +++ b/src/qt/vitae/sendchangeaddressdialog.cpp @@ -35,8 +35,8 @@ SendChangeAddressDialog::SendChangeAddressDialog(QWidget *parent) : ui->btnSave->setText("SAVE"); setCssBtnPrimary(ui->btnSave); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnEsc, &QPushButton::clicked, this, &SendChangeAddressDialog::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &SendChangeAddressDialog::close); connect(ui->btnSave, &QPushButton::clicked, [this](){ selected = true; accept(); }); } diff --git a/src/qt/vitae/sendconfirmdialog.cpp b/src/qt/vitae/sendconfirmdialog.cpp index f16df5bf1..b65098a3e 100644 --- a/src/qt/vitae/sendconfirmdialog.cpp +++ b/src/qt/vitae/sendconfirmdialog.cpp @@ -70,16 +70,16 @@ TxDetailDialog::TxDetailDialog(QWidget *parent, bool _isConfirmDialog, const QSt ui->labelDivider3->setVisible(false); ui->labelDivider9->setVisible(false); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnCancel, &QPushButton::clicked, this, &TxDetailDialog::close); connect(ui->btnSave, &QPushButton::clicked, [this](){acceptTx();}); }else{ ui->labelTitle->setText(tr("Transaction Details")); ui->containerButtons->setVisible(false); } - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(closeDialog())); - connect(ui->pushInputs, SIGNAL(clicked()), this, SLOT(onInputsClicked())); - connect(ui->pushOutputs, SIGNAL(clicked()), this, SLOT(onOutputsClicked())); + connect(ui->btnEsc, &QPushButton::clicked, this, &TxDetailDialog::closeDialog); + connect(ui->pushInputs, &QPushButton::clicked, this, &TxDetailDialog::onInputsClicked); + connect(ui->pushOutputs, &QPushButton::clicked, this, &TxDetailDialog::onOutputsClicked); } void TxDetailDialog::showEvent(QShowEvent *event) diff --git a/src/qt/vitae/sendcustomfeedialog.cpp b/src/qt/vitae/sendcustomfeedialog.cpp index a4d483931..830e8d5ff 100644 --- a/src/qt/vitae/sendcustomfeedialog.cpp +++ b/src/qt/vitae/sendcustomfeedialog.cpp @@ -11,7 +11,7 @@ #include #include -SendCustomFeeDialog::SendCustomFeeDialog(QWidget *parent) : +SendCustomFeeDialog::SendCustomFeeDialog(PIVXGUI *parent) : QDialog(parent), ui(new Ui::SendCustomFeeDialog) { @@ -47,13 +47,15 @@ SendCustomFeeDialog::SendCustomFeeDialog(QWidget *parent) : ui->btnSave->setText(tr("SAVE")); setCssBtnPrimary(ui->btnSave); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui->checkBoxCustom, SIGNAL(clicked()), this, SLOT(onCustomChecked())); - connect(ui->checkBoxRecommended, SIGNAL(clicked()), this, SLOT(onRecommendedChecked())); - connect(ui->comboBoxRecommended, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(updateFee())); - if(parent) connect(parent, SIGNAL(themeChanged(bool, QString&)), this, SLOT(onChangeTheme(bool, QString&))); + connect(ui->btnEsc, &QPushButton::clicked, this, &SendCustomFeeDialog::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &SendCustomFeeDialog::close); + connect(ui->btnSave, &QPushButton::clicked, this, &SendCustomFeeDialog::accept); + connect(ui->checkBoxCustom, &QCheckBox::clicked, this, &SendCustomFeeDialog::onCustomChecked); + connect(ui->checkBoxRecommended, &QCheckBox::clicked, this, &SendCustomFeeDialog::onRecommendedChecked); + connect(ui->comboBoxRecommended, static_cast(&QComboBox::currentIndexChanged), + this, &SendCustomFeeDialog::updateFee); + if (parent) + connect(parent, &PIVXGUI::themeChanged, this, &SendCustomFeeDialog::onChangeTheme); ui->checkBoxRecommended->setChecked(true); } diff --git a/src/qt/vitae/sendcustomfeedialog.h b/src/qt/vitae/sendcustomfeedialog.h index 578d023b0..d95079fd1 100644 --- a/src/qt/vitae/sendcustomfeedialog.h +++ b/src/qt/vitae/sendcustomfeedialog.h @@ -8,6 +8,7 @@ #include #include "amount.h" +class PIVXGUI; class WalletModel; namespace Ui { @@ -19,7 +20,7 @@ class SendCustomFeeDialog : public QDialog Q_OBJECT public: - explicit SendCustomFeeDialog(QWidget *parent = nullptr); + explicit SendCustomFeeDialog(PIVXGUI *parent = nullptr); ~SendCustomFeeDialog(); void setWalletModel(WalletModel* model); diff --git a/src/qt/vitae/sendmultirow.cpp b/src/qt/vitae/sendmultirow.cpp index 4cef5d4e0..feb95b659 100644 --- a/src/qt/vitae/sendmultirow.cpp +++ b/src/qt/vitae/sendmultirow.cpp @@ -56,8 +56,8 @@ SendMultiRow::SendMultiRow(PWidget *parent) : int posIconY = 14; iconNumber->move(posIconX, posIconY); - connect(ui->lineEditAmount, SIGNAL(textChanged(const QString&)), this, SLOT(amountChanged(const QString&))); - connect(ui->lineEditAddress, SIGNAL(textChanged(const QString&)), this, SLOT(addressChanged(const QString&))); + connect(ui->lineEditAmount, &QLineEdit::textChanged, this, &SendMultiRow::amountChanged); + connect(ui->lineEditAddress, &QLineEdit::textChanged, this, &SendMultiRow::addressChanged); connect(btnContact, &QAction::triggered, [this](){Q_EMIT onContactsClicked(this);}); connect(ui->btnMenu, &QPushButton::clicked, [this](){Q_EMIT onMenuClicked(this);}); } @@ -123,7 +123,7 @@ bool SendMultiRow::addressChanged(const QString& str) void SendMultiRow::loadWalletModel() { if (walletModel && walletModel->getOptionsModel()) { displayUnit = walletModel->getOptionsModel()->getDisplayUnit(); - connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendMultiRow::updateDisplayUnit); } clear(); } diff --git a/src/qt/vitae/settings/settingsbackupwallet.cpp b/src/qt/vitae/settings/settingsbackupwallet.cpp index 4c692d616..1b13d00ad 100644 --- a/src/qt/vitae/settings/settingsbackupwallet.cpp +++ b/src/qt/vitae/settings/settingsbackupwallet.cpp @@ -52,9 +52,9 @@ SettingsBackupWallet::SettingsBackupWallet(VITAEGUI* _window, QWidget *parent) : ui->pushButtonSave_2->setText(tr("Change Passphrase")); setCssBtnPrimary(ui->pushButtonSave_2); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(backupWallet())); - connect(ui->pushButtonDocuments, SIGNAL(clicked()), this, SLOT(selectFileOutput())); - connect(ui->pushButtonSave_2, SIGNAL(clicked()), this, SLOT(changePassphrase())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &SettingsBackupWallet::backupWallet); + connect(ui->pushButtonDocuments, &QPushButton::clicked, this, &SettingsBackupWallet::selectFileOutput); + connect(ui->pushButtonSave_2, &QPushButton::clicked, this, &SettingsBackupWallet::changePassphrase); } void SettingsBackupWallet::selectFileOutput() diff --git a/src/qt/vitae/settings/settingsbittoolwidget.cpp b/src/qt/vitae/settings/settingsbittoolwidget.cpp index 07bdfe557..fcc351c15 100644 --- a/src/qt/vitae/settings/settingsbittoolwidget.cpp +++ b/src/qt/vitae/settings/settingsbittoolwidget.cpp @@ -118,11 +118,11 @@ SettingsBitToolWidget::SettingsBitToolWidget(VITAEGUI* _window, QWidget *parent) ui->statusLabel_DEC->setStyleSheet("QLabel { color: transparent; }"); connect(ui->pushButtonEncrypt, &QPushButton::clicked, this, &SettingsBitToolWidget::onEncryptKeyButtonENCClicked); - connect(ui->pushButtonDecrypt, SIGNAL(clicked()), this, SLOT(onDecryptClicked())); - connect(ui->pushButtonImport, SIGNAL(clicked()), this, SLOT(importAddressFromDecKey())); - connect(btnContact, SIGNAL(triggered()), this, SLOT(onAddressesClicked())); + connect(ui->pushButtonDecrypt, &QPushButton::clicked, this, &SettingsBitToolWidget::onDecryptClicked); + connect(ui->pushButtonImport, &QPushButton::clicked, this, &SettingsBitToolWidget::importAddressFromDecKey); + connect(btnContact, &QAction::triggered, this, &SettingsBitToolWidget::onAddressesClicked); connect(ui->pushButtonClear, &QPushButton::clicked, this, &SettingsBitToolWidget::onClearAll); - connect(ui->pushButtonDecryptClear, SIGNAL(clicked()), this, SLOT(onClearDecrypt())); + connect(ui->pushButtonDecryptClear, &QPushButton::clicked, this, &SettingsBitToolWidget::onClearDecrypt); } void SettingsBitToolWidget::setAddress_ENC(const QString& address) diff --git a/src/qt/vitae/settings/settingsconsolewidget.cpp b/src/qt/vitae/settings/settingsconsolewidget.cpp index f8e9221c9..6147d20aa 100644 --- a/src/qt/vitae/settings/settingsconsolewidget.cpp +++ b/src/qt/vitae/settings/settingsconsolewidget.cpp @@ -71,19 +71,18 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase { Q_OBJECT public: - QtRPCTimerBase(boost::function& func, int64_t millis): - func(func) + QtRPCTimerBase(boost::function& _func, int64_t millis): + func(_func) { timer.setSingleShot(true); - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + connect(&timer, &QTimer::timeout, [this]{ func(); }); timer.start(millis); } ~QtRPCTimerBase() {} -private Q_SLOTS: - void timeout() { func(); } + private: QTimer timer; - boost::function func; + std::function func; }; class QtRPCTimerInterface: public RPCTimerInterface @@ -272,7 +271,7 @@ SettingsConsoleWidget::SettingsConsoleWidget(VITAEGUI* _window, QWidget *parent) inform(tr("Cannot open debug file.\nVerify that you have installed a predetermined text editor.")); } }); - connect(ui->pushButtonCommandOptions, SIGNAL(clicked()), this, SLOT(onCommandsClicked())); + connect(ui->pushButtonCommandOptions, &QPushButton::clicked, this, &SettingsConsoleWidget::onCommandsClicked); // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); @@ -479,17 +478,17 @@ void SettingsConsoleWidget::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, static_cast(&SettingsConsoleWidget::message)); // Requests from this object must go to executor connect(this, &SettingsConsoleWidget::cmdCommandRequest, executor, &RPCExecutor::requestCommand); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread - connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); - connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); + connect(this, &SettingsConsoleWidget::stopExecutor, executor, &RPCExecutor::deleteLater); + connect(this, &SettingsConsoleWidget::stopExecutor, thread, &QThread::quit); // Queue the thread for deletion (in this thread) when it is finished - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + connect(thread, &QThread::finished, thread, &QThread::deleteLater); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. diff --git a/src/qt/vitae/settings/settingsconsolewidget.h b/src/qt/vitae/settings/settingsconsolewidget.h index c39b20a2a..862737d5c 100644 --- a/src/qt/vitae/settings/settingsconsolewidget.h +++ b/src/qt/vitae/settings/settingsconsolewidget.h @@ -44,7 +44,8 @@ class SettingsConsoleWidget : public PWidget public Q_SLOTS: void clear(); - 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); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */ diff --git a/src/qt/vitae/settings/settingsdisplayoptionswidget.cpp b/src/qt/vitae/settings/settingsdisplayoptionswidget.cpp index 5f2945e68..208a2ef2d 100644 --- a/src/qt/vitae/settings/settingsdisplayoptionswidget.cpp +++ b/src/qt/vitae/settings/settingsdisplayoptionswidget.cpp @@ -101,9 +101,9 @@ SettingsDisplayOptionsWidget::SettingsDisplayOptionsWidget(VITAEGUI* _window, QW setCssBtnSecondary(ui->pushButtonClean); initLanguages(); - connect(ui->pushButtonSave, SIGNAL(clicked()), parent, SLOT(onSaveOptionsClicked())); - connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(onResetClicked())); - connect(ui->pushButtonClean, SIGNAL(clicked()), parent, SLOT(onDiscardChanges())); + connect(ui->pushButtonSave, &QPushButton::clicked, [this] { Q_EMIT saveSettings(); }); + connect(ui->pushButtonReset, &QPushButton::clicked, this, &SettingsDisplayOptionsWidget::onResetClicked); + connect(ui->pushButtonClean, &QPushButton::clicked, [this] { Q_EMIT discardSettings(); }); } void SettingsDisplayOptionsWidget::initLanguages(){ diff --git a/src/qt/vitae/settings/settingsdisplayoptionswidget.h b/src/qt/vitae/settings/settingsdisplayoptionswidget.h index fb1d2b80e..a82ccd6ba 100644 --- a/src/qt/vitae/settings/settingsdisplayoptionswidget.h +++ b/src/qt/vitae/settings/settingsdisplayoptionswidget.h @@ -28,6 +28,10 @@ class SettingsDisplayOptionsWidget : public PWidget public Q_SLOTS: void onResetClicked(); +Q_SIGNALS: + void saveSettings(); + void discardSettings(); + private: Ui::SettingsDisplayOptionsWidget *ui; }; diff --git a/src/qt/vitae/settings/settingsexportcsv.cpp b/src/qt/vitae/settings/settingsexportcsv.cpp index 3116f7710..770dedce6 100644 --- a/src/qt/vitae/settings/settingsexportcsv.cpp +++ b/src/qt/vitae/settings/settingsexportcsv.cpp @@ -55,10 +55,10 @@ SettingsExportCSV::SettingsExportCSV(VITAEGUI* _window, QWidget *parent) : setFilterAddressBook(ui->comboBoxSortAddressType, lineEditAddressBook); ui->comboBoxSortAddressType->setCurrentIndex(0); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(exportClicked())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &SettingsExportCSV::exportClicked); connect(ui->pushButtonDocuments, &QPushButton::clicked, [this](){selectFileOutput(true);}); - connect(ui->pushButtonExportAddress, SIGNAL(clicked()), this, SLOT(onExportAddressesClicked())); + connect(ui->pushButtonExportAddress, &QPushButton::clicked, this, &SettingsExportCSV::onExportAddressesClicked); connect(ui->pushButtonAddressDocuments, &QPushButton::clicked, [this](){selectFileOutput(false);}); } diff --git a/src/qt/vitae/settings/settingsfaqwidget.cpp b/src/qt/vitae/settings/settingsfaqwidget.cpp index 987ef7045..583a21a9f 100644 --- a/src/qt/vitae/settings/settingsfaqwidget.cpp +++ b/src/qt/vitae/settings/settingsfaqwidget.cpp @@ -8,7 +8,7 @@ #include #include "qt/vitae/qtutils.h" -SettingsFaqWidget::SettingsFaqWidget(QWidget *parent) : +SettingsFaqWidget::SettingsFaqWidget(PIVXGUI *parent) : QDialog(parent), ui(new Ui::SettingsFaqWidget) { @@ -96,20 +96,20 @@ SettingsFaqWidget::SettingsFaqWidget(QWidget *parent) : setCssProperty(ui->containerButtons, "container-faq-buttons"); // Buttons - connect(ui->pushButtonExit, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->pushButtonFaq1, SIGNAL(clicked()), this, SLOT(onFaq1Clicked())); - connect(ui->pushButtonFaq2, SIGNAL(clicked()), this, SLOT(onFaq2Clicked())); - connect(ui->pushButtonFaq3, SIGNAL(clicked()), this, SLOT(onFaq3Clicked())); - connect(ui->pushButtonFaq4, SIGNAL(clicked()), this, SLOT(onFaq4Clicked())); - connect(ui->pushButtonFaq5, SIGNAL(clicked()), this, SLOT(onFaq5Clicked())); - connect(ui->pushButtonFaq6, SIGNAL(clicked()), this, SLOT(onFaq6Clicked())); - connect(ui->pushButtonFaq7, SIGNAL(clicked()), this, SLOT(onFaq7Clicked())); - connect(ui->pushButtonFaq8, SIGNAL(clicked()), this, SLOT(onFaq8Clicked())); - connect(ui->pushButtonFaq9, SIGNAL(clicked()), this, SLOT(onFaq9Clicked())); - connect(ui->pushButtonFaq10, SIGNAL(clicked()), this, SLOT(onFaq10Clicked())); + connect(ui->pushButtonExit, &QPushButton::clicked, this, &SettingsFaqWidget::close); + connect(ui->pushButtonFaq1, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq1Clicked); + connect(ui->pushButtonFaq2, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq2Clicked); + connect(ui->pushButtonFaq3, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq3Clicked); + connect(ui->pushButtonFaq4, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq4Clicked); + connect(ui->pushButtonFaq5, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq5Clicked); + connect(ui->pushButtonFaq6, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq6Clicked); + connect(ui->pushButtonFaq7, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq7Clicked); + connect(ui->pushButtonFaq8, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq8Clicked); + connect(ui->pushButtonFaq9, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq9Clicked); + connect(ui->pushButtonFaq10, &QPushButton::clicked, this, &SettingsFaqWidget::onFaq10Clicked); if (parent) - connect(parent, SIGNAL(windowResizeEvent(QResizeEvent*)), this, SLOT(windowResizeEvent(QResizeEvent*))); + connect(parent, &PIVXGUI::windowResizeEvent, this, &SettingsFaqWidget::windowResizeEvent); } void SettingsFaqWidget::showEvent(QShowEvent *event){ @@ -166,7 +166,8 @@ void SettingsFaqWidget::onFaq10Clicked(){ ui->scrollAreaFaq->verticalScrollBar()->setValue(ui->widgetFaq10->y()); } -void SettingsFaqWidget::windowResizeEvent(QResizeEvent* event){ +void SettingsFaqWidget::windowResizeEvent(QResizeEvent* event) +{ QWidget* w = qobject_cast(parent()); this->resize(w->width(), w->height()); this->move(QPoint(0, 0)); diff --git a/src/qt/vitae/settings/settingsfaqwidget.h b/src/qt/vitae/settings/settingsfaqwidget.h index 947716e80..48f0f294e 100644 --- a/src/qt/vitae/settings/settingsfaqwidget.h +++ b/src/qt/vitae/settings/settingsfaqwidget.h @@ -7,6 +7,8 @@ #include +class PIVXGUI; + namespace Ui { class SettingsFaqWidget; } @@ -16,7 +18,7 @@ class SettingsFaqWidget : public QDialog Q_OBJECT public: - explicit SettingsFaqWidget(QWidget *parent = nullptr); + explicit SettingsFaqWidget(PIVXGUI *parent = nullptr); ~SettingsFaqWidget(); void showEvent(QShowEvent *event) override; diff --git a/src/qt/vitae/settings/settingsinformationwidget.cpp b/src/qt/vitae/settings/settingsinformationwidget.cpp index df9fe6df7..58a9d2a1a 100644 --- a/src/qt/vitae/settings/settingsinformationwidget.cpp +++ b/src/qt/vitae/settings/settingsinformationwidget.cpp @@ -116,7 +116,7 @@ SettingsInformationWidget::SettingsInformationWidget(VITAEGUI* _window,QWidget * if (!GUIUtil::openConfigfile()) inform(tr("Unable to open vitae.conf with default application")); }); - connect(ui->pushButtonNetworkMonitor, SIGNAL(clicked()), this, SLOT(openNetworkMonitor())); + connect(ui->pushButtonNetworkMonitor, &QPushButton::clicked, this, &SettingsInformationWidget::openNetworkMonitor); } @@ -129,10 +129,10 @@ void SettingsInformationWidget::loadClientModel(){ ui->labelInfoName->setText(QString::fromStdString(Params().NetworkIDString())); setNumConnections(clientModel->getNumConnections()); - connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); + connect(clientModel, &ClientModel::numConnectionsChanged, this, &SettingsInformationWidget::setNumConnections); setNumBlocks(clientModel->getNumBlocks()); - connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); + connect(clientModel, &ClientModel::numBlocksChanged, this, &SettingsInformationWidget::setNumBlocks); } } diff --git a/src/qt/vitae/settings/settingsmainoptionswidget.cpp b/src/qt/vitae/settings/settingsmainoptionswidget.cpp index d5e7f53fa..637b78f07 100644 --- a/src/qt/vitae/settings/settingsmainoptionswidget.cpp +++ b/src/qt/vitae/settings/settingsmainoptionswidget.cpp @@ -89,9 +89,9 @@ SettingsMainOptionsWidget::SettingsMainOptionsWidget(VITAEGUI* _window, QWidget ui->threadsScriptVerif->setMinimum(-(int)boost::thread::hardware_concurrency()); ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS); - connect(ui->pushButtonSave, SIGNAL(clicked()), parent, SLOT(onSaveOptionsClicked())); - connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(onResetClicked())); - connect(ui->pushButtonClean, SIGNAL(clicked()), parent, SLOT(onDiscardChanges())); + connect(ui->pushButtonSave, &QPushButton::clicked, [this] { Q_EMIT saveSettings(); }); + connect(ui->pushButtonReset, &QPushButton::clicked, this, &SettingsMainOptionsWidget::onResetClicked); + connect(ui->pushButtonClean, &QPushButton::clicked, [this] { Q_EMIT discardSettings(); }); } void SettingsMainOptionsWidget::onResetClicked(){ diff --git a/src/qt/vitae/settings/settingsmainoptionswidget.h b/src/qt/vitae/settings/settingsmainoptionswidget.h index ade77a5ae..ed884d904 100644 --- a/src/qt/vitae/settings/settingsmainoptionswidget.h +++ b/src/qt/vitae/settings/settingsmainoptionswidget.h @@ -27,6 +27,10 @@ class SettingsMainOptionsWidget : public PWidget void setMapper(QDataWidgetMapper *mapper); +Q_SIGNALS: + void saveSettings(); + void discardSettings(); + public Q_SLOTS: void onResetClicked(); diff --git a/src/qt/vitae/settings/settingsmultisenddialog.cpp b/src/qt/vitae/settings/settingsmultisenddialog.cpp index 0366eedfd..0c9d86a85 100644 --- a/src/qt/vitae/settings/settingsmultisenddialog.cpp +++ b/src/qt/vitae/settings/settingsmultisenddialog.cpp @@ -51,8 +51,8 @@ SettingsMultisendDialog::SettingsMultisendDialog(QWidget *parent) : ui->btnSave->setText("ADD"); setCssBtnPrimary(ui->btnSave); - connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close())); - connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->btnEsc, &QPushButton::clicked, this, &SettingsMultisendDialog::close); + connect(ui->btnCancel, &QPushButton::clicked, this, &SettingsMultisendDialog::close); connect(ui->btnSave, &QPushButton::clicked, [this](){ this->isOk = true; accept(); diff --git a/src/qt/vitae/settings/settingsmultisendwidget.cpp b/src/qt/vitae/settings/settingsmultisendwidget.cpp index 04ddd1b42..89d6a2eb3 100644 --- a/src/qt/vitae/settings/settingsmultisendwidget.cpp +++ b/src/qt/vitae/settings/settingsmultisendwidget.cpp @@ -191,8 +191,8 @@ SettingsMultisendWidget::SettingsMultisendWidget(PWidget *parent) : setCssBtnPrimary(ui->pushButtonSave); setCssBtnSecondary(ui->pushButtonClear); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onAddRecipientClicked())); - connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(clearAll())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &SettingsMultisendWidget::onAddRecipientClicked); + connect(ui->pushButtonClear, &QPushButton::clicked, this, &SettingsMultisendWidget::clearAll); } void SettingsMultisendWidget::showEvent(QShowEvent *event) @@ -213,10 +213,10 @@ void SettingsMultisendWidget::loadWalletModel() ui->pushLeft->setChecked(pwalletMain->isMultiSendEnabled()); ui->checkBoxStake->setChecked(pwalletMain->fMultiSendStake); ui->checkBoxRewards->setChecked(pwalletMain->fMultiSendMasternodeReward); - connect(ui->checkBoxStake, SIGNAL(stateChanged(int)), this, SLOT(checkBoxChanged())); - connect(ui->checkBoxRewards, SIGNAL(stateChanged(int)), this, SLOT(checkBoxChanged())); - connect(ui->pushLeft, SIGNAL(clicked()), this, SLOT(activate())); - connect(ui->pushRight, SIGNAL(clicked()), this, SLOT(deactivate())); + connect(ui->checkBoxStake, &QCheckBox::stateChanged, this, &SettingsMultisendWidget::checkBoxChanged); + connect(ui->checkBoxRewards, &QCheckBox::stateChanged, this, &SettingsMultisendWidget::checkBoxChanged); + connect(ui->pushLeft, &QPushButton::clicked, this, &SettingsMultisendWidget::activate); + connect(ui->pushRight, &QPushButton::clicked, this, &SettingsMultisendWidget::deactivate); updateListState(); } diff --git a/src/qt/vitae/settings/settingsnetworkwidget.cpp b/src/qt/vitae/settings/settingsnetworkwidget.cpp index 2e62d9b1c..577e507ca 100644 --- a/src/qt/vitae/settings/settingsnetworkwidget.cpp +++ b/src/qt/vitae/settings/settingsnetworkwidget.cpp @@ -25,7 +25,7 @@ SettingsNetworkWidget::SettingsNetworkWidget(VITAEGUI* _window, QWidget *parent) setCssBtnPrimary(ui->pushButtonSave); setCssBtnSecondary(ui->pushButtonReset); - connect(ui->pushButtonSave, SIGNAL(clicked()), parent, SLOT(onSaveOptionsClicked())); + connect(ui->pushButtonSave, &QPushButton::clicked, [this] { Q_EMIT saveSettings(); }); } void SettingsNetworkWidget::setMapper(QDataWidgetMapper *mapper){ diff --git a/src/qt/vitae/settings/settingsnetworkwidget.h b/src/qt/vitae/settings/settingsnetworkwidget.h index 697d8e7da..16cde4909 100644 --- a/src/qt/vitae/settings/settingsnetworkwidget.h +++ b/src/qt/vitae/settings/settingsnetworkwidget.h @@ -25,6 +25,9 @@ class SettingsNetworkWidget : public PWidget private: Ui::SettingsNetworkWidget *ui; + +Q_SIGNALS: + void saveSettings() {}; }; #endif // SETTINGSNETWORKWIDGET_H diff --git a/src/qt/vitae/settings/settingssignmessagewidgets.cpp b/src/qt/vitae/settings/settingssignmessagewidgets.cpp index b9f296deb..5abe7c1c6 100644 --- a/src/qt/vitae/settings/settingssignmessagewidgets.cpp +++ b/src/qt/vitae/settings/settingssignmessagewidgets.cpp @@ -84,9 +84,9 @@ SettingsSignMessageWidgets::SettingsSignMessageWidgets(VITAEGUI* _window, QWidge ui->statusLabel_SM->setStyleSheet("QLabel { color: transparent; }"); - connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onGoClicked())); - connect(btnContact, SIGNAL(triggered()), this, SLOT(onAddressesClicked())); - connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(onClearAll())); + connect(ui->pushButtonSave, &QPushButton::clicked, this, &SettingsSignMessageWidgets::onGoClicked); + connect(btnContact, &QAction::triggered, this, &SettingsSignMessageWidgets::onAddressesClicked); + connect(ui->pushButtonClear, &QPushButton::clicked, this, &SettingsSignMessageWidgets::onClearAll); connect(ui->pushSign, &QPushButton::clicked, [this](){onModeSelected(true);}); connect(ui->pushVerify, &QPushButton::clicked, [this](){onModeSelected(false);}); } diff --git a/src/qt/vitae/settings/settingswalletoptionswidget.cpp b/src/qt/vitae/settings/settingswalletoptionswidget.cpp index 7f00e9745..08f601589 100644 --- a/src/qt/vitae/settings/settingswalletoptionswidget.cpp +++ b/src/qt/vitae/settings/settingswalletoptionswidget.cpp @@ -71,9 +71,9 @@ SettingsWalletOptionsWidget::SettingsWalletOptionsWidget(VITAEGUI* _window, QWid setCssBtnSecondary(ui->pushButtonReset); setCssBtnSecondary(ui->pushButtonClean); - connect(ui->pushButtonSave, SIGNAL(clicked()), parent, SLOT(onSaveOptionsClicked())); - connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(onResetClicked())); - connect(ui->pushButtonClean, SIGNAL(clicked()), parent, SLOT(onDiscardChanges())); + connect(ui->pushButtonSave, &QPushButton::clicked, [this] { Q_EMIT saveSettings(); }); + connect(ui->pushButtonReset, &QPushButton::clicked, this, &SettingsWalletOptionsWidget::onResetClicked); + connect(ui->pushButtonClean, &QPushButton::clicked, [this] { Q_EMIT discardSettings(); }); } void SettingsWalletOptionsWidget::onResetClicked(){ diff --git a/src/qt/vitae/settings/settingswalletoptionswidget.h b/src/qt/vitae/settings/settingswalletoptionswidget.h index 06f44ba7c..9aa9b1575 100644 --- a/src/qt/vitae/settings/settingswalletoptionswidget.h +++ b/src/qt/vitae/settings/settingswalletoptionswidget.h @@ -22,6 +22,10 @@ class SettingsWalletOptionsWidget : public PWidget void setMapper(QDataWidgetMapper *mapper); +Q_SIGNALS: + void saveSettings(); + void discardSettings(); + public Q_SLOTS: void onResetClicked(); diff --git a/src/qt/vitae/settings/settingswalletrepairwidget.cpp b/src/qt/vitae/settings/settingswalletrepairwidget.cpp index ed7e321f1..fa293ad67 100644 --- a/src/qt/vitae/settings/settingswalletrepairwidget.cpp +++ b/src/qt/vitae/settings/settingswalletrepairwidget.cpp @@ -72,13 +72,13 @@ SettingsWalletRepairWidget::SettingsWalletRepairWidget(VITAEGUI* _window, QWidge // Wallet Repair Buttons - connect(ui->pushButtonSalvage, SIGNAL(clicked()), this, SLOT(walletSalvage())); - connect(ui->pushButtonRescan, SIGNAL(clicked()), this, SLOT(walletRescan())); - connect(ui->pushButtonRecover1, SIGNAL(clicked()), this, SLOT(walletZaptxes1())); - connect(ui->pushButtonRecover2, SIGNAL(clicked()), this, SLOT(walletZaptxes2())); - connect(ui->pushButtonUpgrade, SIGNAL(clicked()), this, SLOT(walletUpgrade())); - connect(ui->pushButtonRebuild, SIGNAL(clicked()), this, SLOT(walletReindex())); - connect(ui->pushButtonDelete, SIGNAL(clicked()), this, SLOT(walletResync())); + connect(ui->pushButtonSalvage, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletSalvage); + connect(ui->pushButtonRescan, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletRescan); + connect(ui->pushButtonRecover1, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletZaptxes1); + connect(ui->pushButtonRecover2, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletZaptxes2); + connect(ui->pushButtonUpgrade, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletUpgrade); + connect(ui->pushButtonRebuild, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletReindex); + connect(ui->pushButtonDelete, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletResync); } /** Restart wallet with "-salvagewallet" */ diff --git a/src/qt/vitae/settings/settingswidget.cpp b/src/qt/vitae/settings/settingswidget.cpp index 66030c941..760d992f9 100644 --- a/src/qt/vitae/settings/settingswidget.cpp +++ b/src/qt/vitae/settings/settingswidget.cpp @@ -121,33 +121,33 @@ SettingsWidget::SettingsWidget(VITAEGUI* parent) : ui->stackedWidgetContainer->setCurrentWidget(settingsBackupWallet); // File Section - connect(ui->pushButtonFile, SIGNAL(clicked()), this, SLOT(onFileClicked())); - connect(ui->pushButtonFile2, SIGNAL(clicked()), this, SLOT(onBackupWalletClicked())); - connect(ui->pushButtonFile3, SIGNAL(clicked()), this, SLOT(onMultisendClicked())); - connect(ui->pushButtonExportCsv, SIGNAL(clicked()), this, SLOT(onExportCSVClicked())); + connect(ui->pushButtonFile, &QPushButton::clicked, this, &SettingsWidget::onFileClicked); + connect(ui->pushButtonFile2, &QPushButton::clicked, this, &SettingsWidget::onBackupWalletClicked); + connect(ui->pushButtonFile3, &QPushButton::clicked, this, &SettingsWidget::onMultisendClicked); + connect(ui->pushButtonExportCsv, &QPushButton::clicked, this, &SettingsWidget::onExportCSVClicked); // Options - connect(ui->pushButtonOptions, SIGNAL(clicked()), this, SLOT(onOptionsClicked())); - connect(ui->pushButtonOptions1, SIGNAL(clicked()), this, SLOT(onMainOptionsClicked())); - connect(ui->pushButtonOptions2, SIGNAL(clicked()), this, SLOT(onWalletOptionsClicked())); - connect(ui->pushButtonOptions5, SIGNAL(clicked()), this, SLOT(onDisplayOptionsClicked())); + connect(ui->pushButtonOptions, &QPushButton::clicked, this, &SettingsWidget::onOptionsClicked); + connect(ui->pushButtonOptions1, &QPushButton::clicked, this, &SettingsWidget::onMainOptionsClicked); + connect(ui->pushButtonOptions2, &QPushButton::clicked, this, &SettingsWidget::onWalletOptionsClicked); + connect(ui->pushButtonOptions5, &QPushButton::clicked, this, &SettingsWidget::onDisplayOptionsClicked); // Configuration - connect(ui->pushButtonConfiguration, SIGNAL(clicked()), this, SLOT(onConfigurationClicked())); - connect(ui->pushButtonConfiguration3, SIGNAL(clicked()), this, SLOT(onBipToolClicked())); - connect(ui->pushButtonConfiguration4, SIGNAL(clicked()), this, SLOT(onSignMessageClicked())); + connect(ui->pushButtonConfiguration, &QPushButton::clicked, this, &SettingsWidget::onConfigurationClicked); + connect(ui->pushButtonConfiguration3, &QPushButton::clicked, this, &SettingsWidget::onBipToolClicked); + connect(ui->pushButtonConfiguration4, &QPushButton::clicked, this, &SettingsWidget::onSignMessageClicked); // Tools - connect(ui->pushButtonTools, SIGNAL(clicked()), this, SLOT(onToolsClicked())); - connect(ui->pushButtonTools1, SIGNAL(clicked()), this, SLOT(onInformationClicked())); - connect(ui->pushButtonTools2, SIGNAL(clicked()), this, SLOT(onDebugConsoleClicked())); + connect(ui->pushButtonTools, &QPushButton::clicked, this, &SettingsWidget::onToolsClicked); + connect(ui->pushButtonTools1, &QPushButton::clicked, this, &SettingsWidget::onInformationClicked); + connect(ui->pushButtonTools2, &QPushButton::clicked, this, &SettingsWidget::onDebugConsoleClicked); ui->pushButtonTools2->setShortcut(QKeySequence(SHORT_KEY + Qt::Key_C)); - connect(ui->pushButtonTools5, SIGNAL(clicked()), this, SLOT(onWalletRepairClicked())); + connect(ui->pushButtonTools5, &QPushButton::clicked, this, &SettingsWidget::onWalletRepairClicked); // Help - connect(ui->pushButtonHelp, SIGNAL(clicked()), this, SLOT(onHelpClicked())); - connect(ui->pushButtonHelp1, SIGNAL(clicked()), window, SLOT(openFAQ())); - connect(ui->pushButtonHelp2, SIGNAL(clicked()), this, SLOT(onAboutClicked())); + connect(ui->pushButtonHelp, &QPushButton::clicked, this, &SettingsWidget::onHelpClicked); + connect(ui->pushButtonHelp1, &QPushButton::clicked, window, &PIVXGUI::openFAQ); + connect(ui->pushButtonHelp2, &QPushButton::clicked, this, &SettingsWidget::onAboutClicked); // Get restart command-line parameters and handle restart connect(settingsWalletRepairWidget, &SettingsWalletRepairWidget::handleRestart, [this](QStringList arg){Q_EMIT handleRestart(arg);}); @@ -165,6 +165,15 @@ SettingsWidget::SettingsWidget(VITAEGUI* parent) : connect(settingsWalletOptionsWidget, &SettingsWalletOptionsWidget::message, this, &SettingsWidget::message); connect(settingsInformationWidget, &SettingsInformationWidget::message,this, &SettingsWidget::message); + connect(settingsDisplayOptionsWidget, &SettingsDisplayOptionsWidget::saveSettings, this, &SettingsWidget::onSaveOptionsClicked); + connect(settingsDisplayOptionsWidget, &SettingsDisplayOptionsWidget::discardSettings, this, &SettingsWidget::onDiscardChanges); + + connect(settingsMainOptionsWidget, &SettingsMainOptionsWidget::saveSettings, this, &SettingsWidget::onSaveOptionsClicked); + connect(settingsMainOptionsWidget, &SettingsMainOptionsWidget::discardSettings, this, &SettingsWidget::onDiscardChanges); + + connect(settingsWalletOptionsWidget, &SettingsWalletOptionsWidget::saveSettings, this, &SettingsWidget::onSaveOptionsClicked); + connect(settingsWalletOptionsWidget, &SettingsWalletOptionsWidget::discardSettings, this, &SettingsWidget::onDiscardChanges); + /* Widget-to-option mapper */ mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); @@ -185,7 +194,6 @@ void SettingsWidget::loadClientModel(){ settingsDisplayOptionsWidget->setClientModel(clientModel); settingsWalletOptionsWidget->setClientModel(clientModel); /* keep consistency for action triggered elsewhere */ - //connect(optionsModel, SIGNAL(hideOrphansChanged(bool)), this, SLOT(updateHideOrphans(bool))); // TODO: Connect show restart needed and apply changes. } diff --git a/src/qt/vitae/snackbar.cpp b/src/qt/vitae/snackbar.cpp index 94a6ca0ad..bb789d3c4 100644 --- a/src/qt/vitae/snackbar.cpp +++ b/src/qt/vitae/snackbar.cpp @@ -20,27 +20,27 @@ SnackBar::SnackBar(VITAEGUI* _window, QWidget *parent) : ui->label->setProperty("cssClass", "text-snackbar"); ui->pushButton->setProperty("cssClass", "ic-close"); - connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->pushButton, &QPushButton::clicked, this, &SnackBar::close); if (window) - connect(window, SIGNAL(windowResizeEvent(QResizeEvent*)), this, SLOT(windowResizeEvent(QResizeEvent*))); + connect(window, &PIVXGUI::windowResizeEvent, this, &SnackBar::windowResizeEvent); else { ui->horizontalLayout->setContentsMargins(0,0,0,0); ui->label->setStyleSheet("font-size: 15px; color:white;"); } } -void SnackBar::windowResizeEvent(QResizeEvent* event){ +void SnackBar::windowResizeEvent(QResizeEvent* event) { this->resize(qobject_cast(parent())->width(), this->height()); this->move(QPoint(0, window->height() - this->height() )); } void SnackBar::showEvent(QShowEvent *event){ - QTimer::singleShot(3000, this, SLOT(hideAnim())); + QTimer::singleShot(3000, this, &SnackBar::hideAnim); } void SnackBar::hideAnim(){ if (window) closeDialog(this, window); - QTimer::singleShot(310, this, SLOT(hide())); + QTimer::singleShot(310, this, &SnackBar::hide); } diff --git a/src/qt/vitae/snackbar.h b/src/qt/vitae/snackbar.h index 8950a37c0..1ca505951 100644 --- a/src/qt/vitae/snackbar.h +++ b/src/qt/vitae/snackbar.h @@ -6,6 +6,7 @@ #define SNACKBAR_H #include +#include class VITAEGUI; @@ -26,7 +27,7 @@ class SnackBar : public QDialog void setText(QString text); private Q_SLOTS: void hideAnim(); - void windowResizeEvent(QResizeEvent *event); + void windowResizeEvent(QResizeEvent* event); private: Ui::SnackBar *ui; VITAEGUI* window = nullptr; diff --git a/src/qt/vitae/tooltipmenu.cpp b/src/qt/vitae/tooltipmenu.cpp index 0efd63e2d..4e5b54660 100644 --- a/src/qt/vitae/tooltipmenu.cpp +++ b/src/qt/vitae/tooltipmenu.cpp @@ -17,10 +17,10 @@ TooltipMenu::TooltipMenu(VITAEGUI *_window, QWidget *parent) : ui->btnLast->setVisible(false); setCssProperty(ui->container, "container-list-menu"); setCssProperty({ui->btnCopy, ui->btnDelete, ui->btnEdit, ui->btnLast}, "btn-list-menu"); - connect(ui->btnCopy, SIGNAL(clicked()), this, SLOT(copyClicked())); - connect(ui->btnDelete, SIGNAL(clicked()), this, SLOT(deleteClicked())); - connect(ui->btnEdit, SIGNAL(clicked()), this, SLOT(editClicked())); - connect(ui->btnLast, SIGNAL(clicked()), this, SLOT(lastClicked())); + connect(ui->btnCopy, &QPushButton::clicked, this, &TooltipMenu::copyClicked); + connect(ui->btnDelete, &QPushButton::clicked, this, &TooltipMenu::deleteClicked); + connect(ui->btnEdit, &QPushButton::clicked, this, &TooltipMenu::editClicked); + connect(ui->btnLast, &QPushButton::clicked, this, &TooltipMenu::lastClicked); } void TooltipMenu::setEditBtnText(QString btnText){ @@ -77,7 +77,7 @@ void TooltipMenu::lastClicked() { } void TooltipMenu::showEvent(QShowEvent *event){ - QTimer::singleShot(5000, this, SLOT(hide())); + QTimer::singleShot(5000, this, &TooltipMenu::hide); } TooltipMenu::~TooltipMenu() diff --git a/src/qt/vitae/topbar.cpp b/src/qt/vitae/topbar.cpp index ace1c8d01..ffaecc0bd 100644 --- a/src/qt/vitae/topbar.cpp +++ b/src/qt/vitae/topbar.cpp @@ -117,12 +117,12 @@ TopBar::TopBar(VITAEGUI* _mainWindow, QWidget *parent) : ui->pushButtonLock->setButtonClassStyle("cssClass", "btn-check-status-lock"); - connect(ui->pushButtonQR, SIGNAL(clicked()), this, SLOT(onBtnReceiveClicked())); - connect(ui->btnQr, SIGNAL(clicked()), this, SLOT(onBtnReceiveClicked())); - connect(ui->pushButtonLock, SIGNAL(Mouse_Pressed()), this, SLOT(onBtnLockClicked())); - connect(ui->pushButtonTheme, SIGNAL(Mouse_Pressed()), this, SLOT(onThemeClicked())); - connect(ui->pushButtonFAQ, SIGNAL(Mouse_Pressed()), _mainWindow, SLOT(openFAQ())); - connect(ui->pushButtonColdStaking, SIGNAL(Mouse_Pressed()), this, SLOT(onColdStakingClicked())); + connect(ui->pushButtonQR, &QPushButton::clicked, this, &TopBar::onBtnReceiveClicked); + connect(ui->btnQr, &QPushButton::clicked, this, &TopBar::onBtnReceiveClicked); + connect(ui->pushButtonLock, &ExpandableButton::Mouse_Pressed, this, &TopBar::onBtnLockClicked); + connect(ui->pushButtonTheme, &ExpandableButton::Mouse_Pressed, this, &TopBar::onThemeClicked); + connect(ui->pushButtonFAQ, &ExpandableButton::Mouse_Pressed, [this](){window->openFAQ();}); + connect(ui->pushButtonColdStaking, &ExpandableButton::Mouse_Pressed, this, &TopBar::onColdStakingClicked); connect(ui->pushButtonSync, &ExpandableButton::Mouse_HoverLeave, this, &TopBar::refreshProgressBarSize); connect(ui->pushButtonSync, &ExpandableButton::Mouse_Hover, this, &TopBar::refreshProgressBarSize); } @@ -156,13 +156,11 @@ void TopBar::onBtnLockClicked() if (!lockUnlockWidget) { lockUnlockWidget = new LockUnlock(window); lockUnlockWidget->setStyleSheet("margin:0px; padding:0px;"); - connect(lockUnlockWidget, SIGNAL(Mouse_Leave()), this, SLOT(lockDropdownMouseLeave())); - connect(ui->pushButtonLock, &ExpandableButton::Mouse_HoverLeave, [this](){ + connect(lockUnlockWidget, &LockUnlock::Mouse_Leave, this, &TopBar::lockDropdownMouseLeave); + connect(ui->pushButtonLock, &ExpandableButton::Mouse_HoverLeave, [this]() { QMetaObject::invokeMethod(this, "lockDropdownMouseLeave", Qt::QueuedConnection); }); - connect(lockUnlockWidget, SIGNAL(lockClicked( - const StateClicked&)),this, SLOT(lockDropdownClicked( - const StateClicked&))); + connect(lockUnlockWidget, &LockUnlock::lockClicked ,this, &TopBar::lockDropdownClicked); } lockUnlockWidget->updateStatus(walletModel->getEncryptionStatus()); @@ -372,13 +370,13 @@ void TopBar::loadClientModel() if (clientModel) { // Keep up to date with client setNumConnections(clientModel->getNumConnections()); - connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); + connect(clientModel, &ClientModel::numConnectionsChanged, this, &TopBar::setNumConnections); setNumBlocks(clientModel->getNumBlocks()); - connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); + connect(clientModel, &ClientModel::numBlocksChanged, this, &TopBar::setNumBlocks); timerStakingIcon = new QTimer(ui->pushButtonStack); - connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingStatus())); + connect(timerStakingIcon, &QTimer::timeout, this, &TopBar::updateStakingStatus); timerStakingIcon->start(50000); updateStakingStatus(); } @@ -548,9 +546,8 @@ void TopBar::loadWalletModel() }); } - connect(walletModel, SIGNAL(balanceChanged(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)), this, - SLOT(updateBalances(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount))); - connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(walletModel, &WalletModel::balanceChanged, this, &TopBar::updateBalances); + connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TopBar::updateDisplayUnit); connect(walletModel, &WalletModel::encryptionStatusChanged, this, &TopBar::refreshStatus); // Ask for passphrase if needed connect(walletModel, &WalletModel::requireUnlock, this, &TopBar::unlockWallet); diff --git a/src/qt/vitae/vitaegui.cpp b/src/qt/vitae/vitaegui.cpp index c707a6f0e..d74233a0e 100644 --- a/src/qt/vitae/vitaegui.cpp +++ b/src/qt/vitae/vitaegui.cpp @@ -180,8 +180,8 @@ void VITAEGUI::createActions(const NetworkStyle* networkStyle){ quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); - connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(toggleHideAction, &QAction::triggered, this, &PIVXGUI::toggleHidden); + connect(quitAction, &QAction::triggered, qApp, &QApplication::quit); } /** @@ -259,9 +259,9 @@ void VITAEGUI::setClientModel(ClientModel* clientModel) { settingsWidget->setClientModel(clientModel); // Receive and report messages from client model - connect(clientModel, SIGNAL(message(QString, QString, unsigned int)), this, SLOT(message(QString, QString, unsigned int))); - connect(topBar, SIGNAL(walletSynced(bool)), dashboard, SLOT(walletSynced(bool))); - connect(topBar, SIGNAL(walletSynced(bool)), coldStakingWidget, SLOT(walletSynced(bool))); + connect(clientModel, &ClientModel::message, this, &PIVXGUI::message); + connect(topBar, &TopBar::walletSynced, dashboard, &DashboardWidget::walletSynced); + connect(topBar, &TopBar::walletSynced, coldStakingWidget, &ColdStakingWidget::walletSynced); // Get restart command-line parameters and handle restart connect(settingsWidget, &SettingsWidget::handleRestart, [this](QStringList arg){handleRestart(arg);}); @@ -292,8 +292,7 @@ void VITAEGUI::createTrayIconMenu() { trayIconMenu = new QMenu(this); trayIcon->setContextMenu(trayIconMenu); - connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); + connect(trayIcon, &QSystemTrayIcon::activated, this, &PIVXGUI::trayIconActivated); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance(); @@ -329,7 +328,7 @@ void VITAEGUI::changeEvent(QEvent* e) if (clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) { QWindowStateChangeEvent* wsevt = static_cast(e); if (!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - QTimer::singleShot(0, this, SLOT(hide())); + QTimer::singleShot(0, this, &PIVXGUI::hide); e->ignore(); } } @@ -618,7 +617,7 @@ bool VITAEGUI::addWallet(const QString& name, WalletModel* walletModel) connect(settingsWidget, &SettingsWidget::message, this, &VITAEGUI::message); // Pass through transaction notifications - connect(dashboard, SIGNAL(incomingTransaction(QString, int, CAmount, QString, QString)), this, SLOT(incomingTransaction(QString, int, CAmount, QString, QString))); + connect(dashboard, &DashboardWidget::incomingTransaction, this, &PIVXGUI::incomingTransaction); return true; } diff --git a/src/qt/vitae/vitaegui.h b/src/qt/vitae/vitaegui.h index 65794d7cc..7c00c7a19 100644 --- a/src/qt/vitae/vitaegui.h +++ b/src/qt/vitae/vitaegui.h @@ -165,6 +165,10 @@ public Q_SLOTS: /** Disconnect core signals from GUI client */ void unsubscribeFromCoreSignals(); +public Q_SLOTS: + /** called by a timer to check if fRequestShutdown has been set **/ + void detectShutdown(); + private Q_SLOTS: /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ void showNormalIfMinimized(bool fToggleHidden = false); @@ -172,9 +176,6 @@ private Q_SLOTS: /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */ void toggleHidden(); - /** called by a timer to check if fRequestShutdown has been set **/ - void detectShutdown(); - #ifndef Q_OS_MAC /** Handle tray icon clicked */ void trayIconActivated(QSystemTrayIcon::ActivationReason reason); diff --git a/src/qt/vitae/welcomecontentwidget.cpp b/src/qt/vitae/welcomecontentwidget.cpp index b2913831d..9f4119e21 100644 --- a/src/qt/vitae/welcomecontentwidget.cpp +++ b/src/qt/vitae/welcomecontentwidget.cpp @@ -158,9 +158,9 @@ WelcomeContentWidget::WelcomeContentWidget(QWidget *parent) : ui->pushButtonSkip->setProperty("cssClass", "btn-close-white"); onNextClicked(); - connect(ui->pushButtonSkip, SIGNAL(clicked()), this, SLOT(close())); - connect(nextButton, SIGNAL(clicked()), this, SLOT(onNextClicked())); - connect(backButton, SIGNAL(clicked()), this, SLOT(onBackClicked())); + connect(ui->pushButtonSkip, &QPushButton::clicked, this, &WelcomeContentWidget::close); + connect(nextButton, &QPushButton::clicked, this, &WelcomeContentWidget::onNextClicked); + connect(backButton, &QPushButton::clicked, this, &WelcomeContentWidget::onBackClicked); initLanguages(); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index fd0fe89da..a28fcf0c7 100755 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -48,7 +48,7 @@ WalletModel::WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* p // 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(); diff --git a/src/qt/zVitcontroldialog.cpp b/src/qt/zVitcontroldialog.cpp index b2a0b83c0..757c183be 100755 --- a/src/qt/zVitcontroldialog.cpp +++ b/src/qt/zVitcontroldialog.cpp @@ -56,9 +56,9 @@ ZVitControlDialog::ZVitControlDialog(QWidget *parent) : ui->pushButtonAll->setProperty("cssClass", "btn-check"); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(updateSelection(QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &ZPivControlDialog::updateSelection); // push select/deselect all button - connect(ui->pushButtonAll, SIGNAL(clicked()), this, SLOT(ButtonAllClicked())); + connect(ui->pushButtonAll, &QPushButton::clicked, this, &ZPivControlDialog::ButtonAllClicked); } ZVitControlDialog::~ZVitControlDialog() diff --git a/test/lint/lint-qt.sh b/test/lint/lint-qt.sh new file mode 100755 index 000000000..d3d432dd5 --- /dev/null +++ b/test/lint/lint-qt.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2018 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# +# Check for SIGNAL/SLOT connect style, removed since Qt4 support drop. + +export LC_ALL=C + +EXIT_CODE=0 + +OUTPUT=$(git grep -E '(SIGNAL|, ?SLOT)\(' -- src/qt) +if [[ ${OUTPUT} != "" ]]; then + echo "Use Qt5 connect style in:" + echo "$OUTPUT" + EXIT_CODE=1 +fi + +exit ${EXIT_CODE} \ No newline at end of file