Fix: #11016
This PR adds warning messages to the debug window in -disablewallet mode.

8 | @@ -9,25 +9,24 @@ 9 | #include <qt/rpcconsole.h> 10 | #include <qt/forms/ui_debugwindow.h> 11 | 12 | -#include <qt/bantablemodel.h>
No need to touch the headers.
Agree.
An alternative approach is to extract the existing alert from the OverviewPage and add that to the QMainWindow. In addition you could try to use addDockWidget(Qt::TopDockWidgetArea, alert_widget).
Anyway, my point is to avoid duplicate code.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
@promag Thank you for your review.
An alternative approach is to extract the existing alert from the
OverviewPageand add that to theQMainWindow. In addition you could try to useaddDockWidget(Qt::TopDockWidgetArea, alert_widget).
That was my first thought exactly :) In that case warning messages will be exposed not only on Overview tab but on Send, Receive and Transactions tabs too. Can such behaviour be annoying for a user?
No need to touch the headers.
I've just moved #include <qt/walletmodel.h> under the #ifdef ENABLE_WALLET guard as all rpcconsole.cpp code supposed. All others headers moves were made by clang-format-diff.py. Let code formatting approach to an ideal step by step :)
25 | +#include <univalue.h> 26 | #include <util/system.h> 27 | 28 | #include <openssl/crypto.h> 29 | 30 | -#include <univalue.h>
univalue is a library, so shouldn't move that?
@MarcoFalke Sure!
Can such behaviour be annoying for a user?
IMO it'd be preferable
Concept ACK
Rebased.
Rebased on top of 3e21b690d1aedb73a7dc2bc5d2ff1b011b52d927.
... you could try to use
addDockWidget(Qt::TopDockWidgetArea, alert_widget).
By design, a QDockWidget consists of a title bar and the content area. An alert label can be placed to any of these elements of alert_widget. The other element (without the alert label) cannot be hidden, unfortunately. In addition, such implementation should handle resize events properly that adds some new code and possibly introduces new GUI-related bugs.
563 | @@ -563,6 +564,17 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event) 564 | void RPCConsole::setClientModel(ClientModel *model) 565 | { 566 | clientModel = model; 567 | + 568 | + auto wallet_enabled = false;
nit: bool
568 | + auto wallet_enabled = false; 569 | +#ifdef ENABLE_WALLET 570 | + wallet_enabled = WalletModel::isWalletEnabled(); 571 | +#endif // ENABLE_WALLET 572 | + if (model && !wallet_enabled) { 573 | + // Show warning if this is a prerelease version
Should be: // Show warning, for example if
tACK e4fb571
I don't mind the slight duplication of view code.
In that case warning messages will be exposed not only on Overview tab but on Send, Receive and Transactions tabs too. Can such behaviour be annoying for a user?
The Overview tab is the first thing you see when you launch Bitcoin Core, so I don't see the point in showing warning in other places. That's especially true the first time you launch the app, so everyone will have seen that it's not a release build.
The only exception I can think of is when you open a BIP21/70 URI, so maybe some really critical warnings could also be on the send screen, but currently the warnings, e.g. "new version bit" aren't informative enough for that to be useful.
re-tACK c0c9613 assuming Travis is happy (I just restarted two instances, they seem to have been confused by cached code, I noticed that locally too).
utACK 593ba696fb32da558091ac02ad87c4893db4ce97
@ryanofsky @MarcoFalke Would you mind reviewing this PR?
Concept ACK
562 | @@ -563,6 +563,17 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event) 563 | void RPCConsole::setClientModel(ClientModel *model) 564 | { 565 | clientModel = model; 566 | + 567 | + bool wallet_enabled{false}; 568 | +#ifdef ENABLE_WALLET 569 | + wallet_enabled = WalletModel::isWalletEnabled(); 570 | +#endif // ENABLE_WALLET 571 | + if (model && !wallet_enabled) {
In commit "Add warning messages to the debug window" (593ba696fb32da558091ac02ad87c4893db4ce97)
Instead of repeating the wallet check from BitcoinGUI::BitcoinGUI, I think it'd be less fragile and repetitive to add a simpler RPCConsole::enableAlerts() method here:
void RPCConsole::enableAlerts()
{
connect(model, &ClientModel::alertsChanged, this, &RPCConsole::updateAlerts);
updateAlerts(model->getStatusBarWarnings());
}
and call it from BitcoinGUI::BitcoinGUI where there is already a wallet enabled check being done
This approach will not work because the ClientModel object has not yet been created at that moment. So I'd prefer to leave it as is.
utACK 593ba696fb32da558091ac02ad87c4893db4ce97
Milestone
0.19.0