@ -1,6 +1,7 @@
@@ -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:
@@ -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()
@@ -129,7 +132,7 @@ OverviewPage::~OverviewPage()
void OverviewPage : : setBalance ( qint64 balance , qint64 unconfirmedBalance , qint64 immatureBalance )
{
int unit = m odel- > getOptionsModel ( ) - > getDisplayUnit ( ) ;
int unit = walletM odel- > getOptionsModel ( ) - > getDisplayUnit ( ) ;
currentBalance = balance ;
currentUnconfirmedBalance = unconfirmedBalance ;
currentImmatureBalance = immatureBalance ;
@ -149,9 +152,20 @@ void OverviewPage::setNumTransactions(int count)
@@ -149,9 +152,20 @@ void OverviewPage::setNumTransactions(int count)
ui - > labelNumTransactions - > setText ( QLocale : : system ( ) . toString ( count ) ) ;
}
void OverviewPage : : setModel ( Walle tModel * model )
void OverviewPage : : setClient Model ( Clien tModel * 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)
@@ -181,18 +195,24 @@ void OverviewPage::setModel(WalletModel *model)
void OverviewPage : : updateDisplayUnit ( )
{
if ( model & & m odel- > getOptionsModel ( ) )
if ( walletModel & & walletM odel- > getOptionsModel ( ) )
{
if ( currentBalance ! = - 1 )
setBalance ( currentBalance , currentUnconfirmedBalance , currentImmatureBalance ) ;
// Update txdelegate->unit with the current unit
txdelegate - > unit = m odel- > getOptionsModel ( ) - > getDisplayUnit ( ) ;
txdelegate - > unit = walletM odel- > 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 ) ;