Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
overviewpage.cpp
Go to the documentation of this file.
51 QRect rectTopHalf(mainRect.left() + xspace, mainRect.top() + ypad, mainRect.width() - xspace, halfheight);
52 QRect rectBottomHalf(mainRect.left() + xspace, mainRect.top() + ypad + halfheight + 5, mainRect.width() - xspace, halfheight);
64 painter->setFont(GUIUtil::getFont(GUIUtil::FontWeight::Normal, false, GUIUtil::getScaledFontSize(initialFontSize * 1.17)));
71 QIcon iconInstantSend = qvariant_cast<QIcon>(indexAddress.data(TransactionTableModel::RawDecorationRole));
78 QString strAmount = BitcoinUnits::floorWithUnit(unit, nAmount, true, BitcoinUnits::separatorAlways);
84 painter->setFont(GUIUtil::getFont(GUIUtil::FontWeight::Normal, false, GUIUtil::getScaledFontSize(initialFontSize)));
93 QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
149 // Note: minimum height of listTransactions will be set later in updateAdvancedPSUI() to reflect actual settings
152 connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
191 void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance)
200 ui->labelBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance, false, BitcoinUnits::separatorAlways));
201 ui->labelUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedBalance, false, BitcoinUnits::separatorAlways));
202 ui->labelImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureBalance, false, BitcoinUnits::separatorAlways));
203 ui->labelAnonymized->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, anonymizedBalance, false, BitcoinUnits::separatorAlways));
204 ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance + unconfirmedBalance + immatureBalance, false, BitcoinUnits::separatorAlways));
205 ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways));
206 ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways));
207 ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways));
208 ui->labelWatchTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways));
210 // only show immature (newly mined) balance if it's non-zero or in UI debug mode, so as not to complicate things
235 ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
272 setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), model->getAnonymizedBalance(),
273 model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
274 connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(setBalance(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)));
276 connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
283 connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
284 connect(model->getOptionsModel(), SIGNAL(privateSentAmountChanged()), this, SLOT(updatePrivateSendProgress()));
285 connect(model->getOptionsModel(), SIGNAL(advancedPSUIChanged(bool)), this, SLOT(updateAdvancedPSUI(bool)));
303 setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance, currentAnonymizedBalance,
333 QString strPrivateSendAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, privateSendClient.nPrivateSendAmount * COIN, false, BitcoinUnits::separatorAlways);
341 strPrivateSendAmount = strPrivateSendAmount.remove(strPrivateSendAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
342 strAmountAndRounds = strPrivateSendAmount + " / " + tr("%n Rounds", "", privateSendClient.nPrivateSendRounds);
354 if(nMaxToAnonymize > privateSendClient.nPrivateSendAmount*COIN) nMaxToAnonymize = privateSendClient.nPrivateSendAmount*COIN;
361 strPrivateSendAmount = strPrivateSendAmount.remove(strPrivateSendAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
362 strAmountAndRounds = strPrivateSendAmount + " / " + tr("%n Rounds", "", privateSendClient.nPrivateSendRounds);
364 QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways);
365 ui->labelAmountRounds->setToolTip(tr("Not enough compatible inputs to mix <span style='%1'>%2</span>,<br>"
370 strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
371 strAmountAndRounds = "<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>" +
428 tr("Denominated inputs have %5 of %n rounds on average", "", privateSendClient.nPrivateSendRounds))
445 // Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason
449 ui->labelPrivateSendEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));
484 // Only update the widget's visibility if something changed since the last call of setWidgetsVisible
492 // Set visible if: fVisible and not advanced UI element or advanced ui element and advanced ui active
504 if(nBestHeight > privateSendClient.nCachedNumBlocks && GetTime() - nLastDSProgressBlockTime <= 1) return;
509 strKeysLeftText = "<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>" + strKeysLeftText + "</span>";
533 SetupTransactionList(fShowAdvancedPSUI ? NUM_ITEMS_ENABLED_ADVANCED : NUM_ITEMS_ENABLED_NORMAL);
538 if (nWalletBackups > 0 && walletModel->getKeysLeftSinceAutoBackup() < PRIVATESEND_KEYS_THRESHOLD_WARNING) {
541 QString strWarn = tr("Very low number of keys left since last automatic backup!") + "<br><br>" +
544 "saved in some safe place</span>!").arg(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_COMMAND)) + "<br><br>" +
547 LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, warning user and trying to create new backup...\n");
550 LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Very low number of keys left since last automatic backup, skipping warning and trying to create new backup...\n");
558 LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- WARNING! Something went wrong on automatic backup: %s\n", strBackupWarning.toStdString());
566 LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- ERROR! Failed to create automatic backup: %s\n", strBackupError.toStdString());
592 // We were able to create automatic backup but keypool was not replenished because wallet is locked.
593 QString strWarning = tr("WARNING! Failed to replenish keypool, please unlock your wallet to do so.");
615 tr("If you don't want to see internal PrivateSend fees/transactions select \"Most Common\" as Type on the \"Transactions\" tab."),
620 const CAmount nMinAmount = CPrivateSend::GetSmallestDenomination() + CPrivateSend::GetMaxCollateralAmount();
640 LogPrint(BCLog::PRIVATESEND, "OverviewPage::togglePrivateSend -- Wallet is locked and user declined to unlock. Disabling PrivateSend.\n");
687 ui->labelPrivateSendEnabled->setText("<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>(" + tr("Disabled") + ")</span>");
double getScaledFontSize(int nSize)
get font size with GUIUtil::fontScale applied
Definition: guiutil.cpp:1404
static CAmount GetSmallestDenomination()
Definition: privatesend.h:437
bool fCreateAutoBackups
Definition: privatesend-client.h:218
void setWalletModel(WalletModel *walletModel)
Definition: overviewpage.cpp:264
QFont getFont(FontFamily family, QFont::Weight qWeight, bool fItalic, int nPointSize)
Get a properly weighted QFont object with the selected font.
Definition: guiutil.cpp:1666
void updateAlerts(const QString &warnings)
Definition: overviewpage.cpp:313
void DisablePrivateSendCompletely()
Definition: overviewpage.cpp:683
void handleTransactionClicked(const QModelIndex &index)
Definition: overviewpage.cpp:174
void setFont(const std::vector< QWidget *> &vecWidgets, FontWeight weight, int nPointSize, bool fItalic)
Workaround to set correct font styles in all themes since there is a bug in macOS which leads to issu...
Definition: guiutil.cpp:1552
Definition: addressbookpage.h:12
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
Definition: bitcoinunits.cpp:167
TxViewDelegate(QObject *parent=nullptr)
Definition: overviewpage.cpp:36
static const int PRIVATESEND_KEYS_THRESHOLD_WARNING
Definition: privatesend-client.h:50
CAmount currentUnconfirmedBalance
Definition: overviewpage.h:54
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: util.cpp:824
CAmount getDenominatedBalance(bool unconfirmed) const
Definition: walletmodel.cpp:97
void outOfSyncWarningClicked()
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: overviewpage.cpp:101
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
Definition: clientmodel.cpp:250
EncryptionStatus getEncryptionStatus() const
Definition: walletmodel.cpp:479
CAmount getBalance(const CCoinControl *coinControl=nullptr) const
Definition: walletmodel.cpp:76
int nPrivateSendAmount
Definition: privatesend-client.h:210
void updateFonts()
Update the font of all widgets where a custom font has been set with GUIUtil::setFont.
Definition: guiutil.cpp:1563
CAmount currentWatchUnconfBalance
Definition: overviewpage.h:58
int nWalletBackups
nWalletBackups: 1..10 - number of automatic backups to keep 0 - disabled by command-line -1 - disable...
Definition: util.cpp:102
int64_t getKeysLeftSinceAutoBackup() const
Definition: walletmodel.cpp:553
void updateWatchOnlyLabels(bool showWatchOnly)
Definition: overviewpage.cpp:233
Definition: util.h:142
void updateAdvancedPSUI(bool fShowAdvancedPSUI)
Definition: overviewpage.cpp:434
CAmount getWatchUnconfirmedBalance() const
Definition: walletmodel.cpp:132
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: overviewpage.cpp:42
void privateSendEnabledChanged()
CAmount getAnonymizedBalance(const CCoinControl *coinControl=nullptr) const
Definition: walletmodel.cpp:92
TransactionTableModel * getTransactionTableModel()
Definition: walletmodel.cpp:469
void privateSendStatus(bool fForce=false)
Definition: overviewpage.cpp:439
bool fEnablePrivateSend
Definition: privatesend-client.h:213
void transactionClicked(const QModelIndex &index)
void showOutOfSyncWarning(bool fShow)
Definition: overviewpage.cpp:319
Definition: overviewpage.cpp:32
static QString floorWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit) but floor value up to "digits" settings.
Definition: bitcoinunits.cpp:174
CAmount getAverageAnonymizedRounds() const
Definition: walletmodel.cpp:107
UnlockContext requestUnlock(bool fForMixingOnly=false)
Definition: walletmodel.cpp:640
bool autoBackupWallet(QString &strBackupWarningRet, QString &strBackupErrorRet)
Definition: walletmodel.cpp:543
int nPrivateSendRounds
Definition: privatesend-client.h:208
Filter the transaction list according to pre-specified rules.
Definition: transactionfilterproxy.h:14
CAmount getNormalizedAnonymizedBalance() const
Definition: walletmodel.cpp:102
CAmount getUnconfirmedBalance() const
Definition: walletmodel.cpp:112
void updatePrivateSendProgress()
Definition: overviewpage.cpp:326
QString getThemedStyleQString(ThemedStyle style)
Helper to get css style strings which are injected into rich text through qt.
Definition: guiutil.cpp:210
std::string GetSessionDenoms()
Definition: privatesend-client.cpp:329
CAmount currentWatchImmatureBalance
Definition: overviewpage.h:59
static CAmount GetMaxCollateralAmount()
Definition: privatesend.h:461
void setClientModel(ClientModel *clientModel)
Definition: overviewpage.cpp:253
Definition: walletmodel.h:182
void handleOutOfSyncWarningClicks()
Definition: overviewpage.cpp:180
CAmount getWatchImmatureBalance() const
Definition: walletmodel.cpp:137
static QString floorHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Definition: bitcoinunits.cpp:185
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
Definition: bitcoinunits.cpp:162
void setBalance(const CAmount &balance, const CAmount &unconfirmedBalance, const CAmount &immatureBalance, const CAmount &anonymizedBalance, const CAmount &watchOnlyBalance, const CAmount &watchUnconfBalance, const CAmount &watchImmatureBalance)
Definition: overviewpage.cpp:191
Definition: walletmodel.h:125
CAmount getAnonymizableBalance(bool fSkipDenominated, bool fSkipUnconfirmed) const
Definition: walletmodel.cpp:87
Definition: bitcoinunits.h:70
void SetupTransactionList(int nNumItems)
Definition: overviewpage.cpp:658
bool fPrivateSendRunning
Definition: privatesend-client.h:214
Watch-only icon.
Definition: transactiontablemodel.h:51