From d670240d131a7353ba74470d2219855ea245ab9b Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 12 Jul 2024 17:12:51 +0700 Subject: [PATCH 1/8] Revert "fix: remove stretching from Overview page when it's not needed" This reverts commit b9a2ce74c0062618b69918d6150ec6660a11042e. --- src/qt/forms/overviewpage.ui | 47 +++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 4410467029c4b..947edb70a2e41 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -37,7 +37,23 @@ - + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 20 + + + + @@ -560,6 +576,19 @@ + + + + Qt::Horizontal + + + + 10 + 20 + + + + @@ -629,6 +658,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 20 + + + + From 458384ab93dc2dc95943bf70c77bf8748e92b662 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 21 Jan 2021 18:53:49 +0100 Subject: [PATCH 2/8] Merge bitcoin-core/gui#176: Fix TxViewDelegate layout af58f5b12cea91467692dd4ae71d8cc916a608ed qt: Stop the effect of hidden widgets on the size of QStackedWidget (Hennadii Stepanov) f0d04795e23606399414d074d78efe5aa0da7259 qt: Fix TxViewDelegate layout (Hennadii Stepanov) d43992140679fb9a5ebc7850923679033f9837f3 qt: Add TransactionOverviewWidget class (Hennadii Stepanov) Pull request description: This change: - prevents overlapping date and amount strings - guaranties that "eye" sign at the end of the watch-only address/label is always visible Fix https://github.com/bitcoin/bitcoin/issues/20826 Here are some screenshots with this PR with the _minimum available width_ of the transaction list widget: ![Screenshot from 2021-01-03 20-23-56](https://user-images.githubusercontent.com/32963518/103486411-6408ca00-4e06-11eb-9c21-627a65e532c1.png) ![Screenshot from 2021-01-03 20-24-47](https://user-images.githubusercontent.com/32963518/103486413-6834e780-4e06-11eb-8221-478d98bbdf69.png) ![Screenshot from 2021-01-03 20-25-27](https://user-images.githubusercontent.com/32963518/103486418-6d923200-4e06-11eb-8625-a4ed3089b6ab.png) ![Screenshot from 2021-01-03 20-33-20](https://user-images.githubusercontent.com/32963518/103486420-708d2280-4e06-11eb-90c2-f2463fb3c4b3.png) ACKs for top commit: dooglus: ACK af58f5b. jarolrod: re-ACK af58f5b12cea91467692dd4ae71d8cc916a608ed Tree-SHA512: 6dae682490ec50fa0335d220bc2d153fa3e6ed578f07c6353a3b180f8f6cf1c2f9e52ebd7b3076f51d7004d86bf5cca14e6b5db9cdf786e85a57a81eacbb4988 --- src/Makefile.qt.include | 2 ++ src/qt/forms/overviewpage.ui | 15 ++++++++++- src/qt/overviewpage.cpp | 28 +++++++++++++++++--- src/qt/transactionoverviewwidget.h | 41 ++++++++++++++++++++++++++++++ src/qt/walletframe.cpp | 17 ++++++++++++- 5 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 src/qt/transactionoverviewwidget.h diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 8ca112d131d98..885a0e5334006 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -87,6 +87,7 @@ QT_MOC_CPP = \ qt/moc_transactiondesc.cpp \ qt/moc_transactiondescdialog.cpp \ qt/moc_transactionfilterproxy.cpp \ + qt/moc_transactionoverviewwidget.cpp \ qt/moc_transactiontablemodel.cpp \ qt/moc_transactionview.cpp \ qt/moc_utilitydialog.cpp \ @@ -164,6 +165,7 @@ BITCOIN_QT_H = \ qt/transactiondesc.h \ qt/transactiondescdialog.h \ qt/transactionfilterproxy.h \ + qt/transactionoverviewwidget.h \ qt/transactionrecord.h \ qt/transactiontablemodel.h \ qt/transactionview.h \ diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 947edb70a2e41..062be8e6b537e 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -638,7 +638,7 @@ - + QFrame::NoFrame @@ -648,9 +648,15 @@ Qt::ScrollBarAlwaysOff + + QAbstractScrollArea::AdjustToContents + QAbstractItemView::NoSelection + + true + @@ -678,6 +684,13 @@ + + + TransactionOverviewWidget + QListView +
qt/transactionoverviewwidget.h
+
+
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index c530787b32241..16c2a5dfae145 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #include #include +#include +#include #include #include @@ -42,7 +45,7 @@ class TxViewDelegate : public QAbstractItemDelegate explicit TxViewDelegate(QObject* parent = nullptr) : QAbstractItemDelegate(), unit(BitcoinUnits::DASH) { - + connect(this, &TxViewDelegate::width_changed, this, &TxViewDelegate::sizeHintChanged); } inline void paint(QPainter *painter, const QStyleOptionViewItem &option, @@ -83,7 +86,8 @@ class TxViewDelegate : public QAbstractItemDelegate qint64 nAmount = index.data(TransactionTableModel::AmountRole).toLongLong(); QString strAmount = BitcoinUnits::floorWithUnit(unit, nAmount, true, BitcoinUnits::SeparatorStyle::ALWAYS); painter->setPen(colorForeground); - painter->drawText(rectTopHalf, Qt::AlignRight | Qt::AlignVCenter, strAmount); + QRect amount_bounding_rect; + painter->drawText(rectTopHalf, Qt::AlignRight | Qt::AlignVCenter, strAmount, &amount_bounding_rect); // Draw second line (with the initial font) // Content: Address/label, Optional Watchonly indicator @@ -93,6 +97,7 @@ class TxViewDelegate : public QAbstractItemDelegate QString address = indexAddress.data(Qt::DisplayRole).toString(); painter->setPen(colorForeground); painter->drawText(rectBottomHalf, Qt::AlignLeft | Qt::AlignVCenter, address, &rectBounding); + int address_rect_min_width = rectBounding.width(); // Optional Watchonly indicator if (index.data(TransactionTableModel::WatchonlyRole).toBool()) { @@ -101,17 +106,32 @@ class TxViewDelegate : public QAbstractItemDelegate iconWatchonly.paint(painter, rectWatchonly); } + const int minimum_width = std::max(address_rect_min_width, amount_bounding_rect.width() /*+ date_bounding_rect.width() */); + const auto search = m_minimum_width.find(index.row()); + if (search == m_minimum_width.end() || search->second != minimum_width) { + m_minimum_width[index.row()] = minimum_width; + Q_EMIT width_changed(index); + } painter->restore(); } inline QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override { - return QSize(ITEM_HEIGHT, ITEM_HEIGHT); + const auto search = m_minimum_width.find(index.row()); + const int minimum_text_width = search == m_minimum_width.end() ? 0 : search->second; + return {ITEM_HEIGHT + 8 + minimum_text_width, ITEM_HEIGHT}; } int unit; +Q_SIGNALS: + //! An intermediate signal for emitting from the `paint() const` member function. + void width_changed(const QModelIndex& index) const; + +private: + mutable std::map m_minimum_width; }; + #include OverviewPage::OverviewPage(QWidget* parent) : @@ -151,7 +171,7 @@ OverviewPage::OverviewPage(QWidget* parent) : // Note: minimum height of listTransactions will be set later in updateAdvancedCJUI() to reflect actual settings ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); - connect(ui->listTransactions, &QListView::clicked, this, &OverviewPage::handleTransactionClicked); + connect(ui->listTransactions, &TransactionOverviewWidget::clicked, this, &OverviewPage::handleTransactionClicked); // init "out of sync" warning labels ui->labelWalletStatus->setText("(" + tr("out of sync") + ")"); diff --git a/src/qt/transactionoverviewwidget.h b/src/qt/transactionoverviewwidget.h new file mode 100644 index 0000000000000..2bdead7bc40e9 --- /dev/null +++ b/src/qt/transactionoverviewwidget.h @@ -0,0 +1,41 @@ +// Copyright (c) 2021 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H +#define BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QShowEvent; +class QWidget; +QT_END_NAMESPACE + +class TransactionOverviewWidget : public QListView +{ + Q_OBJECT + +public: + explicit TransactionOverviewWidget(QWidget* parent = nullptr) : QListView(parent) {} + + QSize sizeHint() const override + { + return {sizeHintForColumn(TransactionTableModel::ToAddress), QListView::sizeHint().height()}; + } + +protected: + void showEvent(QShowEvent* event) override + { + Q_UNUSED(event); + QSizePolicy sp = sizePolicy(); + sp.setHorizontalPolicy(QSizePolicy::Minimum); + setSizePolicy(sp); + } +}; + +#endif // BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 36eeebaf82ab6..13d5102b927aa 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -117,9 +117,24 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model) { if (mapWalletViews.count(wallet_model) == 0) return; + // Stop the effect of hidden widgets on the size hint of the shown one in QStackedWidget. + WalletView* view_about_to_hide = currentWalletView(); + if (view_about_to_hide) { + QSizePolicy sp = view_about_to_hide->sizePolicy(); + sp.setHorizontalPolicy(QSizePolicy::Ignored); + view_about_to_hide->setSizePolicy(sp); + } + WalletView *walletView = mapWalletViews.value(wallet_model); - walletStack->setCurrentWidget(walletView); assert(walletView); + + // Set or restore the default QSizePolicy which could be set to QSizePolicy::Ignored previously. + QSizePolicy sp = walletView->sizePolicy(); + sp.setHorizontalPolicy(QSizePolicy::Preferred); + walletView->setSizePolicy(sp); + walletView->updateGeometry(); + + walletStack->setCurrentWidget(walletView); walletView->updateEncryptionStatus(); } From 0d1faa203e80e6ab429cf0c1d836866b46a7d39e Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 12 Jul 2024 17:33:24 +0700 Subject: [PATCH 3/8] fix: removed maximum width of transaction list on overview page It makes bitcoin-core/gui#205 to works correctly --- src/qt/res/css/general.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index 59f4c3a4ab986..af65262129052 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -1544,7 +1544,6 @@ QWidget .QFrame#frame_2 .QLabel#labelTransactionsStatus { /* Recent Transactions QWidget .QFrame#frame_2 QListView { /* Transaction List */ background: #00000000; - max-width: 430px; margin-right: 10px; } From 63b18006a311f623e0183ca2d6c28656b26ab465 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 7 Mar 2021 18:56:13 +0100 Subject: [PATCH 4/8] Merge bitcoin-core/gui#221: qt, refactor: rpcconsole translatable string fixes and improvements 6242beeb067139c01dd27c63ebcd24df5808cb15 Hoist repeated translated strings to RPCConsole struct members (Jon Atack) 0f035c12fb0a5c5f98fc2b9907d475c08018df36 RPCConsole::updateDetailWidget: convert strings to translated strings (Jon Atack) Pull request description: - fixups from #206 review feedback (thanks!), see commit message for details - hoists repeatedly used translatable strings to the `RPCConsole` class for reuse ACKs for top commit: hebasto: re-ACK 6242beeb067139c01dd27c63ebcd24df5808cb15 Talkless: tACK 6242beeb067139c01dd27c63ebcd24df5808cb15, tested on Debian Sid with Qt 5.15.2. I see "Ban for.." translated to my native language as before, "To/From/Yes/No" are not but that's expected, as `.ts` files are not updated. jarolrod: ACK 6242beeb067139c01dd27c63ebcd24df5808cb15 Tree-SHA512: 20a296511c5ac03a816766237fa2731b0360dedebf1bea02711eb21d7e4eae2a63a051fe48f4726052edc3e6318952f01fef920cd4b22a8196c39c23d8e5cc3a --- src/qt/rpcconsole.cpp | 46 +++++++++++++++++++++---------------------- src/qt/rpcconsole.h | 5 +++++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index e763bb13ada44..ecd53638ed6b4 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -531,9 +531,9 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags const QString list{"
  • " + Join(CONNECTION_TYPE_DOC, QString("
  • ")) + "
"}; ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list)); const QString hb_list{"
  • \"" - + tr("To") + "\" – " + tr("we selected the peer for high bandwidth relay") + "
  • \"" - + tr("From") + "\" – " + tr("the peer selected us for high bandwidth relay") + "
  • \"" - + tr("No") + "\" – " + tr("no high bandwidth relay selected") + "
"}; + + ts.to + "\" – " + tr("we selected the peer for high bandwidth relay") + "
  • \"" + + ts.from + "\" – " + tr("the peer selected us for high bandwidth relay") + "
  • \"" + + ts.no + "\" – " + tr("no high bandwidth relay selected") + "
  • "}; ui->peerHighBandwidthLabel->setToolTip(ui->peerHighBandwidthLabel->toolTip().arg(hb_list)); ui->dataDir->setToolTip(ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) + "datadir")); ui->blocksDir->setToolTip(ui->blocksDir->toolTip().arg(QString(nonbreaking_hyphen) + "blocksdir")); @@ -707,10 +707,10 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ // create peer table context menu actions QAction* disconnectAction = new QAction(tr("&Disconnect"), this); - QAction* banAction1h = new QAction(tr("Ban for") + " " + tr("1 &hour"), this); - QAction* banAction24h = new QAction(tr("Ban for") + " " + tr("1 &day"), this); - QAction* banAction7d = new QAction(tr("Ban for") + " " + tr("1 &week"), this); - QAction* banAction365d = new QAction(tr("Ban for") + " " + tr("1 &year"), this); + QAction* banAction1h = new QAction(ts.ban_for + " " + tr("1 &hour"), this); + QAction* banAction24h = new QAction(ts.ban_for + " " + tr("1 &day"), this); + QAction* banAction7d = new QAction(ts.ban_for + " " + tr("1 &week"), this); + QAction* banAction365d = new QAction(ts.ban_for + " " + tr("1 &year"), this); // create peer table context menu peersTableContextMenu = new QMenu(this); @@ -1301,9 +1301,9 @@ void RPCConsole::updateDetailWidget() ui->peerLastBlock->setText(TimeDurationField(time_now, stats->nodeStats.m_last_block_time)); ui->peerLastTx->setText(TimeDurationField(time_now, stats->nodeStats.m_last_tx_time)); QString bip152_hb_settings; - if (stats->nodeStats.m_bip152_highbandwidth_to) bip152_hb_settings += "To"; - if (stats->nodeStats.m_bip152_highbandwidth_from) bip152_hb_settings += (bip152_hb_settings == "" ? "From" : "/From"); - if (bip152_hb_settings == "") bip152_hb_settings = "No"; + if (stats->nodeStats.m_bip152_highbandwidth_to) bip152_hb_settings = ts.to; + if (stats->nodeStats.m_bip152_highbandwidth_from) bip152_hb_settings += (bip152_hb_settings.isEmpty() ? ts.from : QLatin1Char('/') + ts.from); + if (bip152_hb_settings.isEmpty()) bip152_hb_settings = ts.no; ui->peerHighBandwidth->setText(bip152_hb_settings); ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.m_last_send)); ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.m_last_recv)); @@ -1317,7 +1317,7 @@ void RPCConsole::updateDetailWidget() ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /* prepend_direction */ true)); ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network)); if (stats->nodeStats.m_permissionFlags == NetPermissionFlags::None) { - ui->peerPermissions->setText(tr("N/A")); + ui->peerPermissions->setText(ts.na); } else { QStringList permissions; for (const auto& permission : NetPermissions::ToStrings(stats->nodeStats.m_permissionFlags)) { @@ -1325,11 +1325,11 @@ void RPCConsole::updateDetailWidget() } ui->peerPermissions->setText(permissions.join(" & ")); } - ui->peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) : tr("N/A")); + ui->peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) : ts.na); auto dmn = clientModel->getMasternodeList().first.GetMNByService(stats->nodeStats.addr); if (dmn == nullptr) { ui->peerNodeType->setText(tr("Regular")); - ui->peerPoSeScore->setText(tr("N/A")); + ui->peerPoSeScore->setText(ts.na); } else { if (stats->nodeStats.verifiedProRegTxHash.IsNull()) { ui->peerNodeType->setText(tr("Masternode")); @@ -1343,23 +1343,23 @@ void RPCConsole::updateDetailWidget() // nodeStateStats couldn't be fetched. if (stats->fNodeStateStatsAvailable) { // Sync height is init to -1 - if (stats->nodeStateStats.nSyncHeight > -1) + if (stats->nodeStateStats.nSyncHeight > -1) { ui->peerSyncHeight->setText(QString("%1").arg(stats->nodeStateStats.nSyncHeight)); - else - ui->peerSyncHeight->setText(tr("Unknown")); - + } else { + ui->peerSyncHeight->setText(ts.unknown); + } // Common height is init to -1 - if (stats->nodeStateStats.nCommonHeight > -1) + if (stats->nodeStateStats.nCommonHeight > -1) { ui->peerCommonHeight->setText(QString("%1").arg(stats->nodeStateStats.nCommonHeight)); - else - ui->peerCommonHeight->setText(tr("Unknown")); - + } else { + ui->peerCommonHeight->setText(ts.unknown); + } ui->peerHeight->setText(QString::number(stats->nodeStateStats.m_starting_height)); ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStateStats.m_ping_wait)); - ui->peerAddrRelayEnabled->setText(stats->nodeStateStats.m_addr_relay_enabled ? "Yes" : "No"); + ui->peerAddrRelayEnabled->setText(stats->nodeStateStats.m_addr_relay_enabled ? ts.yes : ts.no); ui->peerAddrProcessed->setText(QString::number(stats->nodeStateStats.m_addr_processed)); ui->peerAddrRateLimited->setText(QString::number(stats->nodeStateStats.m_addr_rate_limited)); - ui->peerRelayTxes->setText(stats->nodeStateStats.m_relay_txs ? "Yes" : "No"); + ui->peerRelayTxes->setText(stats->nodeStateStats.m_relay_txs ? ts.yes : ts.no); } ui->peersTabRightPanel->show(); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 5549d30b70af2..2834311ca5666 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -154,6 +154,11 @@ public Q_SLOTS: void handleRestart(QStringList args); private: + struct TranslatedStrings { + const QString yes{tr("Yes")}, no{tr("No")}, to{tr("To")}, from{tr("From")}, + ban_for{tr("Ban for")}, na{tr("N/A")}, unknown{tr("Unknown")}; + } const ts; + void startExecutor(); void setTrafficGraphRange(TrafficGraphData::GraphRange range); /** Build parameter list for restart */ From 48d66fd1abeabaf9fc1031b0505b582e7244ee20 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 23 Mar 2021 15:57:52 +0100 Subject: [PATCH 5/8] Merge bitcoin-core/gui#248: Fix: For values of "Bytes transferred" and "Bytes/s" with 1000-based prefix names use 1000-based divisor instead of 1024-based d09ebc47233187ab8dd5a70df4d261353958978c Fix wrong(1024) divisor for 1000-based prefixes (wodry) Pull request description: v.0.21.0 I saw in the GUI peer window in the "received" column `1007 KB`, and after increasing to >=1024 I guess, it switched to `1 MB`. I would have expected the display unit to change from KB to MB already at value >=1000. I looked into the code, and the values appear to be power-of-2 byte values, so the switching at >=1024 and not >=1000 seems correct. But the unit display is not precisely correct, binary prefixes should be used for power-of-2 byte values. To be correct, this PR changes ~~KB/MB/GB to KiB/MiB/GiB.~~ KB to kB and the divisor from 1024 to 1000. ACKs for top commit: hebasto: ACK d09ebc47233187ab8dd5a70df4d261353958978c, tested on Linux Mint 20.1 (Qt 5.12.8) the both "Network Traffic" and "Peers" tabs of the "Node Window". jarolrod: ACK d09ebc47233187ab8dd5a70df4d261353958978c leonardojobim: Tested ACK https://github.com/bitcoin-core/gui/pull/248/commits/d09ebc47233187ab8dd5a70df4d261353958978c on Ubuntu 20.04 Qt 5.12.8 Tree-SHA512: 8f830b08cc3fd36dc8a18f1192959fe55d1644938044bf31d770f7c3bf8475fba6da5019a2d2024d5b2c81a8dab112f360c555367814a14f4d05c89d130f25b0 --- src/qt/guiutil.cpp | 12 ++++++------ src/qt/trafficgraphwidget.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 14761903cf756..336fa2a1ce826 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1785,14 +1785,14 @@ QString formatNiceTimeOffset(qint64 secs) QString formatBytes(uint64_t bytes) { - if(bytes < 1024) + if (bytes < 1'000) return QObject::tr("%1 B").arg(bytes); - if(bytes < 1024 * 1024) - return QObject::tr("%1 KB").arg(bytes / 1024); - if(bytes < 1024 * 1024 * 1024) - return QObject::tr("%1 MB").arg(bytes / 1024 / 1024); + if (bytes < 1'000'000) + return QObject::tr("%1 kB").arg(bytes / 1'000); + if (bytes < 1'000'000'000) + return QObject::tr("%1 MB").arg(bytes / 1'000'000); - return QObject::tr("%1 GB").arg(bytes / 1024 / 1024 / 1024); + return QObject::tr("%1 GB").arg(bytes / 1'000'000'000); } qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) { diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 5f19928456722..f33d7845358ee 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -98,7 +98,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) float val = pow(10.0f, base); float val2 = val; - const QString units = tr("KB/s"); + const QString units = tr("kB/s"); const float yMarginText = 2.0; // draw lines From 29a98c7826411bf29a158fc2e4cf6ce9912e6279 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 29 Mar 2021 07:39:40 +0200 Subject: [PATCH 6/8] Merge bitcoin-core/gui#251: Improve URI/file handling message ef3e1d7272d294c65cc9904079571cf67dc6c463 qt: Improve URI/file handling message (Hennadii Stepanov) Pull request description: This PR: - fixes missing spaces after full stops - makes the translation context much bigger The latter is the main motivation for this PR, as I became a translator :tiger2: Screenshots: - master (a9d1b40d53ec417eefbe767aa66701ef8e1801d5) ![DeepinScreenshot_select-area_20210317211750](https://user-images.githubusercontent.com/32963518/111527570-bd776880-8768-11eb-9035-96bb08067e74.png) - this PR: ![Screenshot from 2021-03-17 21-13-36](https://user-images.githubusercontent.com/32963518/111527727-e7308f80-8768-11eb-95c7-e8b802bfed5f.png) ACKs for top commit: jarolrod: ACK ef3e1d7272d294c65cc9904079571cf67dc6c463 Tree-SHA512: 8fbd1e3731b75866356fae201b3129126001600ca0197e83c05825e8c5bbbcf0132d6a6b808d7a5cbfbdde75ed1865ecbb651c30017570abd7c5803eff2b9306 --- src/qt/paymentserver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 693177fd800b0..4392774f4447b 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -239,8 +239,8 @@ void PaymentServer::handleURIOrFile(const QString& s) if (!IsValidDestination(dest)) { if (uri.hasQueryItem("r")) { // payment request Q_EMIT message(tr("URI handling"), - tr("Cannot process payment request as BIP70 is no longer supported.")+ - tr("Due to discontinued support, you should request the merchant to provide you with a BIP21 compatible URI or use a wallet that does continue to support BIP70."), + tr("Cannot process payment request as BIP70 is no longer supported.\n" + "Due to discontinued support, you should request the merchant to provide you with a BIP21 compatible URI or use a wallet that does continue to support BIP70."), CClientUIInterface::ICON_WARNING); } else { Q_EMIT message(tr("URI handling"), QString::fromStdString(error_msg), @@ -262,8 +262,8 @@ void PaymentServer::handleURIOrFile(const QString& s) if (QFile::exists(s)) // payment request file { Q_EMIT message(tr("Payment request file handling"), - tr("Cannot process payment request as BIP70 is no longer supported.")+ - tr("Due to discontinued support, you should request the merchant to provide you with a BIP21 compatible URI or use a wallet that does continue to support BIP70."), + tr("Cannot process payment request as BIP70 is no longer supported.\n" + "Due to discontinued support, you should request the merchant to provide you with a BIP21 compatible URI or use a wallet that does continue to support BIP70."), CClientUIInterface::ICON_WARNING); } } From e5c2c0398489cf41a4548fae78943d4d8ef4615a Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 29 Mar 2021 11:17:06 +0200 Subject: [PATCH 7/8] Merge bitcoin-core/gui#154: qt: Support macOS Dark mode dc4551c22c46104d18e8e7a8bf133cbebe4bc89f remove incompatibility release note for darkmode on macos (Sylvain Goumy) 303cfc62277efccf242dc5a51368e349dc2782e3 allow darkmode on macos build (Sylvain Goumy) 78f75a2d60d4930e6e8d1b27030205179adf7f6d Allow icon colorization on mac os to better support dark mode (Uplab) Pull request description: Allow icons to be colorized on macOS to support native Dark mode color scheme. Rendering on macOS Big Sur before PR: ![macos-darkmode-before-pr](https://user-images.githubusercontent.com/5577626/102502739-43f3af80-407f-11eb-9263-5bbc27b371c2.png) Rendering on macOS Big Sur after PR: ![macos-darkmode-after-pr](https://user-images.githubusercontent.com/5577626/102502678-350cfd00-407f-11eb-8b98-e271f2688c36.png) Light mode stay visually unchanged. Note, that this currently only affect the build from source, as the macos dmg includes an attributes to force light color scheme on macos windows (see https://github.com/bitcoin/bitcoin/pull/14593). But once all glitches are fixed, we will be able to remove this temporary fix. Edit: this PR is know including the removal of `NSRequiresAquaSystemAppearance` on Info.plist file so that the color fix is apply to every build. Linked issues: #68 #136 ACKs for top commit: hebasto: re-ACK dc4551c22c46104d18e8e7a8bf133cbebe4bc89f jarolrod: ACK dc4551c22c46104d18e8e7a8bf133cbebe4bc89f Tree-SHA512: 1c3a4dec796063e61fcaf80112afc2b15c8669a1cd30ebd537cea96647c20215f8f80289719f905820bb0c490c8c1f94bfae4bb32f9c6d1fdd4e8f199ebb559f --- doc/release-notes-154.md | 4 ++++ share/qt/Info.plist.in | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 doc/release-notes-154.md diff --git a/doc/release-notes-154.md b/doc/release-notes-154.md new file mode 100644 index 0000000000000..a31e82433b94b --- /dev/null +++ b/doc/release-notes-154.md @@ -0,0 +1,4 @@ +Compatibility +============== + +Dash Core change appearance when macOS "dark mode" is activated. diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in index bc6b302b2d356..fbdfbd983d20a 100644 --- a/share/qt/Info.plist.in +++ b/share/qt/Info.plist.in @@ -56,9 +56,6 @@ NSHighResolutionCapable True - NSRequiresAquaSystemAppearance - True - NSHumanReadableCopyright Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers, 2014-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@ LSApplicationCategoryType From 2917c33206d4ee5de3c41f1917441c704b5b7518 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 23 Jul 2024 13:11:29 +0700 Subject: [PATCH 8/8] partial Merge bitcoin-core/gui#205: Save/restore TransactionView and recentRequestsView tables column sizes We use Stretched column width, it's not compatible with gui#205 Though, this type of columns have better UI, but it is very slow performance, see https://github.com/dashpay/dash/pull/6111#pullrequestreview-2178370404 -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Date, QHeaderView::Interactive); -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Label, QHeaderView::Stretch); +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Date, QHeaderView::ResizeToContents); +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Label, QHeaderView::Interactive); tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Message, QHeaderView::Stretch); -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Amount, QHeaderView::Fixed); +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Amount, QHeaderView::ResizeToContents); --- src/qt/transactionview.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 573d91d64fd3a..b51361a64683e 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -126,24 +126,23 @@ TransactionView::TransactionView(QWidget* parent) : vlayout->setContentsMargins(0,0,0,0); vlayout->setSpacing(0); - QTableView *view = new QTableView(this); + transactionView = new QTableView(this); vlayout->addLayout(hlayout); vlayout->addWidget(createDateRangeWidget()); - vlayout->addWidget(view); + vlayout->addWidget(transactionView); vlayout->setSpacing(0); #ifndef Q_OS_MAC - int width = view->verticalScrollBar()->sizeHint().width(); + int width = transactionView->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing hlayout->addSpacing(width); // Always show scroll bar - view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + transactionView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); #endif - view->setTabKeyNavigation(false); - view->setContextMenuPolicy(Qt::CustomContextMenu); + transactionView->setTabKeyNavigation(false); + transactionView->setContextMenuPolicy(Qt::CustomContextMenu); - view->installEventFilter(this); + transactionView->installEventFilter(this); - transactionView = view; transactionView->setObjectName("transactionView"); // Actions @@ -185,9 +184,9 @@ TransactionView::TransactionView(QWidget* parent) : connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, static_cast(&QTimer::start)); connect(prefix_typing_delay, &QTimer::timeout, this, &TransactionView::changedSearch); - connect(view, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); - connect(view, &QTableView::clicked, this, &TransactionView::computeSum); - connect(view, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu); + connect(transactionView, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); + connect(transactionView, &QTableView::clicked, this, &TransactionView::computeSum); + connect(transactionView, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu); connect(abandonAction, &QAction::triggered, this, &TransactionView::abandonTx); connect(resendAction, &QAction::triggered, this, &TransactionView::resendTx);