mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="lineSpendableBalance">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -481,7 +481,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0 DASH</string>
|
<string notr="true">0 DASH</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -974,7 +974,7 @@
|
|||||||
<string>Start/Stop Mixing</string>
|
<string>Start/Stop Mixing</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="lineLastMessage">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<item row="7" column="2">
|
<item row="7" column="2">
|
||||||
<widget class="QCheckBox" name="reuseAddress">
|
<widget class="QCheckBox" name="reuseAddress">
|
||||||
<property name="toolTip">
|
<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>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>R&euse an existing receiving address (not recommended)</string>
|
<string>R&euse an existing receiving address (not recommended)</string>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<item row="6" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QLineEdit" name="reqMessage">
|
<widget class="QLineEdit" name="reqMessage">
|
||||||
<property name="toolTip">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -455,11 +455,14 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
|
|||||||
{
|
{
|
||||||
QWidget *widget = static_cast<QWidget*>(obj);
|
QWidget *widget = static_cast<QWidget*>(obj);
|
||||||
QString tooltip = widget->toolTip();
|
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> if it's not rich text
|
||||||
// Escape the current message as HTML and replace \n by <br>
|
if(!Qt::mightBeRichText(tooltip))
|
||||||
tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>";
|
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);
|
widget->setToolTip(tooltip);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -140,26 +140,25 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
|||||||
ui->labelDarksendSyncStatus->setText("(" + tr("out of sync") + ")");
|
ui->labelDarksendSyncStatus->setText("(" + tr("out of sync") + ")");
|
||||||
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
|
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
|
||||||
|
|
||||||
lastNewBlock = 0;
|
|
||||||
|
|
||||||
if(fLiteMode){
|
if(fLiteMode){
|
||||||
ui->frameDarksend->setVisible(false);
|
ui->frameDarksend->setVisible(false);
|
||||||
} else if(!fMasterNode) {
|
} else {
|
||||||
timer = new QTimer(this);
|
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatus()));
|
|
||||||
timer->start(333);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fMasterNode){
|
if(fMasterNode){
|
||||||
ui->toggleDarksend->setText("(" + tr("Disabled") + ")");
|
ui->toggleDarksend->setText("(" + tr("Disabled") + ")");
|
||||||
ui->darksendAuto->setText("(" + tr("Disabled") + ")");
|
ui->darksendAuto->setText("(" + tr("Disabled") + ")");
|
||||||
ui->darksendReset->setText("(" + tr("Disabled") + ")");
|
ui->darksendReset->setText("(" + tr("Disabled") + ")");
|
||||||
ui->frameDarksend->setEnabled(false);
|
ui->frameDarksend->setEnabled(false);
|
||||||
}else if(!fEnableDarksend){
|
} else {
|
||||||
|
if(!fEnableDarksend){
|
||||||
ui->toggleDarksend->setText(tr("Start Darksend Mixing"));
|
ui->toggleDarksend->setText(tr("Start Darksend Mixing"));
|
||||||
} else {
|
} else {
|
||||||
ui->toggleDarksend->setText(tr("Stop Darksend Mixing"));
|
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
|
// start with displaying the "out of sync" warnings
|
||||||
showOutOfSyncWarning(true);
|
showOutOfSyncWarning(true);
|
||||||
@ -207,6 +206,10 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
|
|||||||
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
|
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
|
||||||
ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance
|
ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance
|
||||||
|
|
||||||
|
updateDarksendProgress();
|
||||||
|
|
||||||
|
static int cachedTxLocks = 0;
|
||||||
|
|
||||||
if(cachedTxLocks != nCompleteTXLocks){
|
if(cachedTxLocks != nCompleteTXLocks){
|
||||||
cachedTxLocks = nCompleteTXLocks;
|
cachedTxLocks = nCompleteTXLocks;
|
||||||
ui->listTransactions->update();
|
ui->listTransactions->update();
|
||||||
@ -306,37 +309,50 @@ void OverviewPage::updateDarksendProgress()
|
|||||||
if(IsInitialBlockDownload()) return;
|
if(IsInitialBlockDownload()) return;
|
||||||
|
|
||||||
int64_t nBalance = pwalletMain->GetBalance();
|
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)
|
if(nBalance == 0)
|
||||||
{
|
{
|
||||||
ui->darksendProgress->setValue(0);
|
ui->darksendProgress->setValue(0);
|
||||||
QString s(tr("No inputs detected"));
|
ui->darksendProgress->setToolTip(tr("No inputs detected"));
|
||||||
ui->darksendProgress->setToolTip(s);
|
|
||||||
|
|
||||||
// when balance is zero just show info from settings
|
// when balance is zero just show info from settings
|
||||||
QString strSettings = BitcoinUnits::formatWithUnit(
|
strAnonymizeDarkcoinAmount = strAnonymizeDarkcoinAmount.remove(strAnonymizeDarkcoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
|
||||||
walletModel->getOptionsModel()->getDisplayUnit(),
|
strAmountAndRounds = strAnonymizeDarkcoinAmount + " / " + tr("%n Rounds", "", nDarksendRounds);
|
||||||
nAnonymizeDarkcoinAmount * COIN
|
|
||||||
) + " / " + tr("%n Rounds", "", nDarksendRounds);
|
|
||||||
|
|
||||||
ui->labelAmountRounds->setText(strSettings);
|
ui->labelAmountRounds->setToolTip(tr("No inputs detected"));
|
||||||
|
ui->labelAmountRounds->setText(strAmountAndRounds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get denominated unconfirmed inputs
|
int64_t nDenominatedUnconfirmedBalance = pwalletMain->GetDenominatedBalance(true, true);
|
||||||
if(pwalletMain->GetDenominatedBalance(true, true) > 0)
|
int64_t nMaxToAnonymize = pwalletMain->GetAnonymizableBalance(true) + nDenominatedUnconfirmedBalance;
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
// If it's more than the anon threshold, limit to that.
|
// If it's more than the anon threshold, limit to that.
|
||||||
if(nMaxToAnonymize > nAnonymizeDarkcoinAmount*COIN) nMaxToAnonymize = nAnonymizeDarkcoinAmount*COIN;
|
if(nMaxToAnonymize > nAnonymizeDarkcoinAmount*COIN) nMaxToAnonymize = nAnonymizeDarkcoinAmount*COIN;
|
||||||
|
|
||||||
if(nMaxToAnonymize == 0) return;
|
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:
|
// calculate parts of the progress, each of them shouldn't be higher than 1:
|
||||||
// mixing progress of denominated balance
|
// mixing progress of denominated balance
|
||||||
int64_t denominatedBalance = pwalletMain->GetDenominatedBalance();
|
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());
|
QString strToolPip = tr("Progress: %1% (inputs have an average of %2 of %n rounds)", "", nDarksendRounds).arg(progress).arg(pwalletMain->GetAverageAnonymizedRounds());
|
||||||
ui->darksendProgress->setToolTip(strToolPip);
|
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()
|
void OverviewPage::darkSendStatus()
|
||||||
{
|
{
|
||||||
|
static int64_t lastNewBlock = 0;
|
||||||
|
|
||||||
int nBestHeight = chainActive.Tip()->nHeight;
|
int nBestHeight = chainActive.Tip()->nHeight;
|
||||||
|
|
||||||
if(nBestHeight != darkSendPool.cachedNumBlocks)
|
if(nBestHeight != darkSendPool.cachedNumBlocks)
|
||||||
@ -400,7 +394,6 @@ void OverviewPage::darkSendStatus()
|
|||||||
//we we're processing lots of blocks, we'll just leave
|
//we we're processing lots of blocks, we'll just leave
|
||||||
if(GetTime() - lastNewBlock < 10) return;
|
if(GetTime() - lastNewBlock < 10) return;
|
||||||
lastNewBlock = GetTime();
|
lastNewBlock = GetTime();
|
||||||
|
|
||||||
updateDarksendProgress();
|
updateDarksendProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,6 @@ private:
|
|||||||
CAmount currentWatchUnconfBalance;
|
CAmount currentWatchUnconfBalance;
|
||||||
CAmount currentWatchImmatureBalance;
|
CAmount currentWatchImmatureBalance;
|
||||||
|
|
||||||
qint64 cachedTxLocks;
|
|
||||||
qint64 lastNewBlock;
|
|
||||||
|
|
||||||
int cachedNumBlocks;
|
|
||||||
|
|
||||||
TxViewDelegate *txdelegate;
|
TxViewDelegate *txdelegate;
|
||||||
TransactionFilterProxy *filter;
|
TransactionFilterProxy *filter;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user