Merge #14879: qt: Add warning messages to the debug window

593ba696fb 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 593ba696fb
  promag:
    ACK 593ba696fb, agree with @Sjors https://github.com/bitcoin/bitcoin/pull/14879#pullrequestreview-196433092 above.
  ryanofsky:
    utACK 593ba696fb

Tree-SHA512: a8ca78529bb16813ba7bfaf5ccd4349189979f08e78ea857746a6fb00fd9d7ed98d8f06f384830acba21dac57070060af23f6be8249398feb32a6efff1333de8
This commit is contained in:
MarcoFalke 2019-08-28 16:02:31 -04:00
commit 93305e6d46
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
4 changed files with 41 additions and 3 deletions

View file

@ -14,6 +14,25 @@
<string>Debug window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_alerts">
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000; }</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">

View file

@ -204,9 +204,8 @@ void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
void OverviewPage::setClientModel(ClientModel *model)
{
this->clientModel = model;
if(model)
{
// Show warning if this is a prerelease version
if (model) {
// Show warning, for example if this is a prerelease version
connect(model, &ClientModel::alertsChanged, this, &OverviewPage::updateAlerts);
updateAlerts(model->getStatusBarWarnings());
}

View file

@ -558,6 +558,17 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
void RPCConsole::setClientModel(ClientModel *model)
{
clientModel = model;
bool wallet_enabled{false};
#ifdef ENABLE_WALLET
wallet_enabled = WalletModel::isWalletEnabled();
#endif // ENABLE_WALLET
if (model && !wallet_enabled) {
// Show warning, for example if this is a prerelease version
connect(model, &ClientModel::alertsChanged, this, &RPCConsole::updateAlerts);
updateAlerts(model->getStatusBarWarnings());
}
ui->trafficGraph->setClientModel(model);
if (model && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) {
// Keep up to date with client
@ -1274,3 +1285,9 @@ QString RPCConsole::tabTitle(TabTypes tab_type) const
{
return ui->tabWidget->tabText(tab_type);
}
void RPCConsole::updateAlerts(const QString& warnings)
{
this->ui->label_alerts->setVisible(!warnings.isEmpty());
this->ui->label_alerts->setText(warnings);
}

View file

@ -167,6 +167,9 @@ private:
/** Update UI with latest network info from model. */
void updateNetworkState();
private Q_SLOTS:
void updateAlerts(const QString& warnings);
};
#endif // BITCOIN_QT_RPCCONSOLE_H