aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
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);