mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-02 20:09:47 -08:00
Version 1.1.0.0 update
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"
|
||||
@@ -45,9 +46,10 @@ public:
|
||||
bool confirmed = index.data(TransactionTableModel::ConfirmedRole).toBool();
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
QColor foreground = option.palette.color(QPalette::Text);
|
||||
if(qVariantCanConvert<QColor>(value))
|
||||
if(value.canConvert<QBrush>())
|
||||
{
|
||||
foreground = qvariant_cast<QColor>(value);
|
||||
QBrush brush = qvariant_cast<QBrush>(value);
|
||||
foreground = brush.color();
|
||||
}
|
||||
|
||||
painter->setPen(foreground);
|
||||
@@ -92,6 +94,8 @@ public:
|
||||
OverviewPage::OverviewPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OverviewPage),
|
||||
clientModel(0),
|
||||
walletModel(0),
|
||||
currentBalance(-1),
|
||||
currentUnconfirmedBalance(-1),
|
||||
currentImmatureBalance(-1),
|
||||
@@ -109,8 +113,8 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
||||
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
|
||||
|
||||
// init "out of sync" warning labels
|
||||
ui->labelWalletStatus->setText("(" + tr("Out of sync") + ")");
|
||||
ui->labelTransactionsStatus->setText("(" + tr("Out of sync") + ")");
|
||||
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
|
||||
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
|
||||
|
||||
// start with displaying the "out of sync" warnings
|
||||
showOutOfSyncWarning(true);
|
||||
@@ -129,7 +133,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;
|
||||
@@ -144,14 +148,20 @@ void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64
|
||||
ui->labelImmatureText->setVisible(showImmature);
|
||||
}
|
||||
|
||||
void OverviewPage::setNumTransactions(int count)
|
||||
void OverviewPage::setClientModel(ClientModel *model)
|
||||
{
|
||||
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
||||
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::setModel(WalletModel *model)
|
||||
void OverviewPage::setWalletModel(WalletModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
this->walletModel = model;
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
// Set up transaction list
|
||||
@@ -169,30 +179,33 @@ void OverviewPage::setModel(WalletModel *model)
|
||||
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance());
|
||||
connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
|
||||
|
||||
setNumTransactions(model->getNumTransactions());
|
||||
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
|
||||
|
||||
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
|
||||
}
|
||||
|
||||
// update the display unit, to not use the default ("CSC")
|
||||
// update the display unit, to not use the default ("BTC")
|
||||
updateDisplayUnit();
|
||||
}
|
||||
|
||||
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