Merge branch 'v0.12.0.x' of https://github.com/dashpay/dash into v0.12.0.x

This commit is contained in:
Evan Duffield 2015-07-03 22:09:15 -07:00
commit b8d5a3ce6b
2 changed files with 14 additions and 17 deletions

View File

@ -178,7 +178,6 @@ OverviewPage::~OverviewPage()
void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance) void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance)
{ {
int unit = walletModel->getOptionsModel()->getDisplayUnit();
currentBalance = balance; currentBalance = balance;
currentUnconfirmedBalance = unconfirmedBalance; currentUnconfirmedBalance = unconfirmedBalance;
currentImmatureBalance = immatureBalance; currentImmatureBalance = immatureBalance;
@ -186,15 +185,15 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
currentWatchOnlyBalance = watchOnlyBalance; currentWatchOnlyBalance = watchOnlyBalance;
currentWatchUnconfBalance = watchUnconfBalance; currentWatchUnconfBalance = watchUnconfBalance;
currentWatchImmatureBalance = watchImmatureBalance; currentWatchImmatureBalance = watchImmatureBalance;
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance, false, BitcoinUnits::separatorAlways)); ui->labelBalance->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, balance, false, BitcoinUnits::separatorAlways));
ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance, false, BitcoinUnits::separatorAlways)); ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, unconfirmedBalance, false, BitcoinUnits::separatorAlways));
ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, immatureBalance, false, BitcoinUnits::separatorAlways)); ui->labelImmature->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, immatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelAnonymized->setText(BitcoinUnits::formatWithUnit(unit, anonymizedBalance, false, BitcoinUnits::separatorAlways)); ui->labelAnonymized->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, anonymizedBalance, false, BitcoinUnits::separatorAlways));
ui->labelTotal->setText(BitcoinUnits::formatWithUnit(unit, balance + unconfirmedBalance + immatureBalance, false, BitcoinUnits::separatorAlways)); ui->labelTotal->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, balance + unconfirmedBalance + immatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchAvailable->setText(BitcoinUnits::formatWithUnit(unit, watchOnlyBalance, false, BitcoinUnits::separatorAlways)); ui->labelWatchAvailable->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchPending->setText(BitcoinUnits::formatWithUnit(unit, watchUnconfBalance, false, BitcoinUnits::separatorAlways)); ui->labelWatchPending->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchImmature->setText(BitcoinUnits::formatWithUnit(unit, watchImmatureBalance, false, BitcoinUnits::separatorAlways)); ui->labelWatchImmature->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchTotal->setText(BitcoinUnits::formatWithUnit(unit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways)); ui->labelWatchTotal->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways));
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things // only show immature (newly mined) balance if it's non-zero, so as not to complicate things
// for the non-mining users // for the non-mining users
@ -280,12 +279,13 @@ void OverviewPage::updateDisplayUnit()
{ {
if(walletModel && walletModel->getOptionsModel()) if(walletModel && walletModel->getOptionsModel())
{ {
nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit();
if(currentBalance != -1) if(currentBalance != -1)
setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance, currentAnonymizedBalance, setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance, currentAnonymizedBalance,
currentWatchOnlyBalance, currentWatchUnconfBalance, currentWatchImmatureBalance); currentWatchOnlyBalance, currentWatchUnconfBalance, currentWatchImmatureBalance);
// Update txdelegate->unit with the current unit // Update txdelegate->unit with the current unit
txdelegate->unit = walletModel->getOptionsModel()->getDisplayUnit(); txdelegate->unit = nDisplayUnit;
ui->listTransactions->update(); ui->listTransactions->update();
} }
@ -308,11 +308,10 @@ void OverviewPage::updateDarksendProgress()
{ {
if(IsInitialBlockDownload() || ShutdownRequested()) return; if(IsInitialBlockDownload() || ShutdownRequested()) return;
if(!pwalletMain || !walletModel || !walletModel->getOptionsModel()) return; if(!pwalletMain) return;
int64_t nBalance = pwalletMain->GetBalance(); int64_t nBalance = pwalletMain->GetBalance();
QString strAmountAndRounds; QString strAmountAndRounds;
int nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit();
QString strAnonymizeDarkcoinAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizeDarkcoinAmount * COIN, false, BitcoinUnits::separatorAlways); QString strAnonymizeDarkcoinAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizeDarkcoinAmount * COIN, false, BitcoinUnits::separatorAlways);
if(nBalance == 0) if(nBalance == 0)
@ -460,10 +459,7 @@ void OverviewPage::toggleDarksend(){
int64_t balance = pwalletMain->GetBalance(); int64_t balance = pwalletMain->GetBalance();
float minAmount = 1.49 * COIN; float minAmount = 1.49 * COIN;
if(balance < minAmount){ if(balance < minAmount){
QString strMinAmount( QString strMinAmount(BitcoinUnits::formatWithUnit(nDisplayUnit, minAmount));
BitcoinUnits::formatWithUnit(
walletModel->getOptionsModel()->getDisplayUnit(),
minAmount));
QMessageBox::warning(this, tr("Darksend"), QMessageBox::warning(this, tr("Darksend"),
tr("Darksend requires at least %1 to use.").arg(strMinAmount), tr("Darksend requires at least %1 to use.").arg(strMinAmount),
QMessageBox::Ok, QMessageBox::Ok); QMessageBox::Ok, QMessageBox::Ok);

View File

@ -56,6 +56,7 @@ private:
CAmount currentWatchOnlyBalance; CAmount currentWatchOnlyBalance;
CAmount currentWatchUnconfBalance; CAmount currentWatchUnconfBalance;
CAmount currentWatchImmatureBalance; CAmount currentWatchImmatureBalance;
int nDisplayUnit;
TxViewDelegate *txdelegate; TxViewDelegate *txdelegate;
TransactionFilterProxy *filter; TransactionFilterProxy *filter;