Skip to content

Commit e99188e

Browse files
committed
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
1 parent 7710a31 commit e99188e

15 files changed

+29
-298
lines changed

doc/release-notes-32459.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GUI changes
2+
3+
- Custom column widths in the Transactions tab are reset as a side-effect of legacy wallet removal. (#32459)

src/qt/forms/overviewpage.ui

Lines changed: 10 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,7 @@
111111
<property name="spacing">
112112
<number>12</number>
113113
</property>
114-
<item row="2" column="2">
115-
<widget class="QLabel" name="labelWatchPending">
116-
<property name="cursor">
117-
<cursorShape>IBeamCursor</cursorShape>
118-
</property>
119-
<property name="toolTip">
120-
<string>Unconfirmed transactions to watch-only addresses</string>
121-
</property>
122-
<property name="text">
123-
<string notr="true">0.00000000 BTC</string>
124-
</property>
125-
<property name="alignment">
126-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
127-
</property>
128-
<property name="textInteractionFlags">
129-
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
130-
</property>
131-
</widget>
132-
</item>
133-
<item row="2" column="1">
114+
<item row="1" column="1">
134115
<widget class="QLabel" name="labelUnconfirmed">
135116
<property name="cursor">
136117
<cursorShape>IBeamCursor</cursorShape>
@@ -149,59 +130,21 @@
149130
</property>
150131
</widget>
151132
</item>
152-
<item row="3" column="2">
153-
<widget class="QLabel" name="labelWatchImmature">
154-
<property name="cursor">
155-
<cursorShape>IBeamCursor</cursorShape>
156-
</property>
157-
<property name="toolTip">
158-
<string>Mined balance in watch-only addresses that has not yet matured</string>
159-
</property>
160-
<property name="text">
161-
<string notr="true">0.00000000 BTC</string>
162-
</property>
163-
<property name="alignment">
164-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
165-
</property>
166-
<property name="textInteractionFlags">
167-
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
168-
</property>
169-
</widget>
170-
</item>
171-
<item row="4" column="0" colspan="2">
133+
<item row="3" column="0" colspan="2">
172134
<widget class="Line" name="line">
173135
<property name="orientation">
174136
<enum>Qt::Horizontal</enum>
175137
</property>
176138
</widget>
177139
</item>
178-
<item row="4" column="2">
179-
<widget class="Line" name="lineWatchBalance">
180-
<property name="sizePolicy">
181-
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
182-
<horstretch>0</horstretch>
183-
<verstretch>0</verstretch>
184-
</sizepolicy>
185-
</property>
186-
<property name="minimumSize">
187-
<size>
188-
<width>140</width>
189-
<height>0</height>
190-
</size>
191-
</property>
192-
<property name="orientation">
193-
<enum>Qt::Horizontal</enum>
194-
</property>
195-
</widget>
196-
</item>
197-
<item row="5" column="0">
140+
<item row="4" column="0">
198141
<widget class="QLabel" name="labelTotalText">
199142
<property name="text">
200143
<string>Total:</string>
201144
</property>
202145
</widget>
203146
</item>
204-
<item row="3" column="1">
147+
<item row="2" column="1">
205148
<widget class="QLabel" name="labelImmature">
206149
<property name="cursor">
207150
<cursorShape>IBeamCursor</cursorShape>
@@ -220,7 +163,7 @@
220163
</property>
221164
</widget>
222165
</item>
223-
<item row="2" column="3">
166+
<item row="1" column="2">
224167
<spacer name="horizontalSpacer_2">
225168
<property name="orientation">
226169
<enum>Qt::Horizontal</enum>
@@ -233,14 +176,14 @@
233176
</property>
234177
</spacer>
235178
</item>
236-
<item row="3" column="0">
179+
<item row="2" column="0">
237180
<widget class="QLabel" name="labelImmatureText">
238181
<property name="text">
239182
<string>Immature:</string>
240183
</property>
241184
</widget>
242185
</item>
243-
<item row="5" column="1">
186+
<item row="4" column="1">
244187
<widget class="QLabel" name="labelTotal">
245188
<property name="cursor">
246189
<cursorShape>IBeamCursor</cursorShape>
@@ -259,43 +202,14 @@
259202
</property>
260203
</widget>
261204
</item>
262-
<item row="5" column="2">
263-
<widget class="QLabel" name="labelWatchTotal">
264-
<property name="cursor">
265-
<cursorShape>IBeamCursor</cursorShape>
266-
</property>
267-
<property name="toolTip">
268-
<string>Current total balance in watch-only addresses</string>
269-
</property>
270-
<property name="text">
271-
<string notr="true">21 000 000.00000000 BTC</string>
272-
</property>
273-
<property name="alignment">
274-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
275-
</property>
276-
<property name="textInteractionFlags">
277-
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
278-
</property>
279-
</widget>
280-
</item>
281-
<item row="0" column="2">
282-
<widget class="QLabel" name="labelWatchonly">
283-
<property name="text">
284-
<string>Watch-only:</string>
285-
</property>
286-
<property name="alignment">
287-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
288-
</property>
289-
</widget>
290-
</item>
291-
<item row="1" column="0">
205+
<item row="0" column="0">
292206
<widget class="QLabel" name="labelBalanceText">
293207
<property name="text">
294208
<string>Available:</string>
295209
</property>
296210
</widget>
297211
</item>
298-
<item row="1" column="1">
212+
<item row="0" column="1">
299213
<widget class="QLabel" name="labelBalance">
300214
<property name="cursor">
301215
<cursorShape>IBeamCursor</cursorShape>
@@ -314,42 +228,13 @@
314228
</property>
315229
</widget>
316230
</item>
317-
<item row="1" column="2">
318-
<widget class="QLabel" name="labelWatchAvailable">
319-
<property name="cursor">
320-
<cursorShape>IBeamCursor</cursorShape>
321-
</property>
322-
<property name="toolTip">
323-
<string>Your current balance in watch-only addresses</string>
324-
</property>
325-
<property name="text">
326-
<string notr="true">21 000 000.00000000 BTC</string>
327-
</property>
328-
<property name="alignment">
329-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
330-
</property>
331-
<property name="textInteractionFlags">
332-
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
333-
</property>
334-
</widget>
335-
</item>
336-
<item row="2" column="0">
231+
<item row="1" column="0">
337232
<widget class="QLabel" name="labelPendingText">
338233
<property name="text">
339234
<string>Pending:</string>
340235
</property>
341236
</widget>
342237
</item>
343-
<item row="0" column="1">
344-
<widget class="QLabel" name="labelSpendable">
345-
<property name="text">
346-
<string>Spendable:</string>
347-
</property>
348-
<property name="alignment">
349-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
350-
</property>
351-
</widget>
352-
</item>
353238
</layout>
354239
</item>
355240
</layout>

src/qt/overviewpage.cpp

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ class TxViewDelegate : public QAbstractItemDelegate
6868
foreground = brush.color();
6969
}
7070

