From 17a7e9ba85a32d1e87a1cd884fdde7036b4dd1dd Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 16 May 2021 20:36:59 -0400 Subject: [PATCH 01/12] merge bitcoin-core/gui#337: Use Regex Search in Apptests --- src/qt/test/apptests.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index 872099a1bdc99..2793d55db1510 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #if defined(HAVE_CONFIG_H) @@ -21,9 +20,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -31,6 +32,13 @@ #include namespace { +//! Regex find a string group inside of the console output +QString FindInConsole(const QString& output, const QString& pattern) +{ + const QRegularExpression re(pattern); + return re.match(output).captured(1); +} + //! Call getblockchaininfo RPC and check first field of JSON output. void TestRpcCommand(RPCConsole* console) { @@ -42,10 +50,9 @@ void TestRpcCommand(RPCConsole* console) QTest::keyClick(lineEdit, Qt::Key_Return); QVERIFY(mw_spy.wait(1000)); QCOMPARE(mw_spy.count(), 4); - QString output = messagesWidget->toPlainText(); - UniValue value; - value.read(output.right(output.size() - output.indexOf("{")).toStdString()); - QCOMPARE(value["chain"].get_str(), std::string("regtest")); + const QString output = messagesWidget->toPlainText(); + const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\""); + QCOMPARE(FindInConsole(output, pattern), QString("regtest")); } } // namespace From 0a5481cf446c3eacd4ec10758274a812668ad460 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 3 Jun 2021 09:54:25 +0100 Subject: [PATCH 02/12] merge bitcoin-core/gui#354: Refactor open date range to use std::optional --- src/qt/transactionfilterproxy.cpp | 20 +++++++------------- src/qt/transactionfilterproxy.h | 13 ++++++------- src/qt/transactionview.cpp | 14 ++++++++------ 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index 58fbfbdfec75e..2ce2b5b4bcfd4 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -9,15 +9,8 @@ #include -// Earliest date that can be represented (far in the past) -const QDateTime TransactionFilterProxy::MIN_DATE = QDateTime::fromTime_t(0); -// Last date that can be represented (far in the future) -const QDateTime TransactionFilterProxy::MAX_DATE = QDateTime::fromTime_t(0xFFFFFFFF); - TransactionFilterProxy::TransactionFilterProxy(QObject *parent) : QSortFilterProxyModel(parent), - dateFrom(MIN_DATE.toTime_t()), - dateTo(MAX_DATE.toTime_t()), m_search_string(), typeFilter(COMMON_TYPES), watchOnlyFilter(WatchOnlyFilter_All), @@ -44,9 +37,10 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex & return false; if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes) return false; - qint64 datetime = index.data(TransactionTableModel::DateRoleInt).toLongLong(); - if (datetime < dateFrom || datetime > dateTo) - return false; + + QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime(); + if (dateFrom && datetime < *dateFrom) return false; + if (dateTo && datetime > *dateTo) return false; QString address = index.data(TransactionTableModel::AddressRole).toString(); QString label = index.data(TransactionTableModel::LabelRole).toString(); @@ -64,10 +58,10 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex & return true; } -void TransactionFilterProxy::setDateRange(const QDateTime &from, const QDateTime &to) +void TransactionFilterProxy::setDateRange(const std::optional& from, const std::optional& to) { - this->dateFrom = from.toTime_t(); - this->dateTo = to.toTime_t(); + dateFrom = from; + dateTo = to; invalidateFilter(); } diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h index dada3702964f6..41d3e18e9fdda 100644 --- a/src/qt/transactionfilterproxy.h +++ b/src/qt/transactionfilterproxy.h @@ -10,6 +10,8 @@ #include #include +#include + /** Filter the transaction list according to pre-specified rules. */ class TransactionFilterProxy : public QSortFilterProxyModel { @@ -18,10 +20,6 @@ class TransactionFilterProxy : public QSortFilterProxyModel public: explicit TransactionFilterProxy(QObject *parent = nullptr); - /** Earliest date that can be represented (far in the past) */ - static const QDateTime MIN_DATE; - /** Last date that can be represented (far in the future) */ - static const QDateTime MAX_DATE; /** Type filter bit field (all types) */ static const quint32 ALL_TYPES = 0xFFFFFFFF; /** Type filter bit field (all types but Darksend-SPAM) */ @@ -36,7 +34,8 @@ class TransactionFilterProxy : public QSortFilterProxyModel WatchOnlyFilter_No }; - void setDateRange(const QDateTime &from, const QDateTime &to); + /** Filter transactions between date range. Use std::nullopt for open range. */ + void setDateRange(const std::optional& from, const std::optional& to); void setSearchString(const QString &); /** @note Type filter takes a bit field created with TYPE() or ALL_TYPES @@ -57,8 +56,8 @@ class TransactionFilterProxy : public QSortFilterProxyModel bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override; private: - qint64 dateFrom; - qint64 dateTo; + std::optional dateFrom; + std::optional dateTo; QString m_search_string; quint32 typeFilter; WatchOnlyFilter watchOnlyFilter; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 80e030c24f1be..55760147c5b20 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include #include #include @@ -265,26 +267,26 @@ void TransactionView::chooseDate(int idx) { case All: transactionProxyModel->setDateRange( - TransactionFilterProxy::MIN_DATE, - TransactionFilterProxy::MAX_DATE); + std::nullopt, + std::nullopt); break; case Today: transactionProxyModel->setDateRange( GUIUtil::StartOfDay(current), - TransactionFilterProxy::MAX_DATE); + std::nullopt); break; case ThisWeek: { // Find last Monday QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1)); transactionProxyModel->setDateRange( GUIUtil::StartOfDay(startOfWeek), - TransactionFilterProxy::MAX_DATE); + std::nullopt); } break; case ThisMonth: transactionProxyModel->setDateRange( GUIUtil::StartOfDay(QDate(current.year(), current.month(), 1)), - TransactionFilterProxy::MAX_DATE); + std::nullopt); break; case LastMonth: transactionProxyModel->setDateRange( @@ -294,7 +296,7 @@ void TransactionView::chooseDate(int idx) case ThisYear: transactionProxyModel->setDateRange( GUIUtil::StartOfDay(QDate(current.year(), 1, 1)), - TransactionFilterProxy::MAX_DATE); + std::nullopt); break; case Range: dateRangeWidget->setVisible(true); From 70d4e08011bd0ea04e2296a6f9182385f24079d6 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 23 Apr 2021 14:57:05 +0200 Subject: [PATCH 03/12] merge bitcoin-core/gui#317: Add Direction column to Peers Tab --- src/qt/peertablemodel.cpp | 10 ++++++++-- src/qt/peertablemodel.h | 4 ++++ src/qt/peertablesortproxy.cpp | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 182ff17b55c2a..45c0b68b25e1b 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -74,8 +74,13 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const case Age: return GUIUtil::FormatPeerAge(rec->nodeStats.m_connected); case Address: - // prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection - return QString::fromStdString((rec->nodeStats.fInbound ? "↓ " : "↑ ") + rec->nodeStats.m_addr_name); + return QString::fromStdString(rec->nodeStats.m_addr_name); + case Direction: + return QString(rec->nodeStats.fInbound ? + //: An Inbound Connection from a Peer. + tr("Inbound") : + //: An Outbound Connection to a Peer. + tr("Outbound")); case ConnectionType: return GUIUtil::ConnectionTypeToQString(rec->nodeStats.m_conn_type, /* prepend_direction */ false); case Network: @@ -97,6 +102,7 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const return QVariant(Qt::AlignRight | Qt::AlignVCenter); case Address: return {}; + case Direction: case ConnectionType: case Network: return QVariant(Qt::AlignCenter); diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index cf101149fdfea..1ab0962defbcc 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -49,6 +49,7 @@ class PeerTableModel : public QAbstractTableModel NetNodeId = 0, Age, Address, + Direction, ConnectionType, Network, Ping, @@ -91,6 +92,9 @@ public Q_SLOTS: /*: Title of Peers Table column which contains the IP/Onion/I2P address of the connected peer. */ tr("Address"), + /*: Title of Peers Table column which indicates the direction + the peer connection was initiated from. */ + tr("Direction"), /*: Title of Peers Table column which describes the type of peer connection. The "type" describes why the connection exists. */ tr("Type"), diff --git a/src/qt/peertablesortproxy.cpp b/src/qt/peertablesortproxy.cpp index 6d716366fa59f..9b280f7dea1b3 100644 --- a/src/qt/peertablesortproxy.cpp +++ b/src/qt/peertablesortproxy.cpp @@ -28,6 +28,8 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd return left_stats.m_connected > right_stats.m_connected; case PeerTableModel::Address: return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0; + case PeerTableModel::Direction: + return left_stats.fInbound > right_stats.fInbound; // default sort Inbound, then Outbound case PeerTableModel::ConnectionType: return left_stats.m_conn_type < right_stats.m_conn_type; case PeerTableModel::Network: From ba5ad1fc6c0e1d4a8ffae321b9be34f34d6487d8 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:12:56 +0000 Subject: [PATCH 04/12] merge bitcoin-core/gui#349: replace QDateTime::fromTime_t with QDateTime::fromSecsSinceEpoch --- src/qt/bitcoingui.cpp | 8 ++++---- src/qt/clientmodel.cpp | 4 ++-- src/qt/guiutil.cpp | 2 +- src/qt/recentrequeststablemodel.cpp | 2 +- src/qt/recentrequeststablemodel.h | 6 ++++-- src/qt/rpcconsole.cpp | 2 +- src/qt/transactionfilterproxy.cpp | 2 ++ src/qt/transactiontablemodel.cpp | 2 +- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 98ba9297da8e6..e4f13195e64df 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -819,8 +819,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH connect(_clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections); connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive); - modalOverlay->setKnownBestHeight(tip_info->header_height, QDateTime::fromTime_t(tip_info->header_time)); - setNumBlocks(tip_info->block_height, QDateTime::fromTime_t(tip_info->block_time), QString::fromStdString(tip_info->block_hash.ToString()), tip_info->verification_progress, false, SynchronizationState::INIT_DOWNLOAD); + modalOverlay->setKnownBestHeight(tip_info->header_height, QDateTime::fromSecsSinceEpoch(tip_info->header_time)); + setNumBlocks(tip_info->block_height, QDateTime::fromSecsSinceEpoch(tip_info->block_time), QString::fromStdString(tip_info->block_hash.ToString()), tip_info->verification_progress, false, SynchronizationState::INIT_DOWNLOAD); connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks); connect(_clientModel, &ClientModel::additionalDataSyncProgressChanged, this, &BitcoinGUI::setAdditionalDataSyncProgress); @@ -1281,7 +1281,7 @@ void BitcoinGUI::updateNetworkState() } if (fNetworkBecameActive || fNetworkBecameInactive) { - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); + setNumBlocks(m_node.getNumBlocks(), QDateTime::fromSecsSinceEpoch(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); } nCountPrev = count; @@ -1545,7 +1545,7 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress) // If masternodeSync->Reset() has been called make sure status bar shows the correct information. if (nSyncProgress == -1) { - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); + setNumBlocks(m_node.getNumBlocks(), QDateTime::fromSecsSinceEpoch(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); if (clientModel->getNumConnections()) { labelBlocksIcon->show(); startSpinner(); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index ea1df1ac6b0e0..d604e3ac79455 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -251,7 +251,7 @@ bool ClientModel::isReleaseVersion() const QString ClientModel::formatClientStartupTime() const { - return QDateTime::fromTime_t(GetStartupTime()).toString(); + return QDateTime::fromSecsSinceEpoch(GetStartupTime()).toString(); } QString ClientModel::dataDir() const @@ -329,7 +329,7 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_ bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection, Q_ARG(int, tip.block_height), - Q_ARG(QDateTime, QDateTime::fromTime_t(tip.block_time)), + Q_ARG(QDateTime, QDateTime::fromSecsSinceEpoch(tip.block_time)), Q_ARG(QString, QString::fromStdString(tip.block_hash.ToString())), Q_ARG(double, verificationProgress), Q_ARG(bool, fHeader), diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 40f74f73e7bda..84afe40bba44d 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -263,7 +263,7 @@ QString dateTimeStr(const QDateTime &date) QString dateTimeStr(qint64 nTime) { - return dateTimeStr(QDateTime::fromTime_t((qint32)nTime)); + return dateTimeStr(QDateTime::fromSecsSinceEpoch((qint32)nTime)); } QFont fixedPitchFont(bool use_embedded_font) diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index c28fef6490245..9474b6d397ef8 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -234,7 +234,7 @@ bool RecentRequestEntryLessThan::operator()(const RecentRequestEntry& left, cons switch(column) { case RecentRequestsTableModel::Date: - return pLeft->date.toTime_t() < pRight->date.toTime_t(); + return pLeft->date.toSecsSinceEpoch() < pRight->date.toSecsSinceEpoch(); case RecentRequestsTableModel::Label: return pLeft->recipient.label < pRight->recipient.label; case RecentRequestsTableModel::Message: diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h index ee2cd405cb86d..0b323482e9399 100644 --- a/src/qt/recentrequeststablemodel.h +++ b/src/qt/recentrequeststablemodel.h @@ -7,6 +7,8 @@ #include +#include + #include #include #include @@ -26,9 +28,9 @@ class RecentRequestEntry SERIALIZE_METHODS(RecentRequestEntry, obj) { unsigned int date_timet; - SER_WRITE(obj, date_timet = obj.date.toTime_t()); + SER_WRITE(obj, date_timet = obj.date.toSecsSinceEpoch()); READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient); - SER_READ(obj, obj.date = QDateTime::fromTime_t(date_timet)); + SER_READ(obj, obj.date = QDateTime::fromSecsSinceEpoch(date_timet)); } }; diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index b2be3934188a9..09b6b84806688 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -696,7 +696,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ setNumConnections(model->getNumConnections()); connect(model, &ClientModel::numConnectionsChanged, this, &RPCConsole::setNumConnections); - setNumBlocks(bestblock_height, QDateTime::fromTime_t(bestblock_date), QString::fromStdString(bestblock_hash.ToString()), verification_progress, false); + setNumBlocks(bestblock_height, QDateTime::fromSecsSinceEpoch(bestblock_date), QString::fromStdString(bestblock_hash.ToString()), verification_progress, false); connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks); connect(model, &ClientModel::chainLockChanged, this, &RPCConsole::setChainLock); diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index 2ce2b5b4bcfd4..1e515c22fc300 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -7,7 +7,9 @@ #include #include +#include #include +#include TransactionFilterProxy::TransactionFilterProxy(QObject *parent) : QSortFilterProxyModel(parent), diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 0a7b0066c38a6..f276a4a5941cd 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -697,7 +697,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case TypeRole: return rec->type; case DateRole: - return QDateTime::fromTime_t(static_cast(rec->time)); + return QDateTime::fromSecsSinceEpoch(rec->time); case DateRoleInt: return qint64(rec->time); case WatchonlyRole: From 594177d5fe130af4d651b97080a755750a097aca Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 25 Oct 2024 21:26:02 +0000 Subject: [PATCH 05/12] merge bitcoin-core/gui#403: Make paths to update Encryption and HD wallet statuses simpler --- src/qt/bitcoingui.cpp | 17 +++++++++-------- src/qt/walletframe.cpp | 3 ++- src/qt/walletframe.h | 1 + src/qt/walletview.cpp | 11 +---------- src/qt/walletview.h | 5 ----- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e4f13195e64df..9cdd8851dcd46 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -112,14 +112,15 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, { /** Create wallet frame*/ walletFrame = new WalletFrame(this); - connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) { - this->message(title, message, style); - }); connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] { auto activity = new CreateWalletActivity(getWalletController(), this); connect(activity, &CreateWalletActivity::finished, activity, &QObject::deleteLater); activity->create(); }); + connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) { + this->message(title, message, style); + }); + connect(walletFrame, &WalletFrame::currentWalletSet, [this] { updateWalletStatus(); }); } else #endif // ENABLE_WALLET { @@ -932,7 +933,6 @@ void BitcoinGUI::addWallet(WalletModel* walletModel) }); connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus); connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction); - connect(wallet_view, &WalletView::hdEnabledStatusChanged, this, &BitcoinGUI::updateWalletStatus); connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy); wallet_view->setPrivacy(isPrivacyModeActivated()); const QString display_name = walletModel->getDisplayName(); @@ -1679,7 +1679,9 @@ void BitcoinGUI::changeEvent(QEvent *e) if (e->type() == QEvent::StyleChange) { updateNetworkState(); #ifdef ENABLE_WALLET - updateWalletStatus(); + if (walletFrame) { + updateWalletStatus(); + } #endif if (m_node.masternodeSync().isSynced()) { labelBlocksIcon->setPixmap(GUIUtil::getIcon("synced", GUIUtil::ThemedColor::GREEN).pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); @@ -1911,9 +1913,8 @@ void BitcoinGUI::setEncryptionStatus(int status) void BitcoinGUI::updateWalletStatus() { - if (!walletFrame) { - return; - } + assert(walletFrame); + WalletView * const walletView = walletFrame->currentWalletView(); if (!walletView) { return; diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 0148003e207ae..d97b1d7553120 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -123,7 +123,8 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model) walletView->updateGeometry(); walletStack->setCurrentWidget(walletView); - walletView->updateEncryptionStatus(); + + Q_EMIT currentWalletSet(); } void WalletFrame::removeWallet(WalletModel* wallet_model) diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 4b76dc40ec618..948af49ad6d82 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -50,6 +50,7 @@ class WalletFrame : public QFrame Q_SIGNALS: void message(const QString& title, const QString& message, unsigned int style); + void currentWalletSet(); void createWalletButtonClicked(); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 6869854ced73b..1a994366606f5 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -177,10 +177,6 @@ void WalletView::setWalletModel(WalletModel *_walletModel) // Handle changes in encryption status connect(_walletModel, &WalletModel::encryptionStatusChanged, this, &WalletView::encryptionStatusChanged); - updateEncryptionStatus(); - - // update HD status - Q_EMIT hdEnabledStatusChanged(); // Balloon pop-up for new transaction connect(_walletModel->getTransactionTableModel(), &TransactionTableModel::rowsInserted, this, &WalletView::processNewTransaction); @@ -304,11 +300,6 @@ void WalletView::showOutOfSyncWarning(bool fShow) overviewPage->showOutOfSyncWarning(fShow); } -void WalletView::updateEncryptionStatus() -{ - Q_EMIT encryptionStatusChanged(); -} - void WalletView::encryptWallet() { if(!walletModel) @@ -317,7 +308,7 @@ void WalletView::encryptWallet() dlg.setModel(walletModel); dlg.exec(); - updateEncryptionStatus(); + Q_EMIT encryptionStatusChanged(); } void WalletView::backupWallet() diff --git a/src/qt/walletview.h b/src/qt/walletview.h index 8886de7ecb5dc..30dab9f170694 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -116,9 +116,6 @@ public Q_SLOTS: /** Show used receiving addresses */ void usedReceivingAddresses(); - /** Re-emit encryption status signal */ - void updateEncryptionStatus(); - /** Show progress dialog e.g. for rescan */ void showProgress(const QString &title, int nProgress); @@ -132,8 +129,6 @@ public Q_SLOTS: void message(const QString &title, const QString &message, unsigned int style); /** Encryption status of wallet changed */ void encryptionStatusChanged(); - /** HD-Enabled status of wallet changed (only possible during startup) */ - void hdEnabledStatusChanged(); /** Notify that a new transaction appeared */ void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName); /** Notify that the out of sync warning icon has been pressed */ From fa2f7acc2a8882dde6a54fb16a63169eaf97ac2e Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sat, 4 Sep 2021 18:44:39 -0400 Subject: [PATCH 06/12] merge bitcoin-core/gui#418: fix bitcoin-qt app categorization on apple silicon --- share/qt/Info.plist.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in index fbdfbd983d20a..2ea3204cd2e7d 100644 --- a/share/qt/Info.plist.in +++ b/share/qt/Info.plist.in @@ -16,6 +16,11 @@ CFBundlePackageType APPL + CFBundleSupportedPlatforms + + MacOSX + + CFBundleShortVersionString @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@ From 063ef3a2d0a623a4a42b54f45b916f64dc5cad9e Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:36:09 +0000 Subject: [PATCH 07/12] merge bitcoin-core/gui#416: Add RPC setting --- doc/release-notes-6337.md | 5 +++++ src/qt/forms/optionsdialog.ui | 14 ++++++++++++-- src/qt/optionsdialog.cpp | 2 ++ src/qt/optionsmodel.cpp | 15 +++++++++++++++ src/qt/optionsmodel.h | 1 + 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 doc/release-notes-6337.md diff --git a/doc/release-notes-6337.md b/doc/release-notes-6337.md new file mode 100644 index 0000000000000..e10943ee2a1f0 --- /dev/null +++ b/doc/release-notes-6337.md @@ -0,0 +1,5 @@ +GUI changes +----------- + +A new option has been added in to the "Main" tab in "Options" that allow +users to enable RPC server functionality. diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 8f53b2fa8c322..31ce3b6e7e3e7 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -112,7 +112,7 @@ Automatically start %1 after logging in to the system. - &Start %1 on system login + Start %1 on system &login @@ -291,13 +291,23 @@ 40 - 20 + 40 + + + + This allows you or a third party tool to communicate with the node through command-line and JSON-RPC commands. + + + Enable RPC &server + + + diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index a5587373bb90e..3f6b485c956f0 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -267,6 +267,7 @@ void OptionsDialog::setModel(OptionsModel *_model) connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Network */ connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); + connect(ui->enableServer, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Display */ @@ -343,6 +344,7 @@ void OptionsDialog::setMapper() mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); mapper->addMapping(ui->mapPortNatpmp, OptionsModel::MapPortNatpmp); mapper->addMapping(ui->allowIncoming, OptionsModel::Listen); + mapper->addMapping(ui->enableServer, OptionsModel::Server); mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse); mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 874a255b840c5..c2a13d224c223 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -275,6 +275,13 @@ void OptionsModel::Init(bool resetSettings) gArgs.SoftSetBoolArg("-listenonion", false); } + if (!settings.contains("server")) { + settings.setValue("server", false); + } + if (!gArgs.SoftSetBoolArg("-server", settings.value("server").toBool())) { + addOverriddenOption("-server"); + } + if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); if (!settings.contains("addrProxy")) @@ -529,6 +536,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const return settings.value("nThreadsScriptVerif"); case Listen: return settings.value("fListen"); + case Server: + return settings.value("server"); default: return QVariant(); } @@ -795,6 +804,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in setRestartRequired(true); } break; + case Server: + if (settings.value("server") != value) { + settings.setValue("server", value); + setRestartRequired(true); + } + break; default: break; } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index b34804ed21499..dc2343d137a4a 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -86,6 +86,7 @@ class OptionsModel : public QAbstractListModel CoinJoinDenomsHardCap,// int CoinJoinMultiSession, // bool Listen, // bool + Server, // bool OptionIDRowCount, }; From 694f3e9cf14cf3f1ce42b9b4c231f8ba32dda0a9 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:16:41 +0000 Subject: [PATCH 08/12] merge bitcoin-core/gui#449: Restore "S" accelerator for "Start on system login" option --- src/qt/forms/optionsdialog.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 31ce3b6e7e3e7..a431ac6558896 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -112,7 +112,7 @@ Automatically start %1 after logging in to the system. - Start %1 on system &login + &Start %1 on system login @@ -304,7 +304,7 @@ This allows you or a third party tool to communicate with the node through command-line and JSON-RPC commands. - Enable RPC &server + Enable R&PC server From f088334c8aee267b58d3c63237877dab18d54ca8 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:28:08 +0000 Subject: [PATCH 09/12] merge bitcoin-core/gui#477: Monospaced output in Console on macOS --- src/qt/rpcconsole.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 09b6b84806688..4e2a08f33b381 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -962,7 +962,11 @@ void RPCConsole::clear(bool keep_prompt) ui->lineEdit->setFocus(); // Set default style sheet +#ifdef Q_OS_MAC + ui->messagesWidget->setFont(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true)); +#else ui->messagesWidget->setFont(GUIUtil::fixedPitchFont()); +#endif ui->messagesWidget->document()->setDefaultStyleSheet( QString( "table { }" From 0c545ac0e96e0f00de7043bd97bbfebe30a85ffb Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 8 Mar 2022 19:41:38 +0100 Subject: [PATCH 10/12] merge bitcoin-core/gui#563: Remove network detection based on address in BIP21 --- src/qt/bitcoin.cpp | 2 +- src/qt/paymentserver.cpp | 23 +---------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 47b5801c51ddf..19882c4929d91 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -658,7 +658,7 @@ int GuiMain(int argc, char* argv[]) return EXIT_FAILURE; } #ifdef ENABLE_WALLET - // Parse URIs on command line -- this can affect Params() + // Parse URIs on command line PaymentServer::ipcParseCommandLine(argc, argv); #endif diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index de76e1625b158..72553e81bb634 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -79,32 +79,11 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[]) for (int i = 1; i < argc; i++) { QString arg(argv[i]); - if (arg.startsWith("-")) - continue; + if (arg.startsWith("-")) continue; - // If the dash: URI contains a payment request, we are not able to detect the - // network as that would require fetching and parsing the payment request. - // That means clicking such an URI which contains a testnet payment request - // will start a mainnet instance and throw a "wrong network" error. if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // dash: URI { - if (savedPaymentRequests.contains(arg)) continue; savedPaymentRequests.insert(arg); - - SendCoinsRecipient r; - if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty()) - { - auto tempChainParams = CreateChainParams(gArgs, CBaseChainParams::MAIN); - - if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) { - SelectParams(CBaseChainParams::MAIN); - } else { - tempChainParams = CreateChainParams(gArgs, CBaseChainParams::TESTNET); - if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) { - SelectParams(CBaseChainParams::TESTNET); - } - } - } } } } From 3d5aca6a0b3fe6b3497976625fef9cece280f6d2 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 20 Feb 2022 22:23:39 +0100 Subject: [PATCH 11/12] merge bitcoin-core/gui#554: Add and improve translator comments and tooltips for peers tab address fields --- src/qt/forms/debugwindow.ui | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index c45f6bcaeb474..87ba808545f6f 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -1587,10 +1587,10 @@ - Whether we relay addresses to this peer. + Whether we relay addresses to this peer. - Address Relay + Address Relay @@ -1613,10 +1613,10 @@ - Total number of addresses processed, excluding those dropped due to rate-limiting. + The total number of addresses received from this peer that were processed (excludes addresses that were dropped due to rate-limiting). - Addresses Processed + Addresses Processed @@ -1639,10 +1639,10 @@ - Total number of addresses dropped due to rate-limiting. + The total number of addresses received from this peer that were dropped (not processed) due to rate-limiting. - Addresses Rate-Limited + Addresses Rate-Limited From 1a2c02a42ddcf8f2025f2260e64791f0142eaa5f Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:57:57 +0000 Subject: [PATCH 12/12] merge bitcoin-core/gui#615: If -prune=0 is set, Uncheck Prune on Intro page --- src/qt/intro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index c84607c033789..a90535acbc4c0 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -293,7 +293,7 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable ui->freeSpace->setText(""); } else { m_bytes_available = bytesAvailable; - if (ui->prune->isEnabled()) { + if (ui->prune->isEnabled() && !(gArgs.IsArgSet("-prune") && gArgs.GetArg("-prune", 0) == 0)) { ui->prune->setChecked(m_bytes_available < (m_blockchain_size_gb + m_chain_state_size_gb + 10) * GB_BYTES); } UpdateFreeSpaceLabel();