Skip to content

Commit 93305e6

Browse files
author
MarcoFalke
committed
Merge #14879: qt: Add warning messages to the debug window
593ba69 Add warning messages to the debug window (Hennadii Stepanov) Pull request description: Fix: #11016 This PR adds warning messages to the debug window in `-disablewallet` mode. ![screenshot from 2018-12-06 01-01-27](https://user-images.githubusercontent.com/32963518/49550070-413c1c80-f8f3-11e8-9865-efb49ea8da45.png) ACKs for top commit: jonasschnelli: utACK 593ba69 promag: ACK 593ba69, agree with @Sjors bitcoin/bitcoin#14879 (review) above. ryanofsky: utACK 593ba69 Tree-SHA512: a8ca78529bb16813ba7bfaf5ccd4349189979f08e78ea857746a6fb00fd9d7ed98d8f06f384830acba21dac57070060af23f6be8249398feb32a6efff1333de8
2 parents cc40b55 + 593ba69 commit 93305e6

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

src/qt/forms/debugwindow.ui

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@
1414
<string>Debug window</string>
1515
</property>
1616
<layout class="QVBoxLayout" name="verticalLayout_2">
17+
<item>
18+
<widget class="QLabel" name="label_alerts">
19+
<property name="visible">
20+
<bool>false</bool>
21+
</property>
22+
<property name="styleSheet">
23+
<string notr="true">QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000; }</string>
24+
</property>
25+
<property name="wordWrap">
26+
<bool>true</bool>
27+
</property>
28+
<property name="margin">
29+
<number>3</number>
30+
</property>
31+
<property name="textInteractionFlags">
32+
<set>Qt::TextSelectableByMouse</set>
33+
</property>
34+
</widget>
35+
</item>
1736
<item>
1837
<widget class="QTabWidget" name="tabWidget">
1938
<property name="currentIndex">

src/qt/overviewpage.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,8 @@ void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
204204
void OverviewPage::setClientModel(ClientModel *model)
205205
{
206206
this->clientModel = model;
207-
if(model)
208-
{
209-
// Show warning if this is a prerelease version
207+
if (model) {
208+
// Show warning, for example if this is a prerelease version
210209
connect(model, &ClientModel::alertsChanged, this, &OverviewPage::updateAlerts);
211210
updateAlerts(model->getStatusBarWarnings());
212211
}

src/qt/rpcconsole.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
558558
void RPCConsole::setClientModel(ClientModel *model)
559559
{
560560
clientModel = model;
561+
562+
bool wallet_enabled{false};
563+
#ifdef ENABLE_WALLET
564+
wallet_enabled = WalletModel::isWalletEnabled();
565+
#endif // ENABLE_WALLET
566+
if (model && !wallet_enabled) {
567+
// Show warning, for example if this is a prerelease version
568+
connect(model, &ClientModel::alertsChanged, this, &RPCConsole::updateAlerts);
569+
updateAlerts(model->getStatusBarWarnings());
570+
}
571+
561572
ui->trafficGraph->setClientModel(model);
562573
if (model && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) {
563574
// Keep up to date with client
@@ -1274,3 +1285,9 @@ QString RPCConsole::tabTitle(TabTypes tab_type) const
12741285
{
12751286
return ui->tabWidget->tabText(tab_type);
12761287
}
1288+
1289+
void RPCConsole::updateAlerts(const QString& warnings)
1290+
{
1291+
this->ui->label_alerts->setVisible(!warnings.isEmpty());
1292+
this->ui->label_alerts->setText(warnings);
1293+
}

src/qt/rpcconsole.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ public Q_SLOTS:
167167

168168
/** Update UI with latest network info from model. */
169169
void updateNetworkState();
170+
171+
private Q_SLOTS:
172+
void updateAlerts(const QString& warnings);
170173
};
171174

172175
#endif // BITCOIN_QT_RPCCONSOLE_H

0 commit comments

Comments
 (0)