-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add new "address type" column to the "receiving tab" address book page #753
base: master
Are you sure you want to change the base?
Add new "address type" column to the "receiving tab" address book page #753
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
af3c781
to
a204706
Compare
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.
cACK, nice
it jumps weird when having it sorted on address type and then changing the address type.
Screencast.from.12-09-2023.10.55.01.webm
a204706
to
4b00cdc
Compare
Fixed the issue reported by @MarnixCroes above where the columns were resizing incorrectly. A follow up could be to set a default width value for each column or most of them and have the feature of storing the user preferable width as in the peers table in the "Node window". |
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.
Thanks for checking that also @MarnixCroes. That looks weird, the way the export button works or its functionality behind it hasn't been even touched. For me, on master and with any network passed at the startup works the same, I always get the 2nd dialog you posted. I'll try it later on a different OS. Did the export actually worked for you? Another thing I could think of is that perhaps the new filter model has some particular behavior but I can imaging that would be used for the persistence, not for the file dialog itself, could you please try testing it just up to the 3rd. commit (that's where the new column is added but not the filter & combo-box)? On the folder you have this PR's code you can do it by running |
@pablomartin4btc
yes it does |
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.
tACK 4b00cdc
Don't worry, it was a good spot. This is the part of the code that opens the "Save file..." (app) dialog and as you can see the title that you were seeing in your first screenshot for master, "Export Address List" is being set there: gui/src/qt/addressbookpage.cpp Lines 320 to 324 in 4b00cdc
That code hasn't been touched by this PR. I couldn't reproduced it in either master or this branch in both Ubuntu 20.04 or 22.04 but I crossed compiled it in WSL and run So this PR hasn't interfered with the way that on the export feature the save file dialog is getting open or displayed. |
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.
Concept ACK, it looks like a nice functionality. Will test after rebase
Extract and refactor ui->addressType combo content filling into GUIUtil, having the translated descriptions in one place and allowing other Qt widget containers to easily create similar combo boxes with customizable tooltips per item and default selected item, both specified by the caller.
Current OutputTypeFromDestination at outputtype, returns OUTPUT_TYPE_STRING_LEGACY for Segwit addresses, as p2sh-segwit requires extra info from the wallet to figure that out, this change adds a correct way to obtain the desired result from the wallet interface. So far this will be needed from the UI to identify such type, as currently a user could select this output type to create an address (receivecoinsdialog) but no display of it exists.
Add new address type column to the addresstablemodel, use the getOutputType function from the wallet interface to display the correct address type in the new column content. Update the address book page to set the new column resize mode and to display the new column only when the receiving tab is enabled so it must be hidden on the sending tab. Update AddressBookFilterProxyModel::filterAcceptsRow so the filter works also on the new addressType column content. Also the searLineEdit greyed text reflects that the new field/ column addressType will be included in the search/ filter by but only when the receiving tab is enabled. Add the new column to the export feature.
Extend AddressBookFilterProxyModel to allow using nested filters to be applied on top of it. If future needs arise for similar filters outside the address book page, the code could be easily refactored and moved in a new subclass of QSortFilterProxyModel, perhaps with limits on nested levels. For safety and performance reasons, the code of the filter proxy model class declaration (in addressbookpage.h) and its instance creation were updated by aligning it with TransactionFilterProxy in overviewpage.h as this addresses situations of unexpected crashes, such as segfault on closing the app, double free or corruption, or stack smashing detection.
4b00cdc
to
dee0b3d
Compare
Rebased. |
dee0b3d
to
6eb2511
Compare
6eb2511
to
4ce72d6
Compare
Introduce a label and a combobox UI widgets for address type filtering on the address book page. These 2 widgets are been displayed only on the Receiving tab. To ensure that the combo box selection updates the filter model correctly, an intermediary signal (addressTypeChanged) and a slot (handleAddressTypeChanged) were necessary due to the incompatibility between QComboBox::currentIndexChanged and QSortFilterProxyModel::setFilterFixedString. Update filter model to use nested filtering so when selected item changes on address type combo it will update the filter pattern on top of what the parent filter has already, which is lead by the searchLineEdit widget and all references of the current proxyModel (eg mapToSource, mapFromSource) to the nested and final filter model. Use GUIUtil::AddItemsToAddressTypeCombo to populate the combo with the default output types descriptions passing a defined local map for the output types tooltips that will be displayed for each item, similarly to the address types combobox in receivecoinsdialog.
4ce72d6
to
dffc37f
Compare
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.
cr ACK and tested ACK
@luke-jr would you be interested on looking at this if you have some time? |
I don't know how useful this is. Why would users care to see only a certain type, or to see what type addresses are like this? |
Well, since QT offers to the user the feature to create certain types, it'd make sense to list them properly identifying the original intention. Personally, I'd add the column on the "Requested payments history" as well (or making it optional, adding previously a feature to show/ hide columns, feature that could be more useful on the Peers table).It'd have been good to discuss it on the issue #646 itself, which has been moved from the core repo, perhaps I should've asked before working on it. However, given that it's already developed, I don't think it would hurt to merge it once it gets approved accordingly, of course. |
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.
Concept ACK
Nice solution adding the AddressType column
and the filter
by AddressType
ui->tableView->sortByColumn(0, Qt::AscendingOrder); | ||
|
||
// Set column widths | ||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch); | ||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::ResizeToContents); |
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.
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.
Good point, this is something that could be subject for discussion, I'm open to any suggestions. Originally, as for this change, I decided to change the resize mode from Stretch
to ResizeToContents
as it looked tighter to me (resize mode enum - qt doc ref). I was thinking to make a bit of a mix of both of them, Stretch
for some columns and ResizeToContents
to others (e.g. check here), but I see there are other devs that also calculate the size of certain columns (in the latest link they also mentioned the property setStretchLastSection
, which extends the size of the last column to cover the rest of the table so there's no gap as you see in your 2nd screenshot, and I played a bit with but I finally discarded it cos there was an unexpected behaviour that can't remember now). We could also allow users resize each column as their preference and save them in the settings (I think this is done on the "Peers" table).
Please let me know your opinion on this or if you have any suggestions. Thanks!
🐙 This pull request conflicts with the target branch and needs rebase. |
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
This PR fixes #646 and introduces some enhancements to the Address Book functionality.
A new "Address Type" column has been added to the address book table page, only visible for the "Receiving address" tab. Users can employ an also new added combo box at the bottom of the page to filter address by their type, this filtering can be combined with the current search line text box.
When the export feature is used, this new field will be included.
As highlighted with the performed manual testing shown in the image above:
Tested in
mainnet
and all test networks.For code reviewers, please check the commit messages for a detailed breakdown.