mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 03:33:32 +01:00
Show warning when using prerelease version
Implements #1948 - Add macro `CLIENT_VERSION_IS_RELEASE` to clientversion.h - When running a prerelease (the above macro is `false`): - In UI, show an orange warning bar at the top. This will be used for other warnings (and alerts) as well, instead of the status bar. - For `bitcoind`, show the warning in the "errors" field in `getinfo` response.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "overviewpage.h"
|
||||
#include "ui_overviewpage.h"
|
||||
|
||||
#include "clientmodel.h"
|
||||
#include "walletmodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "optionsmodel.h"
|
||||
@@ -92,6 +93,8 @@ public:
|
||||
OverviewPage::OverviewPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OverviewPage),
|
||||
clientModel(0),
|
||||
walletModel(0),
|
||||
currentBalance(-1),
|
||||
currentUnconfirmedBalance(-1),
|
||||
currentImmatureBalance(-1),
|
||||
@@ -129,7 +132,7 @@ OverviewPage::~OverviewPage()
|
||||
|
||||
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
|
||||
{
|
||||
int unit = model->getOptionsModel()->getDisplayUnit();
|
||||
int unit = walletModel->getOptionsModel()->getDisplayUnit();
|
||||
currentBalance = balance;
|
||||
currentUnconfirmedBalance = unconfirmedBalance;
|
||||
currentImmatureBalance = immatureBalance;
|
||||
@@ -149,9 +152,20 @@ void OverviewPage::setNumTransactions(int count)
|
||||
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
||||
}
|
||||
|
||||
void OverviewPage::setModel(WalletModel *model)
|
||||
void OverviewPage::setClientModel(ClientModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
this->clientModel = model;
|
||||
if(model)
|
||||
{
|
||||
// Show warning if this is a prerelease version
|
||||
connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString)));
|
||||
updateAlerts(model->getStatusBarWarnings());
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewPage::setWalletModel(WalletModel *model)
|
||||
{
|
||||
this->walletModel = model;
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
// Set up transaction list
|
||||
@@ -181,18 +195,24 @@ void OverviewPage::setModel(WalletModel *model)
|
||||
|
||||
void OverviewPage::updateDisplayUnit()
|
||||
{
|
||||
if(model && model->getOptionsModel())
|
||||
if(walletModel && walletModel->getOptionsModel())
|
||||
{
|
||||
if(currentBalance != -1)
|
||||
setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance);
|
||||
|
||||
// Update txdelegate->unit with the current unit
|
||||
txdelegate->unit = model->getOptionsModel()->getDisplayUnit();
|
||||
txdelegate->unit = walletModel->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
ui->listTransactions->update();
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewPage::updateAlerts(const QString &warnings)
|
||||
{
|
||||
this->ui->labelAlerts->setVisible(!warnings.isEmpty());
|
||||
this->ui->labelAlerts->setText(warnings);
|
||||
}
|
||||
|
||||
void OverviewPage::showOutOfSyncWarning(bool fShow)
|
||||
{
|
||||
ui->labelWalletStatus->setVisible(fShow);
|
||||
|
||||
Reference in New Issue
Block a user