Skip to content

Commit 9061ad0

Browse files
PastaPastaPastathepastaclaw
authored andcommitted
Merge dashpay#7118: feat(qt): UI refresh (4/n, introduce distinct widgets for Dash-specific reporting in debug window)
f85a459 refactor(qt): move debug log action from General widget to File menu (Kittywhiskers Van Gogh) 7839115 feat(qt): add tooltip for quorum statistics with rotation, expiry, age (Kittywhiskers Van Gogh) 8a721c2 refactor(qt): move "Chainlocks" outside hlayout due to value width (Kittywhiskers Van Gogh) dff26d6 refactor(qt): use horizontal layout with vertical grids, reorder data (Kittywhiskers Van Gogh) 12dc7fe feat(qt): report quorum statistics in network widget (Kittywhiskers Van Gogh) 26ed211 feat(qt): report credit pool statistics in network widget (Kittywhiskers Van Gogh) b9a14cc qt: show more instantsend counters (pending, waiting, unprotected) in UI (Kittywhiskers Van Gogh) a4e9fbc qt: report chainlock time to maintain parity with block fields (Kittywhiskers Van Gogh) ab8d6d2 qt: register chainlocks information as a feed, treat UI notif as trigger (Kittywhiskers Van Gogh) 654724d qt: register instantsend information as a feed, replace polling approach (Kittywhiskers Van Gogh) ba406f5 interfaces: introduce UI signal `NotifyInstantSendChanged` (Kittywhiskers Van Gogh) d1f61f5 refactor: drop now-unused cached masternode list routine (Kittywhiskers Van Gogh) 6bb3e6b chore(qt): update header and label descriptions based on capability (Kittywhiskers Van Gogh) 918cba1 refactor(qt): move Dash-specific reporting to network widget (Kittywhiskers Van Gogh) 0a64bab refactor(qt): move debug window stats to separate information widget (Kittywhiskers Van Gogh) dfec7d8 fix(qt): align headers in debug window's information tab (Kittywhiskers Van Gogh) b524eef qt: precompute mappings to avoid expensive searches (Kittywhiskers Van Gogh) 960666b qt: switch ProposalList to consume masternode list feed (Kittywhiskers Van Gogh) d9beeec qt: switch RPCConsole and leftover MasternodeList code to feed (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Depends on dashpay#7112 * Depends on dashpay#7110 * Depends on dashpay#7146 * Dependency for dashpay#7159 | v23.0.2 (cdc5a63) | This PR (WIP code) | | -------------------- | ------------------- | | ![](https://github.com/user-attachments/assets/6e1220dc-816f-468d-a81e-b92a05eed392) | ![](https://github.com/user-attachments/assets/f4035e26-6f9c-4c78-a4ae-8a86f64c9dc9) | | <div align="center">See above</div> | ![](https://github.com/user-attachments/assets/be22de45-8e26-4777-8328-c30f414806be) | | <div align="center">Does not exist in this build</div> | ![](https://github.com/user-attachments/assets/49e9dba4-d29c-435e-b1ea-829c03df9550) | | <div align="center">Does not exist in this build</div> | ![](https://github.com/user-attachments/assets/8993faeb-9c4b-44b8-a9e9-3af86eb16b7c) | ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK f85a459 UdjinM6: light ACK f85a459 Tree-SHA512: 8f555721c9fc9951c5fcdcb4b0a8e102a16ce5c89cf0a2641e416f09689fc3de5f502cf05ba7abe5c6acd962f0d072bcd8bf787a0c9d21b1fd706a58ff69b326
1 parent 64cc4f2 commit 9061ad0

34 files changed

+1983
-841
lines changed

