TxConfAdv: label dummy outputs

This commit is contained in:
tobtoht 2021-06-28 17:30:08 +02:00
parent 6c3b691ae9
commit cfa96e8126
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
4 changed files with 11 additions and 10 deletions

View file

@ -110,7 +110,7 @@ void TxConfAdvDialog::setupConstructionData(ConstructionInfo *ci) {
auto address = o->address();
auto amount = WalletManager::displayAmount(o->amount());
auto index = m_ctx->wallet->subaddressIndex(address);
cursor.insertText(address, Utils::addressTextFormat(index));
cursor.insertText(address, Utils::addressTextFormat(index, o->amount()));
cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
cursor.insertBlock();
}

View file

@ -52,7 +52,7 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txIn
auto address = transfer->address();
auto amount = WalletManager::displayAmount(transfer->amount());
auto index = m_ctx->wallet->subaddressIndex(address);
cursor.insertText(address, Utils::addressTextFormat(index));
cursor.insertText(address, Utils::addressTextFormat(index, transfer->amount()));
cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
cursor.insertBlock();
}

View file

@ -453,20 +453,21 @@ int Utils::maxLength(const QVector<QString> &array) {
return maxLength;
}
QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index) {
QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index, quint64 amount) {
QTextCharFormat rec;
if (index.isPrimary()) {
QTextCharFormat rec;
rec.setBackground(QBrush(ColorScheme::YELLOW.asColor(true)));
rec.setToolTip("Wallet change/primary address");
return rec;
}
if (index.isValid()) {
QTextCharFormat rec;
else if (index.isValid()) {
rec.setBackground(QBrush(ColorScheme::GREEN.asColor(true)));
rec.setToolTip("Wallet receive address");
return rec;
}
return QTextCharFormat();
else if (amount == 0) {
rec.setBackground(QBrush(ColorScheme::GRAY.asColor(true)));
rec.setToolTip("Dummy output (Min. 2 outs consensus rule)");
}
return rec;
}
bool Utils::isTorsocks() {

View file

@ -75,7 +75,7 @@ public:
static QString amountToCurrencyString(double amount, const QString &currencyCode);
static int maxLength(const QVector<QString> &array);
static QMap<QString, QLocale> localeCache;
static QTextCharFormat addressTextFormat(const SubaddressIndex &index);
static QTextCharFormat addressTextFormat(const SubaddressIndex &index, quint64 amount);
static bool isTorsocks();
static QString defaultWalletDir();