diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -38,9 +38,10 @@ int column = treeWidget()->sortColumn(); if (column == CoinControlDialog::COLUMN_AMOUNT || column == CoinControlDialog::COLUMN_DATE || - column == CoinControlDialog::COLUMN_CONFIRMATIONS) + column == CoinControlDialog::COLUMN_CONFIRMATIONS) { return data(column, Qt::UserRole).toLongLong() < other.data(column, Qt::UserRole).toLongLong(); + } return QTreeWidgetItem::operator<(other); } @@ -158,13 +159,15 @@ // restore list mode and sortorder as a convenience feature QSettings settings; if (settings.contains("nCoinControlMode") && - !settings.value("nCoinControlMode").toBool()) + !settings.value("nCoinControlMode").toBool()) { ui->radioTreeMode->click(); + } if (settings.contains("nCoinControlSortColumn") && - settings.contains("nCoinControlSortOrder")) + settings.contains("nCoinControlSortOrder")) { sortView(settings.value("nCoinControlSortColumn").toInt(), (static_cast( settings.value("nCoinControlSortOrder").toInt()))); + } } CoinControlDialog::~CoinControlDialog() { @@ -205,12 +208,13 @@ } } ui->treeWidget->setEnabled(false); - for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) + for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state) { ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state); } + } ui->treeWidget->setEnabled(true); if (state == Qt::Unchecked) { // just to be sure @@ -819,8 +823,9 @@ if (treeMode) { for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == - Qt::PartiallyChecked) + Qt::PartiallyChecked) { ui->treeWidget->topLevelItem(i)->setExpanded(true); + } } } diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -135,8 +135,9 @@ certList = QSslCertificate::fromPath(certFile); // Use those certificates when fetching payment requests, too: QSslSocket::setDefaultCaCertificates(certList); - } else + } else { certList = QSslSocket::systemCaCertificates(); + } int nRootCerts = 0; const QDateTime currentTime = QDateTime::currentDateTime(); @@ -605,10 +606,8 @@ QString::fromStdString(EncodeCashAddr(dest, Params()))); } else if (!recipient.authenticatedMerchant.isEmpty()) { // Unauthenticated payment requests to custom bitcoin addresses are - // not supported - // (there is no good way to tell the user where they are paying in a - // way they'd - // have a chance of understanding). + // not supported (there is no good way to tell the user where they + // are paying in a way they'd have a chance of understanding). Q_EMIT message(tr("Payment request rejected"), tr("Unverified payment requests to custom payment " "scripts are unsupported."), diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -38,7 +38,9 @@ } QImage QRImageWidget::exportImage() { - if (!pixmap()) return QImage(); + if (!pixmap()) { + return QImage(); + } return pixmap()->toImage(); } @@ -57,7 +59,9 @@ } void QRImageWidget::saveImage() { - if (!pixmap()) return; + if (!pixmap()) { + return; + } QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), nullptr); if (!fn.isEmpty()) { @@ -66,12 +70,16 @@ } void QRImageWidget::copyImage() { - if (!pixmap()) return; + if (!pixmap()) { + return; + } QApplication::clipboard()->setImage(exportImage()); } void QRImageWidget::contextMenuEvent(QContextMenuEvent *event) { - if (!pixmap()) return; + if (!pixmap()) { + return; + } contextMenu->exec(event->globalPos()); } @@ -94,9 +102,10 @@ void ReceiveRequestDialog::setModel(WalletModel *_model) { this->model = _model; - if (_model) + if (_model) { connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(update())); + } // update the display unit if necessary update(); @@ -108,9 +117,13 @@ } void ReceiveRequestDialog::update() { - if (!model) return; + if (!model) { + return; + } QString target = info.label; - if (target.isEmpty()) target = info.address; + if (target.isEmpty()) { + target = info.address; + } setWindowTitle(tr("Request payment to %1").arg(target)); QString uri = GUIUtil::formatBitcoinURI(info); @@ -122,17 +135,20 @@ html += "" + GUIUtil::HtmlEscape(uri) + "
"; html += "" + tr("Address") + ": " + GUIUtil::HtmlEscape(info.address) + "
"; - if (info.amount != Amount::zero()) + if (info.amount != Amount::zero()) { html += "" + tr("Amount") + ": " + BitcoinUnits::formatHtmlWithUnit( model->getOptionsModel()->getDisplayUnit(), info.amount) + "
"; - if (!info.label.isEmpty()) + } + if (!info.label.isEmpty()) { html += "" + tr("Label") + ": " + GUIUtil::HtmlEscape(info.label) + "
"; - if (!info.message.isEmpty()) + } + if (!info.message.isEmpty()) { html += "" + tr("Message") + ": " + GUIUtil::HtmlEscape(info.message) + "
"; + } if (model->isMultiwallet()) { html += "" + tr("Wallet") + ": " + GUIUtil::HtmlEscape(model->getWalletName()) + "
"; diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -41,7 +41,9 @@ setCurrentWidget(ui->SendCoins); - if (platformStyle->getUseExtraSpacing()) ui->payToLayout->setSpacing(4); + if (platformStyle->getUseExtraSpacing()) { + ui->payToLayout->setSpacing(4); + } ui->addAsLabel->setPlaceholderText( tr("Enter a label for this address to add it to your address book")); @@ -73,7 +75,9 @@ } void SendCoinsEntry::on_addressBookButton_clicked() { - if (!model) return; + if (!model) { + return; + } AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); @@ -90,9 +94,10 @@ void SendCoinsEntry::setModel(WalletModel *_model) { this->model = _model; - if (_model && _model->getOptionsModel()) + if (_model && _model->getOptionsModel()) { connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + } clear(); } @@ -172,7 +177,9 @@ SendCoinsRecipient SendCoinsEntry::getValue() { // Payment request - if (recipient.paymentRequest.IsInitialized()) return recipient; + if (recipient.paymentRequest.IsInitialized()) { + return recipient; + } // Normal payment recipient.address = ui->payTo->text(); @@ -200,37 +207,42 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value) { recipient = value; - if (recipient.paymentRequest.IsInitialized()) // payment request - { - if (recipient.authenticatedMerchant.isEmpty()) // unauthenticated - { + // payment request + if (recipient.paymentRequest.IsInitialized()) { + // unauthenticated + if (recipient.authenticatedMerchant.isEmpty()) { ui->payTo_is->setText(recipient.address); ui->memoTextLabel_is->setText(recipient.message); ui->payAmount_is->setValue(recipient.amount); ui->payAmount_is->setReadOnly(true); setCurrentWidget(ui->SendCoins_UnauthenticatedPaymentRequest); - } else // authenticated - { + } + + // authenticated + else { ui->payTo_s->setText(recipient.authenticatedMerchant); ui->memoTextLabel_s->setText(recipient.message); ui->payAmount_s->setValue(recipient.amount); ui->payAmount_s->setReadOnly(true); setCurrentWidget(ui->SendCoins_AuthenticatedPaymentRequest); } - } else // normal payment - { + } + + // normal payment + else { // message ui->messageTextLabel->setText(recipient.message); ui->messageTextLabel->setVisible(!recipient.message.isEmpty()); ui->messageLabel->setVisible(!recipient.message.isEmpty()); ui->addAsLabel->clear(); - ui->payTo->setText( - recipient.address); // this may set a label from addressbook - if (!recipient.label.isEmpty()) // if a label had been set from the - // addressbook, don't overwrite with an - // empty label + // this may set a label from addressbook + ui->payTo->setText(recipient.address); + // if a label had been set from the addressbook, don't overwrite with an + // empty label + if (!recipient.label.isEmpty()) { ui->addAsLabel->setText(recipient.label); + } ui->payAmount->setValue(recipient.amount); } } @@ -266,7 +278,9 @@ } bool SendCoinsEntry::updateLabel(const QString &address) { - if (!model) return false; + if (!model) { + return false; + } // Fill in label from address book, if address has an associated label QString associatedLabel = diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -242,10 +242,11 @@ } Amount nTxFee = nDebit - wtx.tx->GetValueOut(); - if (nTxFee > Amount::zero()) + if (nTxFee > Amount::zero()) { strHTML += "" + tr("Transaction fee") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, -1 * nTxFee) + "
"; + } } else { // // Mixed debit transaction diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -67,7 +67,9 @@ } bool WalletFrame::setCurrentWallet(const QString &name) { - if (mapWalletViews.count(name) == 0) return false; + if (mapWalletViews.count(name) == 0) { + return false; + } WalletView *walletView = mapWalletViews.value(name); walletStack->setCurrentWidget(walletView); @@ -77,7 +79,9 @@ } bool WalletFrame::removeWallet(const QString &name) { - if (mapWalletViews.count(name) == 0) return false; + if (mapWalletViews.count(name) == 0) { + return false; + } WalletView *walletView = mapWalletViews.take(name); walletStack->removeWidget(walletView); @@ -86,14 +90,17 @@ void WalletFrame::removeAllWallets() { QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { walletStack->removeWidget(i.value()); + } mapWalletViews.clear(); } bool WalletFrame::handlePaymentRequest(const SendCoinsRecipient &recipient) { WalletView *walletView = currentWalletView(); - if (!walletView) return false; + if (!walletView) { + return false; + } return walletView->handlePaymentRequest(recipient); } @@ -101,72 +108,93 @@ void WalletFrame::showOutOfSyncWarning(bool fShow) { bOutOfSync = fShow; QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { i.value()->showOutOfSyncWarning(fShow); + } } void WalletFrame::gotoOverviewPage() { QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { i.value()->gotoOverviewPage(); + } } void WalletFrame::gotoHistoryPage() { QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { i.value()->gotoHistoryPage(); + } } void WalletFrame::gotoReceiveCoinsPage() { QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { i.value()->gotoReceiveCoinsPage(); + } } void WalletFrame::gotoSendCoinsPage(QString addr) { QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { i.value()->gotoSendCoinsPage(addr); + } } void WalletFrame::gotoSignMessageTab(QString addr) { WalletView *walletView = currentWalletView(); - if (walletView) walletView->gotoSignMessageTab(addr); + if (walletView) { + walletView->gotoSignMessageTab(addr); + } } void WalletFrame::gotoVerifyMessageTab(QString addr) { WalletView *walletView = currentWalletView(); - if (walletView) walletView->gotoVerifyMessageTab(addr); + if (walletView) { + walletView->gotoVerifyMessageTab(addr); + } } void WalletFrame::encryptWallet(bool status) { WalletView *walletView = currentWalletView(); - if (walletView) walletView->encryptWallet(status); + if (walletView) { + walletView->encryptWallet(status); + } } void WalletFrame::backupWallet() { WalletView *walletView = currentWalletView(); - if (walletView) walletView->backupWallet(); + if (walletView) { + walletView->backupWallet(); + } } void WalletFrame::changePassphrase() { WalletView *walletView = currentWalletView(); - if (walletView) walletView->changePassphrase(); + if (walletView) { + walletView->changePassphrase(); + } } void WalletFrame::unlockWallet() { WalletView *walletView = currentWalletView(); - if (walletView) walletView->unlockWallet(); + if (walletView) { + walletView->unlockWallet(); + } } void WalletFrame::usedSendingAddresses() { WalletView *walletView = currentWalletView(); - if (walletView) walletView->usedSendingAddresses(); + if (walletView) { + walletView->usedSendingAddresses(); + } } void WalletFrame::usedReceivingAddresses() { WalletView *walletView = currentWalletView(); - if (walletView) walletView->usedReceivingAddresses(); + if (walletView) { + walletView->usedReceivingAddresses(); + } } WalletView *WalletFrame::currentWalletView() {