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 committed 2025-05-19 10:11:18 +02:00
1 parent 7710a31f0c
commit e99188e7da
15 files changed
+29 -298

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
GUI changes
- Custom column widths in the Transactions tab are reset as a side-effect of legacy wallet removal. (#32459)
+10 -125
View File
@@ -111,26 +111,7 @@
<property name="spacing"> <property name="spacing">
<number>12</number> <number>12</number>
</property> </property>
<item row="2" column="2"> <item row="1" column="1">
<widget class="QLabel" name="labelWatchPending">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Unconfirmed transactions to watch-only addresses</string>
</property>
<property name="text">
<string notr="true">0.00000000 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelUnconfirmed"> <widget class="QLabel" name="labelUnconfirmed">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@@ -149,59 +130,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="3" column="0" colspan="2">
<widget class="QLabel" name="labelWatchImmature">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Mined balance in watch-only addresses that has not yet matured</string>
</property>
<property name="text">
<string notr="true">0.00000000 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="4" column="0">
<widget class="Line" name="lineWatchBalance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelTotalText"> <widget class="QLabel" name="labelTotalText">
<property name="text"> <property name="text">
<string>Total:</string> <string>Total:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1">
<widget class="QLabel" name="labelImmature"> <widget class="QLabel" name="labelImmature">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@@ -220,7 +163,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="1" column="2">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@@ -233,14 +176,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="labelImmatureText"> <widget class="QLabel" name="labelImmatureText">
<property name="text"> <property name="text">
<string>Immature:</string> <string>Immature:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="4" column="1">
<widget class="QLabel" name="labelTotal"> <widget class="QLabel" name="labelTotal">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@@ -259,43 +202,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="0" column="0">
<widget class="QLabel" name="labelWatchTotal">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Current total balance in watch-only addresses</string>
</property>
<property name="text">
<string notr="true">21 000 000.00000000 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="labelWatchonly">
<property name="text">
<string>Watch-only:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelBalanceText"> <widget class="QLabel" name="labelBalanceText">
<property name="text"> <property name="text">
<string>Available:</string> <string>Available:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="0" column="1">
<widget class="QLabel" name="labelBalance"> <widget class="QLabel" name="labelBalance">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@@ -314,42 +228,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="0">
<widget class="QLabel" name="labelWatchAvailable">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Your current balance in watch-only addresses</string>
</property>
<property name="text">
<string notr="true">21 000 000.00000000 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPendingText"> <widget class="QLabel" name="labelPendingText">
<property name="text"> <property name="text">
<string>Pending:</string> <string>Pending:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="labelSpendable">
<property name="text">
<string>Spendable:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
+2 -33
View File
@@ -68,14 +68,6 @@ public:
foreground = brush.color(); foreground = brush.color();
} }
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
iconWatchonly.paint(painter, watchonlyRect);
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
}
painter->setPen(foreground); painter->setPen(foreground);
QRect boundingRect; QRect boundingRect;
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect); painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
@@ -202,26 +194,9 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things // only show immature (newly mined) balance if it's non-zero, so as not to complicate things
// for the non-mining users // for the non-mining users
bool showImmature = balances.immature_balance != 0; bool showImmature = balances.immature_balance != 0;
bool showWatchOnlyImmature = balances.immature_watch_only_balance != 0;
// for symmetry reasons also show immature label when the watch-only one is shown ui->labelImmature->setVisible(showImmature);
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); ui->labelImmatureText->setVisible(showImmature);
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
ui->labelWatchImmature->setVisible(!walletModel->wallet().privateKeysDisabled() && showWatchOnlyImmature); // show watch-only immature balance
}
// show/hide watch-only labels
void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
{
ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
if (!showWatchOnly)
ui->labelWatchImmature->hide();
} }
void OverviewPage::setClientModel(ClientModel *model) void OverviewPage::setClientModel(ClientModel *model)
@@ -262,8 +237,6 @@ void OverviewPage::setWalletModel(WalletModel *model)
connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance); connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance);
connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit); connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit);
updateWatchOnlyLabels(false);
} }
// update the display unit, to not use the default ("BTC") // update the display unit, to not use the default ("BTC")
@@ -324,8 +297,4 @@ void OverviewPage::setMonospacedFont(const QFont& f)
ui->labelUnconfirmed->setFont(f); ui->labelUnconfirmed->setFont(f);
ui->labelImmature->setFont(f); ui->labelImmature->setFont(f);
ui->labelTotal->setFont(f); ui->labelTotal->setFont(f);
ui->labelWatchAvailable->setFont(f);
ui->labelWatchPending->setFont(f);
ui->labelWatchImmature->setFont(f);
ui->labelWatchTotal->setFont(f);
} }
-1
View File
@@ -64,7 +64,6 @@ private Q_SLOTS:
void updateDisplayUnit(); void updateDisplayUnit();
void handleTransactionClicked(const QModelIndex &index); void handleTransactionClicked(const QModelIndex &index);
void updateAlerts(const QString &warnings); void updateAlerts(const QString &warnings);
void updateWatchOnlyLabels(bool showWatchOnly);
void setMonospacedFont(const QFont&); void setMonospacedFont(const QFont&);
}; };
-5
View File
@@ -787,9 +787,6 @@ void SendCoinsDialog::on_buttonMinimizeFee_clicked()
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry) void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
{ {
// Include watch-only for wallets without private key
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
// Same behavior as send: if we have selected coins, only obtain their available balance. // Same behavior as send: if we have selected coins, only obtain their available balance.
// Copy to avoid modifying the member's data. // Copy to avoid modifying the member's data.
CCoinControl coin_control = *m_coin_control; CCoinControl coin_control = *m_coin_control;
@@ -847,8 +844,6 @@ void SendCoinsDialog::updateCoinControlState()
// Either custom fee will be used or if not selected, the confirmation target from dropdown box // Either custom fee will be used or if not selected, the confirmation target from dropdown box
m_coin_control->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); m_coin_control->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
m_coin_control->m_signal_bip125_rbf = ui->optInRBF->isChecked(); m_coin_control->m_signal_bip125_rbf = ui->optInRBF->isChecked();
// Include watch-only for wallets without private key
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
} }
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state) { void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state) {
+1 -9
View File
@@ -26,7 +26,6 @@
using wallet::ISMINE_ALL; using wallet::ISMINE_ALL;
using wallet::ISMINE_SPENDABLE; using wallet::ISMINE_SPENDABLE;
using wallet::ISMINE_WATCH_ONLY;
using wallet::isminetype; using wallet::isminetype;
QString TransactionDesc::FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool) QString TransactionDesc::FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool)
@@ -150,7 +149,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>"; strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
strHTML += "<b>" + tr("To") + ":</b> "; strHTML += "<b>" + tr("To") + ":</b> ";
strHTML += GUIUtil::HtmlEscape(rec->address); strHTML += GUIUtil::HtmlEscape(rec->address);
QString addressOwned = ismine == ISMINE_SPENDABLE ? tr("own address") : tr("watch-only"); QString addressOwned = tr("own address");
if (!name.empty()) if (!name.empty())
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(name) + ")"; strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(name) + ")";
else else
@@ -218,10 +217,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
if (fAllFromMe) if (fAllFromMe)
{ {
if(fAllFromMe & ISMINE_WATCH_ONLY)
strHTML += "<b>" + tr("From") + ":</b> " + tr("watch-only") + "<br>";
//
// Debit // Debit
// //
auto mine = wtx.txout_is_mine.begin(); auto mine = wtx.txout_is_mine.begin();
@@ -246,8 +241,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address)); strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
if(toSelf == ISMINE_SPENDABLE) if(toSelf == ISMINE_SPENDABLE)
strHTML += " (" + tr("own address") + ")"; strHTML += " (" + tr("own address") + ")";
else if(toSelf & ISMINE_WATCH_ONLY)
strHTML += " (" + tr("watch-only") + ")";
strHTML += "<br>"; strHTML += "<br>";
} }
} }
@@ -370,7 +363,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
} }
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue); strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
strHTML = strHTML + " IsMine=" + (wallet.txoutIsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>"; strHTML = strHTML + " IsMine=" + (wallet.txoutIsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
strHTML = strHTML + " IsWatchOnly=" + (wallet.txoutIsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
} }
} }
} }
-12
View File
@@ -30,12 +30,6 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
if (!(TYPE(type) & typeFilter)) if (!(TYPE(type) & typeFilter))
return false; return false;
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
if (involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_No)
return false;
if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes)
return false;
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime(); QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
if (dateFrom && datetime < *dateFrom) return false; if (dateFrom && datetime < *dateFrom) return false;
if (dateTo && datetime > *dateTo) return false; if (dateTo && datetime > *dateTo) return false;
@@ -82,12 +76,6 @@ void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
invalidateFilter(); invalidateFilter();
} }
void TransactionFilterProxy::setWatchOnlyFilter(WatchOnlyFilter filter)
{
this->watchOnlyFilter = filter;
invalidateFilter();
}
void TransactionFilterProxy::setShowInactive(bool _showInactive) void TransactionFilterProxy::setShowInactive(bool _showInactive)
{ {
this->showInactive = _showInactive; this->showInactive = _showInactive;
-9
View File
@@ -25,13 +25,6 @@ public:
static quint32 TYPE(int type) { return 1<<type; } static quint32 TYPE(int type) { return 1<<type; }
enum WatchOnlyFilter
{
WatchOnlyFilter_All,
WatchOnlyFilter_Yes,
WatchOnlyFilter_No
};
/** Filter transactions between date range. Use std::nullopt for open range. */ /** Filter transactions between date range. Use std::nullopt for open range. */
void setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to); void setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to);
void setSearchString(const QString &); void setSearchString(const QString &);
@@ -40,7 +33,6 @@ public:
*/ */
void setTypeFilter(quint32 modes); void setTypeFilter(quint32 modes);
void setMinAmount(const CAmount& minimum); void setMinAmount(const CAmount& minimum);
void setWatchOnlyFilter(WatchOnlyFilter filter);
/** Set whether to show conflicted transactions. */ /** Set whether to show conflicted transactions. */
void setShowInactive(bool showInactive); void setShowInactive(bool showInactive);
@@ -53,7 +45,6 @@ private:
std::optional<QDateTime> dateTo; std::optional<QDateTime> dateTo;
QString m_search_string; QString m_search_string;
quint32 typeFilter; quint32 typeFilter;
WatchOnlyFilter watchOnlyFilter{WatchOnlyFilter_All};
CAmount minAmount{0}; CAmount minAmount{0};
bool showInactive{true}; bool showInactive{true};
}; };
-11
View File
@@ -15,7 +15,6 @@
using wallet::ISMINE_NO; using wallet::ISMINE_NO;
using wallet::ISMINE_SPENDABLE; using wallet::ISMINE_SPENDABLE;
using wallet::ISMINE_WATCH_ONLY;
using wallet::isminetype; using wallet::isminetype;
/* Return positive answer if transaction should be shown in list. /* Return positive answer if transaction should be shown in list.
@@ -40,7 +39,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
Txid hash = wtx.tx->GetHash(); Txid hash = wtx.tx->GetHash();
std::map<std::string, std::string> mapValue = wtx.value_map; std::map<std::string, std::string> mapValue = wtx.value_map;
bool involvesWatchAddress = false;
isminetype fAllFromMe = ISMINE_SPENDABLE; isminetype fAllFromMe = ISMINE_SPENDABLE;
bool any_from_me = false; bool any_from_me = false;
if (wtx.is_coinbase) { if (wtx.is_coinbase) {
@@ -48,18 +46,12 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
} else { } else {
for (const isminetype mine : wtx.txin_is_mine) for (const isminetype mine : wtx.txin_is_mine)
{ {
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
if(fAllFromMe > mine) fAllFromMe = mine; if(fAllFromMe > mine) fAllFromMe = mine;
if (mine) any_from_me = true; if (mine) any_from_me = true;
} }
} }
if (fAllFromMe || !any_from_me) { if (fAllFromMe || !any_from_me) {
for (const isminetype mine : wtx.txout_is_mine)
{
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
}
CAmount nTxFee = nDebit - wtx.tx->GetValueOut(); CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
for(unsigned int i = 0; i < wtx.tx->vout.size(); i++) for(unsigned int i = 0; i < wtx.tx->vout.size(); i++)
@@ -79,7 +71,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
TransactionRecord sub(hash, nTime); TransactionRecord sub(hash, nTime);
sub.idx = i; sub.idx = i;
sub.involvesWatchAddress = involvesWatchAddress;
if (!std::get_if<CNoDestination>(&wtx.txout_address[i])) if (!std::get_if<CNoDestination>(&wtx.txout_address[i]))
{ {
@@ -116,7 +107,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
TransactionRecord sub(hash, nTime); TransactionRecord sub(hash, nTime);
sub.idx = i; // vout index sub.idx = i; // vout index
sub.credit = txout.nValue; sub.credit = txout.nValue;
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
if (wtx.txout_address_is_mine[i]) if (wtx.txout_address_is_mine[i])
{ {
// Received by Bitcoin Address // Received by Bitcoin Address
@@ -143,7 +133,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
// Mixed debit transaction, can't break down payees // Mixed debit transaction, can't break down payees
// //
parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0)); parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0));
parts.last().involvesWatchAddress = involvesWatchAddress;
} }
return parts; return parts;
-3
View File
@@ -115,9 +115,6 @@ public:
/** Status: can change with block chain update */ /** Status: can change with block chain update */
TransactionStatus status; TransactionStatus status;
/** Whether the transaction was sent/received with a watch-only address */
bool involvesWatchAddress;
/** Return the unique identifier for this transaction (part) */ /** Return the unique identifier for this transaction (part) */
QString getTxHash() const; QString getTxHash() const;
+5 -31
View File
@@ -35,7 +35,6 @@
// Amount column is right-aligned it contains numbers // Amount column is right-aligned it contains numbers
static int column_alignments[] = { static int column_alignments[] = {
Qt::AlignLeft|Qt::AlignVCenter, /*status=*/ Qt::AlignLeft|Qt::AlignVCenter, /*status=*/
Qt::AlignLeft|Qt::AlignVCenter, /*watchonly=*/
Qt::AlignLeft|Qt::AlignVCenter, /*date=*/ Qt::AlignLeft|Qt::AlignVCenter, /*date=*/
Qt::AlignLeft|Qt::AlignVCenter, /*type=*/ Qt::AlignLeft|Qt::AlignVCenter, /*type=*/
Qt::AlignLeft|Qt::AlignVCenter, /*address=*/ Qt::AlignLeft|Qt::AlignVCenter, /*address=*/
@@ -255,7 +254,7 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle
{ {
subscribeToCoreSignals(); 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()); priv->refreshWallet(walletModel->wallet());
connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit); 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 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) switch(wtx->type)
{ {
case TransactionRecord::RecvFromOther: case TransactionRecord::RecvFromOther:
return QString::fromStdString(wtx->address) + watchAddress; return QString::fromStdString(wtx->address);
case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress: case TransactionRecord::SendToAddress:
case TransactionRecord::Generated: case TransactionRecord::Generated:
return lookupAddress(wtx->address, tooltip) + watchAddress; return lookupAddress(wtx->address, tooltip);
case TransactionRecord::SendToOther: case TransactionRecord::SendToOther:
return QString::fromStdString(wtx->address) + watchAddress; return QString::fromStdString(wtx->address);
default: 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 TransactionTableModel::formatTooltip(const TransactionRecord *rec) const
{ {
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec); QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec);
@@ -520,8 +505,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
switch (column) { switch (column) {
case Status: case Status:
return txStatusDecoration(rec); return txStatusDecoration(rec);
case Watchonly:
return txWatchonlyDecoration(rec);
case Date: return {}; case Date: return {};
case Type: return {}; case Type: return {};
case ToAddress: case ToAddress:
@@ -537,7 +520,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole: case Qt::DisplayRole:
switch (column) { switch (column) {
case Status: return {}; case Status: return {};
case Watchonly: return {};
case Date: case Date:
return formatTxDate(rec); return formatTxDate(rec);
case Type: 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)); return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
case Type: case Type:
return formatTxType(rec); return formatTxType(rec);
case Watchonly:
return (rec->involvesWatchAddress ? 1 : 0);
case ToAddress: case ToAddress:
return formatTxToAddress(rec, true); return formatTxToAddress(rec, true);
case Amount: case Amount:
@@ -593,10 +573,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return rec->type; return rec->type;
case DateRole: case DateRole:
return QDateTime::fromSecsSinceEpoch(rec->time); return QDateTime::fromSecsSinceEpoch(rec->time);
case WatchonlyRole:
return rec->involvesWatchAddress;
case WatchonlyDecorationRole:
return txWatchonlyDecoration(rec);
case LongDescriptionRole: case LongDescriptionRole:
return priv->describe(walletModel->node(), walletModel->wallet(), rec, walletModel->getOptionsModel()->getDisplayUnit()); return priv->describe(walletModel->node(), walletModel->wallet(), rec, walletModel->getOptionsModel()->getDisplayUnit());
case AddressRole: case AddressRole:
@@ -669,8 +645,6 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
return tr("Date and time that the transaction was received."); return tr("Date and time that the transaction was received.");
case Type: case Type:
return tr("Type of transaction."); return tr("Type of transaction.");
case Watchonly:
return tr("Whether or not a watch-only address is involved in this transaction.");
case ToAddress: case ToAddress:
return tr("User-defined intent/purpose of the transaction."); return tr("User-defined intent/purpose of the transaction.");
case Amount: case Amount:
+4 -10
View File
@@ -33,11 +33,10 @@ public:
enum ColumnIndex { enum ColumnIndex {
Status = 0, Status = 0,
Watchonly = 1, Date = 1,
Date = 2, Type = 2,
Type = 3, ToAddress = 3,
ToAddress = 4, Amount = 4
Amount = 5
}; };
/** Roles to get specific information from a transaction row. /** Roles to get specific information from a transaction row.
@@ -48,10 +47,6 @@ public:
TypeRole = Qt::UserRole, TypeRole = Qt::UserRole,
/** Date and time this transaction was created */ /** Date and time this transaction was created */
DateRole, DateRole,
/** Watch-only boolean */
WatchonlyRole,
/** Watch-only icon */
WatchonlyDecorationRole,
/** Long description (HTML format) */ /** Long description (HTML format) */
LongDescriptionRole, LongDescriptionRole,
/** Address of transaction */ /** Address of transaction */
@@ -104,7 +99,6 @@ private:
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::SeparatorStyle::STANDARD) const; QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::SeparatorStyle::STANDARD) const;
QString formatTooltip(const TransactionRecord *rec) const; QString formatTooltip(const TransactionRecord *rec) const;
QVariant txStatusDecoration(const TransactionRecord *wtx) const; QVariant txStatusDecoration(const TransactionRecord *wtx) const;
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const;
QVariant txAddressDecoration(const TransactionRecord *wtx) const; QVariant txAddressDecoration(const TransactionRecord *wtx) const;
public Q_SLOTS: public Q_SLOTS:
+3 -38
View File
@@ -57,13 +57,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
hlayout->addSpacing(23); hlayout->addSpacing(23);
} }
watchOnlyWidget = new QComboBox(this);
watchOnlyWidget->setFixedWidth(24);
watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
hlayout->addWidget(watchOnlyWidget);
dateWidget = new QComboBox(this); dateWidget = new QComboBox(this);
if (platformStyle->getUseExtraSpacing()) { if (platformStyle->getUseExtraSpacing()) {
dateWidget->setFixedWidth(121); dateWidget->setFixedWidth(121);
@@ -153,9 +146,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
transactionView->verticalHeader()->hide(); transactionView->verticalHeader()->hide();
QSettings settings; QSettings settings;
if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState").toByteArray())) { if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState-2025").toByteArray())) {
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
@@ -181,7 +173,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate); connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate);
connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType); connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType);
connect(watchOnlyWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, qOverload<>(&QTimer::start)); connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, qOverload<>(&QTimer::start));
connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount); connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount);
connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, qOverload<>(&QTimer::start)); connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, qOverload<>(&QTimer::start));
@@ -201,7 +192,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
TransactionView::~TransactionView() TransactionView::~TransactionView()
{ {
QSettings settings; QSettings settings;
settings.setValue("TransactionViewHeaderState", transactionView->horizontalHeader()->saveState()); // Rename this cache when adding or removing columns.
settings.setValue("TransactionViewHeaderState-2025", transactionView->horizontalHeader()->saveState());
} }
void TransactionView::setModel(WalletModel *_model) void TransactionView::setModel(WalletModel *_model)
@@ -240,23 +232,11 @@ void TransactionView::setModel(WalletModel *_model)
} }
} }
} }
// hide column Watch-only
updateWatchOnlyColumn(false);
} }
} }
void TransactionView::changeEvent(QEvent* e) void TransactionView::changeEvent(QEvent* e)
{ {
if (e->type() == QEvent::PaletteChange) {
watchOnlyWidget->setItemIcon(
TransactionFilterProxy::WatchOnlyFilter_Yes,
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_plus")));
watchOnlyWidget->setItemIcon(
TransactionFilterProxy::WatchOnlyFilter_No,
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_minus")));
}
QWidget::changeEvent(e); QWidget::changeEvent(e);
} }
@@ -315,14 +295,6 @@ void TransactionView::chooseType(int idx)
typeWidget->itemData(idx).toInt()); typeWidget->itemData(idx).toInt());
} }
void TransactionView::chooseWatchonly(int idx)
{
if(!transactionProxyModel)
return;
transactionProxyModel->setWatchOnlyFilter(
static_cast<TransactionFilterProxy::WatchOnlyFilter>(watchOnlyWidget->itemData(idx).toInt()));
}
void TransactionView::changedSearch() void TransactionView::changedSearch()
{ {
if(!transactionProxyModel) if(!transactionProxyModel)
@@ -645,13 +617,6 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
return QWidget::eventFilter(obj, event); return QWidget::eventFilter(obj, event);
} }
// show/hide column Watch-only
void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
{
watchOnlyWidget->setVisible(fHaveWatchOnly);
transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
}
void TransactionView::closeOpenedDialogs() void TransactionView::closeOpenedDialogs()
{ {
// close all dialogs opened from this view // close all dialogs opened from this view
-4
View File
@@ -55,7 +55,6 @@ public:
enum ColumnWidths { enum ColumnWidths {
STATUS_COLUMN_WIDTH = 30, STATUS_COLUMN_WIDTH = 30,
WATCHONLY_COLUMN_WIDTH = 23,
DATE_COLUMN_WIDTH = 120, DATE_COLUMN_WIDTH = 120,
TYPE_COLUMN_WIDTH = 113, TYPE_COLUMN_WIDTH = 113,
AMOUNT_MINIMUM_COLUMN_WIDTH = 120, AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
@@ -72,7 +71,6 @@ private:
QComboBox *dateWidget; QComboBox *dateWidget;
QComboBox *typeWidget; QComboBox *typeWidget;
QComboBox *watchOnlyWidget;
QLineEdit *search_widget; QLineEdit *search_widget;
QLineEdit *amountWidget; QLineEdit *amountWidget;
@@ -106,7 +104,6 @@ private Q_SLOTS:
void copyTxHex(); void copyTxHex();
void copyTxPlainText(); void copyTxPlainText();
void openThirdPartyTxUrl(QString url); void openThirdPartyTxUrl(QString url);
void updateWatchOnlyColumn(bool fHaveWatchOnly);
void abandonTx(); void abandonTx();
void bumpFee(bool checked); void bumpFee(bool checked);
@@ -121,7 +118,6 @@ Q_SIGNALS:
public Q_SLOTS: public Q_SLOTS:
void chooseDate(int idx); void chooseDate(int idx);
void chooseType(int idx); void chooseType(int idx);
void chooseWatchonly(int idx);
void changedAmount(); void changedAmount();
void changedSearch(); void changedSearch();
void exportClicked(); void exportClicked();
+1 -7
View File
@@ -601,13 +601,7 @@ CAmount WalletModel::getAvailableBalance(const CCoinControl* control)
// No selected coins, return the cached balance // No selected coins, return the cached balance
if (!control || !control->HasSelected()) { if (!control || !control->HasSelected()) {
const interfaces::WalletBalances& balances = getCachedBalance(); const interfaces::WalletBalances& balances = getCachedBalance();
CAmount available_balance = balances.balance; return balances.balance;
// if wallet private keys are disabled, this is a watch-only wallet
// so, let's include the watch-only balance.
if (balances.have_watch_only && m_wallet->privateKeysDisabled()) {
available_balance += balances.watch_only_balance;
}
return available_balance;
} }
// Fetch balance from the wallet, taking into account the selected coins // Fetch balance from the wallet, taking into account the selected coins
return wallet().getAvailableBalance(*control); return wallet().getAvailableBalance(*control);