diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 00c299c681..b26f88b6b9 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -179,7 +179,7 @@ - + Qt::Horizontal @@ -481,7 +481,7 @@ - 0 DASH + 0 DASH @@ -974,7 +974,7 @@ Start/Stop Mixing - + 10 diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index 2b0f90a910..e0234fb368 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -31,7 +31,7 @@ - Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before. + Reuse one of the previously used receiving addresses.<br>Reusing addresses has security and privacy issues.<br>Do not use this unless re-generating a payment request made before. R&euse an existing receiving address (not recommended) @@ -71,7 +71,7 @@ - An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Dash network. + An optional message to attach to the payment request, which will be displayed when the request is opened.<br>Note: The message will not be sent with the payment over the Dash network. diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ffc1dfe847..6f495230b6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -455,11 +455,14 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) { QWidget *widget = static_cast(obj); QString tooltip = widget->toolTip(); - if(tooltip.size() > size_threshold && !tooltip.startsWith(" size_threshold && !tooltip.startsWith(" to make sure Qt detects this as rich text - // Escape the current message as HTML and replace \n by
- tooltip = "" + HtmlEscape(tooltip, true) + ""; + // Escape the current message as HTML and replace \n by
if it's not rich text + if(!Qt::mightBeRichText(tooltip)) + tooltip = HtmlEscape(tooltip, true); + // Envelop with to make sure Qt detects every tooltip as rich text + // and style='white-space:pre' to preserve line composition + tooltip = "" + tooltip + ""; widget->setToolTip(tooltip); return true; } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index e82173fe15..1ec9929d71 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -140,25 +140,24 @@ OverviewPage::OverviewPage(QWidget *parent) : ui->labelDarksendSyncStatus->setText("(" + tr("out of sync") + ")"); ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")"); - lastNewBlock = 0; - if(fLiteMode){ ui->frameDarksend->setVisible(false); - } else if(!fMasterNode) { - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatus())); - timer->start(333); - } - - if(fMasterNode){ - ui->toggleDarksend->setText("(" + tr("Disabled") + ")"); - ui->darksendAuto->setText("(" + tr("Disabled") + ")"); - ui->darksendReset->setText("(" + tr("Disabled") + ")"); - ui->frameDarksend->setEnabled(false); - }else if(!fEnableDarksend){ - ui->toggleDarksend->setText(tr("Start Darksend Mixing")); } else { - ui->toggleDarksend->setText(tr("Stop Darksend Mixing")); + if(fMasterNode){ + ui->toggleDarksend->setText("(" + tr("Disabled") + ")"); + ui->darksendAuto->setText("(" + tr("Disabled") + ")"); + ui->darksendReset->setText("(" + tr("Disabled") + ")"); + ui->frameDarksend->setEnabled(false); + } else { + if(!fEnableDarksend){ + ui->toggleDarksend->setText(tr("Start Darksend Mixing")); + } else { + ui->toggleDarksend->setText(tr("Stop Darksend Mixing")); + } + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatus())); + timer->start(333); + } } // start with displaying the "out of sync" warnings @@ -207,6 +206,10 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature); ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance + updateDarksendProgress(); + + static int cachedTxLocks = 0; + if(cachedTxLocks != nCompleteTXLocks){ cachedTxLocks = nCompleteTXLocks; ui->listTransactions->update(); @@ -306,37 +309,50 @@ void OverviewPage::updateDarksendProgress() if(IsInitialBlockDownload()) return; int64_t nBalance = pwalletMain->GetBalance(); + QString strAmountAndRounds; + int nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit(); + QString strAnonymizeDarkcoinAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizeDarkcoinAmount * COIN, false, BitcoinUnits::separatorAlways); + if(nBalance == 0) { ui->darksendProgress->setValue(0); - QString s(tr("No inputs detected")); - ui->darksendProgress->setToolTip(s); + ui->darksendProgress->setToolTip(tr("No inputs detected")); // when balance is zero just show info from settings - QString strSettings = BitcoinUnits::formatWithUnit( - walletModel->getOptionsModel()->getDisplayUnit(), - nAnonymizeDarkcoinAmount * COIN - ) + " / " + tr("%n Rounds", "", nDarksendRounds); + strAnonymizeDarkcoinAmount = strAnonymizeDarkcoinAmount.remove(strAnonymizeDarkcoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1); + strAmountAndRounds = strAnonymizeDarkcoinAmount + " / " + tr("%n Rounds", "", nDarksendRounds); - ui->labelAmountRounds->setText(strSettings); + ui->labelAmountRounds->setToolTip(tr("No inputs detected")); + ui->labelAmountRounds->setText(strAmountAndRounds); return; } - //get denominated unconfirmed inputs - if(pwalletMain->GetDenominatedBalance(true, true) > 0) - { - QString s(tr("Found unconfirmed denominated outputs, will wait till they confirm to recalculate.")); - ui->darksendProgress->setToolTip(s); - return; - } - - int64_t nMaxToAnonymize = pwalletMain->GetAnonymizableBalance(true); + int64_t nDenominatedUnconfirmedBalance = pwalletMain->GetDenominatedBalance(true, true); + int64_t nMaxToAnonymize = pwalletMain->GetAnonymizableBalance(true) + nDenominatedUnconfirmedBalance; // If it's more than the anon threshold, limit to that. if(nMaxToAnonymize > nAnonymizeDarkcoinAmount*COIN) nMaxToAnonymize = nAnonymizeDarkcoinAmount*COIN; if(nMaxToAnonymize == 0) return; + if(nMaxToAnonymize >= nAnonymizeDarkcoinAmount * COIN) { + ui->labelAmountRounds->setToolTip(tr("Found enough compatible inputs to anonymize %1") + .arg(strAnonymizeDarkcoinAmount)); + strAnonymizeDarkcoinAmount = strAnonymizeDarkcoinAmount.remove(strAnonymizeDarkcoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1); + strAmountAndRounds = strAnonymizeDarkcoinAmount + " / " + tr("%n Rounds", "", nDarksendRounds); + } else { + QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways); + ui->labelAmountRounds->setToolTip(tr("Not enough compatible inputs to anonymize %1,
" + "will anonymize %2 instead") + .arg(strAnonymizeDarkcoinAmount) + .arg(strMaxToAnonymize)); + strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1); + strAmountAndRounds = "" + + QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize + + " / " + tr("%n Rounds", "", nDarksendRounds) + ""; + } + ui->labelAmountRounds->setText(strAmountAndRounds); + // calculate parts of the progress, each of them shouldn't be higher than 1: // mixing progress of denominated balance int64_t denominatedBalance = pwalletMain->GetDenominatedBalance(); @@ -364,35 +380,13 @@ void OverviewPage::updateDarksendProgress() QString strToolPip = tr("Progress: %1% (inputs have an average of %2 of %n rounds)", "", nDarksendRounds).arg(progress).arg(pwalletMain->GetAverageAnonymizedRounds()); ui->darksendProgress->setToolTip(strToolPip); - - QString strAmountAndRounds; - int nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit(); - QString strAnonymizeDarkcoinAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizeDarkcoinAmount * COIN, false, BitcoinUnits::separatorAlways); - if(nMaxToAnonymize >= nAnonymizeDarkcoinAmount * COIN) { - ui->labelAmountRounds->setToolTip(tr("Found enough compatible inputs to anonymize %1") - .arg(strAnonymizeDarkcoinAmount)); - strAnonymizeDarkcoinAmount = strAnonymizeDarkcoinAmount.remove(strAnonymizeDarkcoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1); - strAmountAndRounds = strAnonymizeDarkcoinAmount + " / " + tr("%n Rounds", "", nDarksendRounds); - } else { - QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways); - ui->labelAmountRounds->setToolTip("" + - tr("Not enough compatible inputs to anonymize %1,
" - "will anonymize %2 instead") - .arg(strAnonymizeDarkcoinAmount) - .arg(strMaxToAnonymize) + - "
"); - strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1); - strAmountAndRounds = "" + - QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize + - " / " + tr("%n Rounds", "", nDarksendRounds) + ""; - } - - ui->labelAmountRounds->setText(strAmountAndRounds); } void OverviewPage::darkSendStatus() { + static int64_t lastNewBlock = 0; + int nBestHeight = chainActive.Tip()->nHeight; if(nBestHeight != darkSendPool.cachedNumBlocks) @@ -400,7 +394,6 @@ void OverviewPage::darkSendStatus() //we we're processing lots of blocks, we'll just leave if(GetTime() - lastNewBlock < 10) return; lastNewBlock = GetTime(); - updateDarksendProgress(); } diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 4a6af3bdac..2f4a217842 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -57,11 +57,6 @@ private: CAmount currentWatchUnconfBalance; CAmount currentWatchImmatureBalance; - qint64 cachedTxLocks; - qint64 lastNewBlock; - - int cachedNumBlocks; - TxViewDelegate *txdelegate; TransactionFilterProxy *filter;