src/Makefile.qt.include

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ QT_FORMS_UI = \
2424
qt/forms/descriptiondialog.ui \
2525
qt/forms/editaddressdialog.ui \
2626
qt/forms/helpmessagedialog.ui \
27+
qt/forms/informationwidget.ui \
2728
qt/forms/intro.ui \
2829
qt/forms/masternodelist.ui \
2930
qt/forms/mnemonicverificationdialog.ui \
3031
qt/forms/modaloverlay.ui \
32+
qt/forms/networkwidget.ui \
3133
qt/forms/openuridialog.ui \
3234
qt/forms/optionsdialog.ui \
3335
qt/forms/overviewpage.ui \
@@ -62,6 +64,7 @@ QT_MOC_CPP = \
6264
qt/moc_descriptiondialog.cpp \
6365
qt/moc_editaddressdialog.cpp \
6466
qt/moc_guiutil.cpp \
67+
qt/moc_informationwidget.cpp \
6568
qt/moc_initexecutor.cpp \
6669
qt/moc_intro.cpp \
6770
qt/moc_macdockiconhandler.cpp \
@@ -70,6 +73,7 @@ QT_MOC_CPP = \
7073
qt/moc_masternodemodel.cpp \
7174
qt/moc_mnemonicverificationdialog.cpp \
7275
qt/moc_modaloverlay.cpp \
76+
qt/moc_networkwidget.cpp \
7377
qt/moc_notificator.cpp \
7478
qt/moc_openuridialog.cpp \
7579
qt/moc_optionsdialog.cpp \
@@ -145,6 +149,7 @@ BITCOIN_QT_H = \
145149
qt/guiconstants.h \
146150
qt/guiutil_font.h \
147151
qt/guiutil.h \
152+
qt/informationwidget.h \
148153
qt/initexecutor.h \
149154
qt/intro.h \
150155
qt/macdockiconhandler.h \
@@ -155,6 +160,7 @@ BITCOIN_QT_H = \
155160
qt/mnemonicverificationdialog.h \
156161
qt/modaloverlay.h \
157162
qt/networkstyle.h \
163+
qt/networkwidget.h \
158164
qt/notificator.h \
159165
qt/openuridialog.h \
160166
qt/optionsdialog.h \
@@ -189,6 +195,7 @@ BITCOIN_QT_H = \
189195
qt/transactionrecord.h \
190196
qt/transactiontablemodel.h \
191197
qt/transactionview.h \
198+
qt/util.h \
192199
qt/utilitydialog.h \
193200
qt/walletcontroller.h \
194201
qt/walletframe.h \
@@ -254,10 +261,12 @@ BITCOIN_QT_BASE_CPP = \
254261
qt/csvmodelwriter.cpp \
255262
qt/guiutil.cpp \
256263
qt/guiutil_font.cpp \
264+
qt/informationwidget.cpp \
257265
qt/initexecutor.cpp \
258266
qt/intro.cpp \
259267
qt/modaloverlay.cpp \
260268
qt/networkstyle.cpp \
269+
qt/networkwidget.cpp \
261270
qt/notificator.cpp \
262271
qt/optionsdialog.cpp \
263272
qt/optionsmodel.cpp \

src/instantsend/net_instantsend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <instantsend/net_instantsend.h>
66

77
#include <bls/bls_batchverifier.h>
8+
#include <node/interface_ui.h>
89
#include <cxxtimer.hpp>
910
#include <instantsend/instantsend.h>
1011
#include <llmq/commitment.h>
@@ -307,6 +308,7 @@ void NetInstantSend::ProcessPendingISLocks(std::vector<instantsend::PendingISLoc
307308
// Now check against the previous active set and perform banning if this fails
308309
ProcessPendingInstantSendLocks(llmq_params, dkgInterval, /*ban=*/true, still_pending);
309310
}
311+
uiInterface.NotifyInstantSendChanged();
310312
}
311313

312314
void NetInstantSend::WorkThreadMain()

src/interfaces/node.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,13 @@ class MnList
115115
virtual uint256 getBlockHash() const = 0;
116116

117117
virtual void forEachMN(bool only_valid, std::function<void(const MnEntryCPtr&)> cb) const = 0;
118-
virtual MnEntryCPtr getMN(const uint256& hash) const = 0;
119-
virtual MnEntryCPtr getMNByService(const CService& service) const = 0;
120-
virtual MnEntryCPtr getValidMN(const uint256& hash) const = 0;
121118
virtual std::vector<MnEntryCPtr> getProjectedMNPayees(const CBlockIndex* pindex) const = 0;
122119

123-
virtual void copyContextTo(MnList& mn_list) const = 0;
124120
virtual void setContext(node::NodeContext* context) = 0;
125121
};
126122

127123
using MnListPtr = std::shared_ptr<MnList>;
128124

129-
MnListPtr MakeMNList(const CDeterministicMNList& mn_list);
130-
131125
//! Interface for the src/evo part of a dash node (dashd process).
132126
class EVO
133127
{
@@ -517,6 +511,10 @@ class Node
517511
std::function<void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)>;
518512
virtual std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) = 0;
519513

