aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-10-24 21:47:07 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2012-10-25 07:33:45 +0200
commit62e21fb5d00c33df37b6faaf0626da120c4783bc (patch)
tree27c5baae0240a5ff627119d5cbe98813a673f31b /src/qt/overviewpage.cpp
parent55913c997112c78d6058edfa210b6275cde853a6 (diff)
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.
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r--src/qt/overviewpage.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 07be9c520a..8f1ff5325e 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -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);