71-
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
72-
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
73-
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
74-
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
75-
iconWatchonly.paint(painter, watchonlyRect);
76-
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
77-
}
78-
7971
painter->setPen(foreground);
8072
QRect boundingRect;
8173
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
@@ -202,26 +194,9 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
202194
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things
203195
// for the non-mining users
204196
bool showImmature = balances.immature_balance != 0;
205-
bool showWatchOnlyImmature = balances.immature_watch_only_balance != 0;
206-
207-
// for symmetry reasons also show immature label when the watch-only one is shown
208-
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
209-
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
210-
ui->labelWatchImmature->setVisible(!walletModel->wallet().privateKeysDisabled() && showWatchOnlyImmature); // show watch-only immature balance
211-
}
212197

213-
// show/hide watch-only labels
214-
void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
215-
{
216-
ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
217-
ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
218-
ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
219-
ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
220-
ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
221-
ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
222-
223-
if (!showWatchOnly)
224-
ui->labelWatchImmature->hide();
198+
ui->labelImmature->setVisible(showImmature);
199+
ui->labelImmatureText->setVisible(showImmature);
225200
}
226201

227202
void OverviewPage::setClientModel(ClientModel *model)
@@ -262,8 +237,6 @@ void OverviewPage::setWalletModel(WalletModel *model)
262237
connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance);
263238

264239
connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit);
265-
266-
updateWatchOnlyLabels(false);
267240
}
268241