514+
//! Register handler for InstantSend data messages.
515+
using NotifyInstantSendChangedFn = std::function<void()>;
516+
virtual std::unique_ptr<Handler> handleNotifyInstantSendChanged(NotifyInstantSendChangedFn fn) = 0;
517+
520518
//! Register handler for governance data messages.
521519
using NotifyGovernanceChangedFn = std::function<void()>;
522520
virtual std::unique_ptr<Handler> handleNotifyGovernanceChanged(NotifyGovernanceChangedFn fn) = 0;

src/node/interface_ui.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct UISignals {
2424
boost::signals2::signal<CClientUIInterface::NotifyChainLockSig> NotifyChainLock;
2525
boost::signals2::signal<CClientUIInterface::NotifyHeaderTipSig> NotifyHeaderTip;
2626
boost::signals2::signal<CClientUIInterface::NotifyGovernanceChangedSig> NotifyGovernanceChanged;
27+
boost::signals2::signal<CClientUIInterface::NotifyInstantSendChangedSig> NotifyInstantSendChanged;
2728
boost::signals2::signal<CClientUIInterface::NotifyMasternodeListChangedSig> NotifyMasternodeListChanged;
2829
boost::signals2::signal<CClientUIInterface::NotifyAdditionalDataSyncProgressChangedSig> NotifyAdditionalDataSyncProgressChanged;
2930
boost::signals2::signal<CClientUIInterface::BannedListChangedSig> BannedListChanged;
@@ -48,6 +49,7 @@ ADD_SIGNALS_IMPL_WRAPPER(NotifyBlockTip);
4849
ADD_SIGNALS_IMPL_WRAPPER(NotifyChainLock);
4950
ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip);
5051
ADD_SIGNALS_IMPL_WRAPPER(NotifyGovernanceChanged);
52+
ADD_SIGNALS_IMPL_WRAPPER(NotifyInstantSendChanged);
5153
ADD_SIGNALS_IMPL_WRAPPER(NotifyMasternodeListChanged);
5254
ADD_SIGNALS_IMPL_WRAPPER(NotifyAdditionalDataSyncProgressChanged);
5355
ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
@@ -64,6 +66,7 @@ void CClientUIInterface::NotifyBlockTip(SynchronizationState s, const CBlockInde
6466
void CClientUIInterface::NotifyChainLock(const std::string& bestChainLockHash, int bestChainLockHeight) { return g_ui_signals.NotifyChainLock(bestChainLockHash, bestChainLockHeight); }
6567
void CClientUIInterface::NotifyHeaderTip(SynchronizationState s, const CBlockIndex* i) { return g_ui_signals.NotifyHeaderTip(s, i); }
6668
void CClientUIInterface::NotifyGovernanceChanged() { return g_ui_signals.NotifyGovernanceChanged(); }
69+
void CClientUIInterface::NotifyInstantSendChanged() { return g_ui_signals.NotifyInstantSendChanged(); }
6770
void CClientUIInterface::NotifyMasternodeListChanged(const CDeterministicMNList& list, const CBlockIndex* i) { return g_ui_signals.NotifyMasternodeListChanged(list, i); }
6871
void CClientUIInterface::NotifyAdditionalDataSyncProgressChanged(double nSyncProgress) { return g_ui_signals.NotifyAdditionalDataSyncProgressChanged(nSyncProgress); }
6972
void CClientUIInterface::BannedListChanged() { return g_ui_signals.BannedListChanged(); }

src/node/interface_ui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class CClientUIInterface
115115
/** Masternode list has changed */
116116
ADD_SIGNALS_DECL_WRAPPER(NotifyMasternodeListChanged, void, const CDeterministicMNList&, const CBlockIndex*);
117117

118+
/** InstantSend data changed */
119+
ADD_SIGNALS_DECL_WRAPPER(NotifyInstantSendChanged, void);
120+
118121
/** Governance data changed */
119122
ADD_SIGNALS_DECL_WRAPPER(NotifyGovernanceChanged, void);
120123

src/node/interfaces.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,6 @@ class MnListImpl : public MnList
162162
cb(std::make_shared<const MnEntryImpl>(dmn));
163163
});
164164
}
165-
MnEntryCPtr getMN(const uint256& hash) const override
166-
{
167-
const auto dmn{m_list.GetMN(hash)};
168-
return dmn ? std::make_shared<const MnEntryImpl>(dmn) : nullptr;
169-
}
170-
MnEntryCPtr getMNByService(const CService& service) const override
171-
{
172-
const auto dmn{m_list.GetMNByService(service)};
173-
return dmn ? std::make_shared<const MnEntryImpl>(dmn) : nullptr;
174-
}
175-
MnEntryCPtr getValidMN(const uint256& hash) const override
176-
{
177-
const auto dmn{m_list.GetValidMN(hash)};
178-
return dmn ? std::make_shared<const MnEntryImpl>(dmn) : nullptr;
179-
}
180165
std::vector<MnEntryCPtr> getProjectedMNPayees(const CBlockIndex* pindex) const override
181166
{
182167
std::vector<MnEntryCPtr> ret;
@@ -186,11 +171,6 @@ class MnListImpl : public MnList
186171
return ret;
187172
}
188173

189-
void copyContextTo(MnList& mn_list) const override
190-
{
191-
if (!m_context) return;
192-
mn_list.setContext(m_context);
193-
}
194174
void setContext(NodeContext* context) override
195175
{
196176
m_context = context;
@@ -1021,6 +1001,10 @@ class NodeImpl : public Node
10211001
/* verification progress is unused when a header was received */ 0);
10221002
}));
10231003
}
1004+
std::unique_ptr<Handler> handleNotifyInstantSendChanged(NotifyInstantSendChangedFn fn) override
1005+
{
1006+
return MakeHandler(::uiInterface.NotifyInstantSendChanged_connect(fn));
1007+
}
10241008
std::unique_ptr<Handler> handleNotifyGovernanceChanged(NotifyGovernanceChangedFn fn) override
10251009
{
10261010
return MakeHandler(::uiInterface.NotifyGovernanceChanged_connect(fn));
@@ -1487,5 +1471,4 @@ class ChainImpl : public Chain
14871471
namespace interfaces {
14881472
std::unique_ptr<Node> MakeNode(node::NodeContext& context) { return std::make_unique<node::NodeImpl>(context); }
14891473
std::unique_ptr<Chain> MakeChain(node::NodeContext& node) { return std::make_unique<node::ChainImpl>(node); }
1490-
MnListPtr MakeMNList(const CDeterministicMNList& mn_list) { return std::make_shared<node::MnListImpl>(mn_list); }
14911474
} // namespace interfaces

src/qt/bitcoingui.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ void BitcoinGUI::createActions()
447447
openPeersAction->setStatusTip(tr("Show peers info"));
448448
openRepairAction = new QAction(tr("Wallet &Repair"), this);
449449
openRepairAction->setStatusTip(tr("Show wallet repair options"));
450+
openDebugLogAction = new QAction(tr("Open &debug log file"), this);
451+
openDebugLogAction->setStatusTip(tr("Open the debug log file from the current data directory"));
450452
openConfEditorAction = new QAction(tr("Open &wallet configuration file"), this);
451453
openConfEditorAction->setStatusTip(tr("Open configuration file"));
452454
// override TextHeuristicRole set by default which confuses this action with application settings
@@ -517,7 +519,8 @@ void BitcoinGUI::createActions()
517519
connect(openPeersAction, &QAction::triggered, this, &BitcoinGUI::showPeers);
518520
connect(openRepairAction, &QAction::triggered, this, &BitcoinGUI::showRepair);
519521

520-
// Open configs and backup folder from menu
522+
// Open logs, configs, and backup folder from menu
523+
connect(openDebugLogAction, &QAction::triggered, GUIUtil::openDebugLogfile);
521524
connect(openConfEditorAction, &QAction::triggered, this, &BitcoinGUI::showConfEditor);
522525
connect(showBackupsAction, &QAction::triggered, this, &BitcoinGUI::showBackups);
523526

@@ -640,6 +643,7 @@ void BitcoinGUI::createMenuBar()
640643
file->addAction(m_load_psbt_clipboard_action);
641644
file->addSeparator();
642645
}
646+
file->addAction(openDebugLogAction);
643647
file->addAction(openConfEditorAction);
644648
if(walletFrame) {
645649
file->addAction(showBackupsAction);
@@ -1142,6 +1146,7 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
11421146
repair_action = pmenu->addAction(openRepairAction->text(), openRepairAction, &QAction::trigger);
11431147
}
11441148
pmenu->addSeparator();
1149+
QAction* debuglog_action = pmenu->addAction(openDebugLogAction->text(), openDebugLogAction, &QAction::trigger);
11451150
QAction* conf_action = pmenu->addAction(openConfEditorAction->text(), openConfEditorAction, &QAction::trigger);
11461151
QAction* backups_action{nullptr};
11471152
if (enableWallet) {
@@ -1158,7 +1163,7 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
11581163
// Using QSystemTrayIcon::Context is not reliable.
11591164
// See https://bugreports.qt.io/browse/QTBUG-91697
11601165
pmenu, &QMenu::aboutToShow,
1161-
[this, show_hide_action, send_action, cj_send_action, receive_action, sign_action, verify_action, options_action, node_window_action, quit_action, repair_action, backups_action, info_action, graph_action, peer_action, conf_action] {
1166+
[this, show_hide_action, send_action, cj_send_action, receive_action, sign_action, verify_action, options_action, node_window_action, quit_action, repair_action, backups_action, info_action, graph_action, peer_action, debuglog_action, conf_action] {
11621167
if (m_node.shutdownRequested()) return; // nothing to do, node is shutting down.
11631168

11641169
if (show_hide_action) show_hide_action->setText(
@@ -1185,6 +1190,7 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
11851190
node_window_action->setEnabled(openRPCConsoleAction->isEnabled());
11861191
graph_action->setEnabled(openGraphAction->isEnabled());
11871192
peer_action->setEnabled(openPeersAction->isEnabled());
1193+
debuglog_action->setEnabled(openDebugLogAction->isEnabled());
11881194
conf_action->setEnabled(openConfEditorAction->isEnabled());
11891195
if (quit_action) quit_action->setEnabled(true);
11901196
}
@@ -1809,20 +1815,20 @@ void BitcoinGUI::updateGovernanceCycleIcon()
18091815

18101816
const auto gov_info{m_node.gov().getGovernanceInfo()};
18111817
const auto remaining_blocks{std::max<int>(0, gov_info.nextsuperblock - current_height)};
1812-
const auto days{static_cast<int>(static_cast<int64_t>(remaining_blocks) * gov_info.targetSpacing / (24*60*60))};
1818+
const auto remaining_str{GUIUtil::formatBlockDuration(remaining_blocks, gov_info.targetSpacing)};
18131819
const bool awaiting_superblock{current_height % gov_info.superblockcycle >= gov_info.superblockcycle - gov_info.superblockmaturitywindow};
18141820

18151821
QString tooltip1{};
18161822
if (awaiting_superblock) {
18171823
labelGovernanceCycleIcon->setPixmap(m_gov_cycle_pixmaps.at({ToUnderlying(GUIUtil::ThemedColor::BLUE), 0}));
1818-
tooltip1 = tr("~%n day(s) (%1 blocks) left for superblock", "", days).arg(remaining_blocks);
1824+
tooltip1 = tr("~%1 (%2 blocks) left for superblock").arg(remaining_str).arg(remaining_blocks);
18191825
} else {
18201826
const auto cycle_blocks{gov_info.superblockcycle - gov_info.superblockmaturitywindow};
18211827
const auto blocks_elapsed{gov_info.superblockcycle - remaining_blocks - gov_info.superblockmaturitywindow};
18221828
const auto progress{static_cast<double>(std::max(0, blocks_elapsed)) / static_cast<double>(std::max(1, cycle_blocks))};
18231829
const auto frame{std::clamp<int>(static_cast<int>(progress * (GOV_CYCLE_FRAME_COUNT - 1)), 0, GOV_CYCLE_FRAME_COUNT - 2) + 1};
18241830
labelGovernanceCycleIcon->setPixmap(m_gov_cycle_pixmaps.at({ToUnderlying(GUIUtil::ThemedColor::GREEN), frame}));
1825-
tooltip1 = tr("~%n day(s) (%1 blocks) left for voting", "", days).arg(remaining_blocks);
1831+
tooltip1 = tr("~%1 (%2 blocks) left for voting").arg(remaining_str).arg(remaining_blocks);
18261832
}
18271833

18281834
const auto allocated_budget{m_node.gov().getFundableProposalHashes().allocated};

src/qt/bitcoingui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class BitcoinGUI : public QMainWindow
173173
QAction* openGraphAction = nullptr;
174174
QAction* openPeersAction = nullptr;
175175
QAction* openRepairAction = nullptr;
176+
QAction* openDebugLogAction = nullptr;
176177
QAction* openConfEditorAction = nullptr;
177178
QAction* showBackupsAction = nullptr;
178179
QAction* openAction = nullptr;

0 commit comments

Comments
 (0)