Merge pull request #391 from UdjinM6/v0.12.0.x_ds_on_overview
V0.12.0.x Various DS related fixes for overview page
This commit is contained in:
commit
4b6d55b1b9
@ -179,7 +179,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="lineSpendableBalance">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -481,7 +481,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0 DASH</string>
|
||||
<string notr="true">0 DASH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -974,7 +974,7 @@
|
||||
<string>Start/Stop Mixing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="lineLastMessage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<item row="7" column="2">
|
||||
<widget class="QCheckBox" name="reuseAddress">
|
||||
<property name="toolTip">
|
||||
<string>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.</string>
|
||||
<string>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.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>R&euse an existing receiving address (not recommended)</string>
|
||||
@ -71,7 +71,7 @@
|
||||
<item row="6" column="2">
|
||||
<widget class="QLineEdit" name="reqMessage">
|
||||
<property name="toolTip">
|
||||
<string>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.</string>
|
||||
<string>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.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -455,11 +455,14 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
|
||||
{
|
||||
QWidget *widget = static_cast<QWidget*>(obj);
|
||||
QString tooltip = widget->toolTip();
|
||||
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt") && !Qt::mightBeRichText(tooltip))
|
||||
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt"))
|
||||
{
|
||||
// Envelop with <qt></qt> to make sure Qt detects this as rich text
|
||||
// Escape the current message as HTML and replace \n by <br>
|
||||
tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>";
|
||||
// Escape the current message as HTML and replace \n by <br> if it's not rich text
|
||||
if(!Qt::mightBeRichText(tooltip))
|
||||
tooltip = HtmlEscape(tooltip, true);
|
||||
// Envelop with <qt></qt> to make sure Qt detects every tooltip as rich text
|
||||
// and style='white-space:pre' to preserve line composition
|
||||
tooltip = "<qt style='white-space:pre'>" + tooltip + "</qt>";
|
||||
widget->setToolTip(tooltip);
|
||||
return true;
|
||||
}
|
||||
|
@ -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 <span style='color:red;'>%1</span>,<br>"
|
||||
"will anonymize <span style='color:red;'>%2</span> instead")
|
||||
.arg(strAnonymizeDarkcoinAmount)
|
||||
.arg(strMaxToAnonymize));
|
||||
strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
|
||||
strAmountAndRounds = "<span style='color:red;'>" +
|
||||
QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize +
|
||||
" / " + tr("%n Rounds", "", nDarksendRounds) + "</span>";
|
||||
}
|
||||
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("<span style='white-space: nowrap;'>" +
|
||||
tr("Not enough compatible inputs to anonymize <span style='color:red;'>%1</span>,<br/>"
|
||||
"will anonymize <span style='color:red;'>%2</span> instead")
|
||||
.arg(strAnonymizeDarkcoinAmount)
|
||||
.arg(strMaxToAnonymize) +
|
||||
"</span>");
|
||||
strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
|
||||
strAmountAndRounds = "<span style='color:red;'>" +
|
||||
QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize +
|
||||
" / " + tr("%n Rounds", "", nDarksendRounds) + "</span>";
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,6 @@ private:
|
||||
CAmount currentWatchUnconfBalance;
|
||||
CAmount currentWatchImmatureBalance;
|
||||
|
||||
qint64 cachedTxLocks;
|
||||
qint64 lastNewBlock;
|
||||
|
||||
int cachedNumBlocks;
|
||||
|
||||
TxViewDelegate *txdelegate;
|
||||
TransactionFilterProxy *filter;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user