-
Notifications
You must be signed in to change notification settings - Fork 38.8k
[qt] navigate to transaction history page after send #12421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[qt] navigate to transaction history page after send #12421
Conversation
|
Concept ACK |
|
utACK ddbc5aaee1bdb69583eb711ad3145fa5f8b67933 |
IMHO this is more confusing, having such sudden UI change. What if he wants to do multiple sends? How about adding a checkbox like |
src/qt/sendcoinsdialog.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the idea is to highlight the transaction, adding the txid or like can help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can extract the tx id and pass it along as a string. The part I couldn't figure out is how to convert that to whatever focusTransaction(const QModelIndex &idx) needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, rename to coinsSent().
Regarding row focus, see https://stackoverflow.com/a/35154534.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
@promag I don't think I've ever seen an online banking application that doesn't take the user to the transaction overview page after sending money. In most financial applications Send is a modal experience, where the Send screen is pushed on top of the transaction screen and popped when the user is done. In a desktop browser that's usually a modal window, on an iPhone it's a window that animates in from the right, with an arrow on the top left to dismiss it. Doing another send is then simply a matter of clicking on Send again. Making the experience modal might be too much of a change, but e.g. we could get rid of all tabs: merge the Overview and Transactions tab, Send and Receive open a new window. I do think highlighting the new transaction would give a better visual clue to the user as to why they moved to this other tab. |
|
utACK ddbc5aaee1bdb69583eb711ad3145fa5f8b67933 |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sjors like you say the current layout is very different from those you mention. Anyway, ACK with the row focus.
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment? It's only relevant below when connecting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
src/qt/sendcoinsdialog.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, rename to coinsSent().
Regarding row focus, see https://stackoverflow.com/a/35154534.
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, add
ui->checkBoxCoinControlChange->setChecked(false);
ui->lineEditCoinControlChange->clear();like #12432?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coin control fields, custom change address and selected inputs, are already cleared after you send.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please verify custom change address checkbox and line edit because here they are not cleared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Turns out #12432 fixes that, because SendCoinsDialog::accept() is called when the transaction is sent, which in turn calls clear().
|
Concept ACK |
|
Concept ACK. |
26fd965 to
44c7768
Compare
|
It now highlights the transaction. |
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (results.isEmpty()) return;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after if, one line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/qt/sendcoinsdialog.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const QString& txid so that it's clear what the argument is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this performs linear search. Probably something worth to optimise in case of bigger wallets in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are transactions in reverse chronological order? In that case it should be pretty quick, unless some race condition causes the new transaction to be missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transactions are displayed in whatever order the user chooses. I'm not sure what order is internally used, however...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a fresh wallet and then called generate 10000. I didn't notice any delay when sending transactions, although my machine is relatively fast. I also tried reversing transaction order in the view.
44c7768 to
ea04610
Compare
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh on using strings for internal uint256 transport.
Why not uint256? Could also register the type if not yet supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried passing the uint256 directly and got a bloodbath of compiler errors. How do I go about registering the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Q_DECLARE_METATYPE, see
Lines 80 to 82 in dcfe218
| // Declare meta types used for QMetaObject::invokeMethod | |
| Q_DECLARE_METATYPE(bool*) | |
| Q_DECLARE_METATYPE(CAmount) |
ea04610 to
fdea382
Compare
|
Now passing the transaction hash as |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK fdea382.
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/qt/sendcoinsdialog.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use reference? const uint256& txid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use reference? const uint256& txid.
fdea382 to
b7ebe39
Compare
|
reACK b7ebe39, only changes are the suggested above. |
@promag Then he should do them all at once... |
src/qt/transactionview.cpp
Outdated
|
|
||
| if (results.isEmpty()) return; | ||
|
|
||
| focusTransaction(results[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support selecting multiple transactions, so this ought to select all of them...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider more than 1 result an error, given that we're passing a single tx id. I could replace the isEmpty() with a check that length is 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely not an error. The transaction list shows logical transactions, not blockchain transactions. There is 1 txid per blockchain transaction, but that could be many logical transactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you mean. E.g. sending to two destinations in one transaction results in two rows in the transactions tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luke-jr 👍
|
@luke-jr agree, came to the same conclusion little after. |
|
I'd like to select both entries on the transaction screen when a user sends to two addresses. Unfortunately:
|
|
https://doc.qt.io/qt-5/qtableview.html#setSelection with Why would match only return one entry?? |
I don't know. Here's a WIP commit. The I'm confused about the relation between |
|
I added @promag's commit to enable multi row selection. Note that if the user scrolls down, it won't scroll up. And if the user orders transactions by ascending date and scrolls down, it won't scroll further down to reveal the new transaction. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK after squash and comments addressed.
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could ensure first row is visible:
for (...) {
if (index == results[0]) transactionView->scrollTo(index);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That worked (using transactionProxyModel->mapFromSource) when transactions are ordered by date. Unfortunately when they're ordered in reverse it doesn't scroll all the way to the bottom. Maybe we need to wait a little bit for transactionView to become aware of its new size?
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, add space after if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid copy here:
const uint256& txid = ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or roll it into the Q_EMIT, as txid is not used after this. YMMV. For performance I'd be surprised it makes any difference.
Q_EMIT coinsSent(currentTransaction.getTransaction()->GetHash());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rolled into Q_EMIT.
laanwj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or roll it into the Q_EMIT, as txid is not used after this. YMMV. For performance I'd be surprised it makes any difference.
Q_EMIT coinsSent(currentTransaction.getTransaction()->GetHash());
f22196f to
48ef8d8
Compare
src/qt/transactionview.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my system calling transactionView->scrollTo(targetIndex) for every model index fixes it (not sure why). It also works in the default order because scroll hint is QAbstractItemView::EnsureVisible, so focusing the 2nd row will not remove the 1st from the viewport (the 2nd row is already visible).
But it's also possible to order by other column (for instance address), and in that case it can be impossible to show the whole selection in the table viewport.
I see 3 possible solutions for that:
- do nothing
; - automatically sort by date descending (new rows will be the first);
- automatically fill the filter field with the new txid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I call scrollTo for every model index and transactions are sort by ascending date, things get weird: if I send to two destinations it scrolls correctly, but if I send to one destination it won't scroll far enough.
Calling scollTo() twice "fixes" it. Seems suspiciously similar to this I'll poke around a bit.
I prefer your first solution for the case where transactions are not ordered by date. At least one of them will be in view.
The transaction will be selected. When sending to multiple destinations, all will be selected (thanks @promag).
48ef8d8 to
e7d9fc5
Compare
e7d9fc5 [qt] navigate to transaction history page after send (Sjors Provoost) Pull request description: Before this change QT just remained on the Send tab, which I found confusing. Now it switches to the Transactions tab. This makes it more clear to the user that the send actually succeeded, and here they can monitor progress. Ideally I would like to highlight the transaction, e.g. by refactoring `TransactionView::focusTransaction(const QModelIndex &idx)` to accept a transaction hash, but I'm not sure how to do that. Tree-SHA512: 8aa93e03874de8434e18951f8aec47377814c0bcaf7eda4766fc41d5a4e32806346e12e4139e4d45468dfdf0b786f5a7faa393a31b8cd6c65ccac21fb3782c33
…e bump d795c61 [qt] TransactionView: highlight replacement tx after fee bump (Sjors Provoost) Pull request description: Consistent with #12421 which highlights the transaction after send. <img width="747" alt="1" src="https://user-images.githubusercontent.com/10217/38036280-a7358ea4-32a6-11e8-8f92-417e9e1e3e8b.png"> <img width="685" alt="2" src="https://user-images.githubusercontent.com/10217/38036289-aac87040-32a6-11e8-9f94-81745ff6c592.png"> ~I'm not too proud of the `QTimer::singleShot(10` bit; any suggestions on how to properly wait for the transactions table to become aware of the new transaction?~ Although I could have called `focusTransaction()` directly from `TransactionView::bumpFee()` I'm using the same signal as the send screen. This should make it easier to move fee bump / transaction replacement functionality around later. Tree-SHA512: 242055b7c3d32c7b2cf871f5ceda2581221902fd53fa29e0b092713fc16d3191adbe8cbb28417d522dda9febec8cc05e07afe3489cd7caaecd33460c1dde6fbc
…send e7d9fc5 [qt] navigate to transaction history page after send (Sjors Provoost) Pull request description: Before this change QT just remained on the Send tab, which I found confusing. Now it switches to the Transactions tab. This makes it more clear to the user that the send actually succeeded, and here they can monitor progress. Ideally I would like to highlight the transaction, e.g. by refactoring `TransactionView::focusTransaction(const QModelIndex &idx)` to accept a transaction hash, but I'm not sure how to do that. Tree-SHA512: 8aa93e03874de8434e18951f8aec47377814c0bcaf7eda4766fc41d5a4e32806346e12e4139e4d45468dfdf0b786f5a7faa393a31b8cd6c65ccac21fb3782c33
Before this change QT just remained on the Send tab, which I found confusing. Now it switches to the Transactions tab. This makes it more clear to the user that the send actually succeeded, and here they can monitor progress.
Ideally I would like to highlight the transaction, e.g. by refactoring
TransactionView::focusTransaction(const QModelIndex &idx)to accept a transaction hash, but I'm not sure how to do that.