qt: drop unused watch-only functionality

The watch-only functionality in the GUI was only used for legacy wallets.
Watch-only descriptor wallets do not use this.

The only visible changes of this commit are:
- dropped "Spendable:" label from the overview tab
- column width cache is reset
This commit is contained in:
Sjors Provoost
2025-05-12 12:17:12 +02:00
parent 7710a31f0c
commit e99188e7da
15 changed files with 29 additions and 298 deletions

View File

@@ -35,7 +35,6 @@
// Amount column is right-aligned it contains numbers
static int column_alignments[] = {
Qt::AlignLeft|Qt::AlignVCenter, /*status=*/
Qt::AlignLeft|Qt::AlignVCenter, /*watchonly=*/
Qt::AlignLeft|Qt::AlignVCenter, /*date=*/
Qt::AlignLeft|Qt::AlignVCenter, /*type=*/
Qt::AlignLeft|Qt::AlignVCenter, /*address=*/
@@ -255,7 +254,7 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle
{
subscribeToCoreSignals();
columns << QString() << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
columns << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet(walletModel->wallet());
connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit);
@@ -403,24 +402,18 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
{
QString watchAddress;
if (tooltip && wtx->involvesWatchAddress) {
// Mark transactions involving watch-only addresses by adding " (watch-only)"
watchAddress = QLatin1String(" (") + tr("watch-only") + QLatin1Char(')');
}
switch(wtx->type)
{
case TransactionRecord::RecvFromOther:
return QString::fromStdString(wtx->address) + watchAddress;
return QString::fromStdString(wtx->address);
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
return lookupAddress(wtx->address, tooltip) + watchAddress;
return lookupAddress(wtx->address, tooltip);
case TransactionRecord::SendToOther:
return QString::fromStdString(wtx->address) + watchAddress;
return QString::fromStdString(wtx->address);
default:
return tr("(n/a)") + watchAddress;
return tr("(n/a)");
}
}
@@ -489,14 +482,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
}
}
QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
{
if (wtx->involvesWatchAddress)
return QIcon(":/icons/eye");
else
return QVariant();
}
QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const
{
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec);
@@ -520,8 +505,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
switch (column) {
case Status:
return txStatusDecoration(rec);
case Watchonly:
return txWatchonlyDecoration(rec);
case Date: return {};
case Type: return {};
case ToAddress:
@@ -537,7 +520,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
switch (column) {
case Status: return {};
case Watchonly: return {};
case Date:
return formatTxDate(rec);
case Type:
@@ -557,8 +539,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
case Type:
return formatTxType(rec);
case Watchonly:
return (rec->involvesWatchAddress ? 1 : 0);
case ToAddress:
return formatTxToAddress(rec, true);
case Amount:
@@ -593,10 +573,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return rec->type;
case DateRole:
return QDateTime::fromSecsSinceEpoch(rec->time);
case WatchonlyRole:
return rec->involvesWatchAddress;
case WatchonlyDecorationRole:
return txWatchonlyDecoration(rec);
case LongDescriptionRole:
return priv->describe(walletModel->node(), walletModel->wallet(), rec, walletModel->getOptionsModel()->getDisplayUnit());
case AddressRole:
@@ -669,8 +645,6 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
return tr("Date and time that the transaction was received.");
case Type:
return tr("Type of transaction.");
case Watchonly:
return tr("Whether or not a watch-only address is involved in this transaction.");
case ToAddress:
return tr("User-defined intent/purpose of the transaction.");
case Amount: