diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 63886e2346..ef71c6fc2e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -216,6 +216,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(true); + progressBarLabel->setObjectName("lblStatusBarProgress"); progressBar = new GUIUtil::ProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(true); diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 3be30dad4a..b19e91a685 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -475,6 +475,9 @@ n/a + + true + @@ -482,30 +485,63 @@ - - - (Last Message) + + + 0 - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Start/Stop Mixing + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - 0 - 0 - + + + Qt::Vertical - - Start/Stop Mixing + + + 20 + 40 + - + diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index b1e08ca05c..432f3018f5 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -778,8 +778,11 @@ 6 + + 3 + - + @@ -855,6 +858,12 @@ + + 20 + + + 3 + @@ -885,6 +894,9 @@ + + 30 + @@ -916,7 +928,10 @@ 6 - 2 + 0 + + + 3 @@ -976,19 +991,6 @@ - - - - Qt::Vertical - - - - 1 - 1 - - - - @@ -1136,7 +1138,7 @@ 3 - + Balance: @@ -1145,7 +1147,7 @@ - + 0 0 diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index e5be69d03c..0084dbf283 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -206,6 +206,7 @@ bool Intro::pickDataDirectory() /* Let the user choose one */ Intro intro; GUIUtil::disableMacFocusRect(&intro); + GUIUtil::loadStyleSheet(&intro); intro.setDataDirectory(dataDirDefaultCurrent); intro.setWindowIcon(QIcon(":icons/bitcoin")); diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index b40d73d0e2..d77498cfbb 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -167,9 +167,11 @@ void OptionsDialog::setModel(OptionsModel *_model) showRestartWarning(true); QString strLabel = _model->getOverriddenByCommandLine(); - if (strLabel.isEmpty()) - strLabel = tr("none"); - ui->overriddenByCommandLineLabel->setText(strLabel); + if (strLabel.isEmpty()) { + ui->frame->setHidden(true); + } else { + ui->overriddenByCommandLineLabel->setText(strLabel); + } mapper->setModel(_model); setMapper(); diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index c44b1c998f..46e2fc69f6 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -305,6 +305,9 @@ void OverviewPage::setWalletModel(WalletModel *model) // explicitly update PS frame and transaction list to reflect actual settings updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI()); + // Initialize PS UI + privateSendStatus(true); + if(!privateSendClient.fEnablePrivateSend) return; connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress())); @@ -467,15 +470,23 @@ void OverviewPage::updateAdvancedPSUI(bool fShowAdvancedPSUI) { ui->privateSendProgress->setVisible(fShowAdvancedPSUI); ui->labelSubmittedDenomText->setVisible(fShowAdvancedPSUI); ui->labelSubmittedDenom->setVisible(fShowAdvancedPSUI); - ui->labelPrivateSendLastMessage->setVisible(fShowAdvancedPSUI); } -void OverviewPage::privateSendStatus() +void OverviewPage::privateSendStatus(bool fForce) { - if(!masternodeSync.IsBlockchainSynced() || ShutdownRequested()) return; + if (!fForce && (!masternodeSync.IsBlockchainSynced() || ShutdownRequested())) return; if(!walletModel) return; + auto tempWidgets = {ui->labelSubmittedDenomText, + ui->labelSubmittedDenom}; + + auto setWidgetsVisible = [&](bool fVisible) { + for (const auto& it : tempWidgets) { + it->setVisible(fVisible); + } + }; + static int64_t nLastDSProgressBlockTime = 0; int nBestHeight = clientModel->getNumBlocks(); @@ -495,7 +506,7 @@ void OverviewPage::privateSendStatus() updatePrivateSendProgress(); } - ui->labelPrivateSendLastMessage->setText(""); + setWidgetsVisible(false); ui->togglePrivateSend->setText(tr("Start Mixing")); QString strEnabled = tr("Disabled"); @@ -574,14 +585,7 @@ void OverviewPage::privateSendStatus() updatePrivateSendProgress(); } - QString strStatus = QString(privateSendClient.GetStatuses().c_str()); - - QString s = tr("Last PrivateSend message:\n") + strStatus; - - if(s != ui->labelPrivateSendLastMessage->text()) - LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Last PrivateSend message: %s\n", strStatus.toStdString()); - - ui->labelPrivateSendLastMessage->setText(s); + setWidgetsVisible(true); ui->labelSubmittedDenom->setText(QString(privateSendClient.GetSessionDenoms().c_str())); } diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index b77ad49c70..ff64edfe50 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -38,7 +38,7 @@ public: void showOutOfSyncWarning(bool fShow); public Q_SLOTS: - void privateSendStatus(); + void privateSendStatus(bool fForce = false); void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 2d42b01beb..441d3662da 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -137,7 +137,7 @@ void ReceiveRequestDialog::update() ui->btnSaveAs->setEnabled(false); QString html; html += ""; - html += ""+tr("Payment information")+"
"; + html += "" + tr("Payment information") + "

