-
Notifications
You must be signed in to change notification settings - Fork 287
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
refactor: Make paths to update Encryption and HD wallet statuses simpler #403
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7d0d4c0
qt: Add WalletFrame::currentWalletSet signal
hebasto 37dcf16
qt, refactor: Emit WalletView::encryptionStatusChanged signal directly
hebasto fcdc8b0
qt, refactor: Drop redundant signalling in WalletView::setWalletModel
hebasto b8aa84b
qt, refactor: Replace `if` check with `assert`
hebasto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,8 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model) | |
walletView->updateGeometry(); | ||
|
||
walletStack->setCurrentWidget(walletView); | ||
walletView->updateEncryptionStatus(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In commit "qt: Add WalletFrame::currentWalletSet signal" (c0f84d9) Note: At was unclear to me at first if this commit was changing behavior. But it does not seem to change anything since the previous |
||
|
||
Q_EMIT currentWalletSet(); | ||
} | ||
|
||
void WalletFrame::removeWallet(WalletModel* wallet_model) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we really need to wrap that call with lambda? I see that
updateWalletStatus
is already a slot, or am I missing something?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.
UPDATED: #403 (comment)
No, we don't.The small benefit is that my editor could easy find this call site ofupdateWalletStatus()
function member. It fails to find it by pointer&BitcoinGUI::updateWalletStatus
.Are there any drawbacks of such an approach?
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.
The drawback is writing more verbose / unnecessary code, for no reason other than to appease your editor. If it's been questioned during review, it's just as likely someone will open a PR to remove it later on, citing the same reasoning, that, it's confusing / unnecessary. We really shouldn't be bloating our codebase just because your editor doesn't work.
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 strictly prefer
QObject::connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
overload overQObject::connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
one for the following reasons:[this] { updateWalletStatus(); }
vsthis, &BitcoinGUI::updateWalletStatus
Absolutely agree. But this is not that case, no?
Btw, this--very helpful--syntax is already actively used in the code base. E.g. bitcoin/bitcoin#14123 and other prs by @promag.
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 providing the actual reasoning; this should have been the first comment. I don't really have an opinion on the code, but was always going to leave the response above, regardless of the change, because the justification "it's better for my editor", is not a good one.
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 apologize for that.
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.
No worries. No need for an apology. Feel free to mark as resolved and merge etc.
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 simply looks like unnecessary indirection, and at least raises question "why?" for some random future code reader.
Also, "verbosiness" of
[this] { updateWalletStatus(); }
vsthis, &BitcoinGUI::updateWalletStatus
is, IMHO, debatable. Former has more of[]{();}
vs$::
"eye-piercing" stuff . But that's probably just personal preference :) .I like argument that we explicitly see (absence of) arguments, though I would expect lambda usage for actually more complex invocation where you do have to fiddle with arguments, etc.
Anyway, not gonna resist too much, would still give ACK.