269242
// update the display unit, to not use the default ("BTC")
@@ -324,8 +297,4 @@ void OverviewPage::setMonospacedFont(const QFont& f)
324297
ui->labelUnconfirmed->setFont(f);
325298
ui->labelImmature->setFont(f);
326299
ui->labelTotal->setFont(f);
327-
ui->labelWatchAvailable->setFont(f);
328-
ui->labelWatchPending->setFont(f);
329-
ui->labelWatchImmature->setFont(f);
330-
ui->labelWatchTotal->setFont(f);
331300
}

src/qt/overviewpage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ private Q_SLOTS:
6464
void updateDisplayUnit();
6565
void handleTransactionClicked(const QModelIndex &index);
6666
void updateAlerts(const QString &warnings);
67-
void updateWatchOnlyLabels(bool showWatchOnly);
6867
void setMonospacedFont(const QFont&);
6968
};
7069

src/qt/sendcoinsdialog.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,6 @@ void SendCoinsDialog::on_buttonMinimizeFee_clicked()
787787

788788
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
789789
{
790-
// Include watch-only for wallets without private key
791-
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
792-
793790
// Same behavior as send: if we have selected coins, only obtain their available balance.
794791
// Copy to avoid modifying the member's data.
795792
CCoinControl coin_control = *m_coin_control;
@@ -847,8 +844,6 @@ void SendCoinsDialog::updateCoinControlState()
847844
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
848845
m_coin_control->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
849846
m_coin_control->m_signal_bip125_rbf = ui->optInRBF->isChecked();
850-
// Include watch-only for wallets without private key
851-
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
852847
}
853848

854849
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state) {

src/qt/transactiondesc.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
using wallet::ISMINE_ALL;
2828
using wallet::ISMINE_SPENDABLE;
29-
using wallet::ISMINE_WATCH_ONLY;
3029
using wallet::isminetype;
3130

3231
QString TransactionDesc::FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool)
@@ -150,7 +149,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
150149
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
151150
strHTML += "<b>" + tr("To") + ":</b> ";
152151
strHTML += GUIUtil::HtmlEscape(rec->address);
153-
QString addressOwned = ismine == ISMINE_SPENDABLE ? tr("own address") : tr("watch-only");
152+
QString addressOwned = tr("own address");
154153
if (!name.empty())
155154
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(name) + ")";
156155
else
@@ -218,10 +217,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
218217

219218
if (fAllFromMe)
220219
{
221-
if(fAllFromMe & ISMINE_WATCH_ONLY)
222-
strHTML += "<b>" + tr("From") + ":</b> " + tr("watch-only") + "<br>";
223-
224-
//
225220
// Debit
226221
//
227222
auto mine = wtx.txout_is_mine.begin();
@@ -246,8 +241,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
246241
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
247242
if(toSelf == ISMINE_SPENDABLE)
248243
strHTML += " (" + tr("own address") + ")";
249-
else if(toSelf & ISMINE_WATCH_ONLY)
250-
strHTML += " (" + tr("watch-only") + ")";
251244
strHTML += "<br>";
252245
}
253246
}
@@ -370,7 +363,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
370363
}
371364
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
372365
strHTML = strHTML + " IsMine=" + (wallet.txoutIsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
373-
strHTML = strHTML + " IsWatchOnly=" + (wallet.txoutIsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
374366
}
375367
}
376368
}

src/qt/transactionfilterproxy.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
3030
if (!(TYPE(type) & typeFilter))
3131
return false;
3232

33-
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
34-
if (involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_No)
35-
return false;
36-
if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes)
37-
return false;
38-
3933
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
4034
if (dateFrom && datetime < *dateFrom) return false;
4135
if (dateTo && datetime > *dateTo) return false;
@@ -82,12 +76,6 @@ void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
8276
invalidateFilter();
8377
}
8478

85-
void TransactionFilterProxy::setWatchOnlyFilter(WatchOnlyFilter filter)
86-
{
87-
this->watchOnlyFilter = filter;
88-
invalidateFilter();
89-
}
90-
9179
void TransactionFilterProxy::setShowInactive(bool _showInactive)
9280
{
9381
this->showInactive = _showInactive;

0 commit comments

Comments
 (0)