"; html += ""+tr("URI")+": "; html += QString("" + GUIUtil::HtmlEscape(uri) + "
"; @@ -165,34 +165,39 @@ void ReceiveRequestDialog::update() ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } - QImage qrImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); + QImage qrImage = QImage(code->width + 6, code->width + 6, QImage::Format_RGB32); qrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET)); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { - qrImage.setPixel(x + 4, y + 4, ((*p & 1) ? GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL).rgb() : GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET).rgb())); + qrImage.setPixel(x + 3, y + 3, ((*p & 1) ? GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL).rgb() : GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET).rgb())); p++; } } QRcode_free(code); - - QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE+20, QImage::Format_RGB32); - qrAddrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET)); + // Create the image with respect to the device pixel ratio + int qrAddrImageWidth = QR_IMAGE_SIZE; + int qrAddrImageHeight = QR_IMAGE_SIZE + 20; + qreal scale = qApp->devicePixelRatio(); + QImage qrAddrImage = QImage(qrAddrImageWidth * scale, qrAddrImageHeight * scale, QImage::Format_RGB32); + qrAddrImage.setDevicePixelRatio(scale); QPainter painter(&qrAddrImage); - QRect paddedRect = qrAddrImage.rect().adjusted(1, 1, -1, -1); + // Fill the whole image with border color + qrAddrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET)); + // Create a 2px/2px smaller rect and fill it with background color to keep the 1px border with the border color + QRect paddedRect = QRect(1, 1, qrAddrImageWidth - 2, qrAddrImageHeight - 2); painter.fillRect(paddedRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET)); - painter.drawImage(1, 1, qrImage.scaled(QR_IMAGE_SIZE - 2, QR_IMAGE_SIZE - 2)); - QFont font = GUIUtil::fixedPitchFont(); - + painter.drawImage(2, 2, qrImage.scaled(QR_IMAGE_SIZE - 4, QR_IMAGE_SIZE - 4)); // calculate ideal font size - qreal font_size = GUIUtil::calculateIdealFontSize(paddedRect.width() - 20, info.address, font); + QFont font = GUIUtil::fixedPitchFont(); + qreal font_size = GUIUtil::calculateIdealFontSize((paddedRect.width() - 20), info.address, font); font.setPointSizeF(font_size); - + // paint the address painter.setFont(font); - paddedRect.setHeight(QR_IMAGE_SIZE); painter.setPen(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL)); + paddedRect.setHeight(QR_IMAGE_SIZE + 3); painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, info.address); painter.end(); diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index b1ec4d4456..a0e98789b0 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -1482,12 +1482,6 @@ QWidget .QFrame#framePrivateSend .QWidget#layoutWidgetLastMessageAndButtons { max-width: 451px; } -QWidget .QFrame#framePrivateSend .QLabel#labelPrivateSendLastMessage { /* PrivateSend Status Notifications */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - min-width: 288px; - min-height: 50px; -} - QWidget .QFrame#framePrivateSend .QPushButton#togglePrivateSend { /* Start PrivateSend Mixing */ margin-top: 5px; } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 7edd4982de..35889bc9cb 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // TODO: add a scrollback limit, as there is currently none // TODO: make it possible to filter out categories (esp debug messages when implemented) @@ -717,6 +718,9 @@ void RPCConsole::setClientModel(ClientModel *model) wordList << "help-console"; wordList.sort(); autoCompleter = new QCompleter(wordList, this); + autoCompleter->popup()->setItemDelegate(new QStyledItemDelegate(this)); + autoCompleter->popup()->setObjectName("rpcAutoCompleter"); + GUIUtil::loadStyleSheet(autoCompleter->popup()); autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel); ui->lineEdit->setCompleter(autoCompleter); autoCompleter->popup()->installEventFilter(this); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 9a4952b94c..fd699c97f9 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -78,7 +78,7 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p }, GUIUtil::FontWeight::Bold); GUIUtil::setFont({ui->labelBalance, - ui->label + ui->labelBalanceText }, GUIUtil::FontWeight::Bold, 14); GUIUtil::setFont({ui->labelCoinControlFeatures diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 693e1f051f..2e3a537486 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -185,11 +185,11 @@ void TestGUI() QString paymentText = rlist->toPlainText(); QStringList paymentTextList = paymentText.split('\n'); QCOMPARE(paymentTextList.at(0), QString("Payment information")); - QVERIFY(paymentTextList.at(1).indexOf(QString("URI: dash:")) != -1); - QVERIFY(paymentTextList.at(2).indexOf(QString("Address:")) != -1); - QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + BitcoinUnits::name(unit)); - QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1")); - QCOMPARE(paymentTextList.at(5), QString("Message: TEST_MESSAGE_1")); + QVERIFY(paymentTextList.at(2).indexOf(QString("URI: dash:")) != -1); + QVERIFY(paymentTextList.at(3).indexOf(QString("Address:")) != -1); + QCOMPARE(paymentTextList.at(4), QString("Amount: 0.00000001 ") + BitcoinUnits::name(unit)); + QCOMPARE(paymentTextList.at(5), QString("Label: TEST_LABEL_1")); + QCOMPARE(paymentTextList.at(6), QString("Message: TEST_MESSAGE_1")); } } diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 0754dc9c1b..c371e5800a 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -79,6 +79,9 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) { QPainter painter(this); QRect drawRect = rect(); + // First draw the border + painter.fillRect(drawRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET)); + drawRect.adjust(1, 1, -1, -1); painter.fillRect(drawRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET)); if(fMax <= 0.0f) return; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 982c6a3edb..3ef3f39351 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -69,6 +71,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa instantsendWidget->addItem(tr("All"), TransactionFilterProxy::InstantSendFilter_All); instantsendWidget->addItem(tr("Locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_Yes); instantsendWidget->addItem(tr("Not locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_No); + instantsendWidget->setObjectName("instantsendWidget"); hlayout->addWidget(instantsendWidget); dateWidget = new QComboBox(this); @@ -645,9 +648,25 @@ QWidget *TransactionView::createDateRangeWidget() connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); + updateCalendarWidgets(); + return dateRangeWidget; } +void TransactionView::updateCalendarWidgets() +{ + auto adjustWeekEndColors = [](QCalendarWidget* w) { + QTextCharFormat format = w->weekdayTextFormat(Qt::Saturday); + format.setForeground(QBrush(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::DEFAULT), Qt::SolidPattern)); + + w->setWeekdayTextFormat(Qt::Saturday, format); + w->setWeekdayTextFormat(Qt::Sunday, format); + }; + + adjustWeekEndColors(dateFrom->calendarWidget()); + adjustWeekEndColors(dateTo->calendarWidget()); +} + void TransactionView::dateRangeChanged() { if(!transactionProxyModel) @@ -709,6 +728,13 @@ void TransactionView::resizeEvent(QResizeEvent* event) columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); } +void TransactionView::changeEvent(QEvent* e) +{ + if (e->type() == QEvent::StyleChange) { + updateCalendarWidgets(); + } +} + // Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text bool TransactionView::eventFilter(QObject *obj, QEvent *event) { @@ -721,6 +747,14 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event) return true; } } + if (event->type() == QEvent::Show) { + // Give the search field the first focus on startup + static bool fGotFirstFocus = false; + if (!fGotFirstFocus) { + search_widget->setFocus(); + fGotFirstFocus = true; + } + } return QWidget::eventFilter(obj, event); } diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index 9591027f9a..5d4833b242 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -82,10 +82,12 @@ private: QAction *abandonAction; QWidget *createDateRangeWidget(); + void updateCalendarWidgets(); GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; virtual void resizeEvent(QResizeEvent* event) override; + void changeEvent(QEvent* e) override; bool eventFilter(QObject *obj, QEvent *event) override;