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
name renew Qt GUI #376
name renew Qt GUI #376
Conversation
@domob1812 I'm getting a I suspect that I'm creating the |
@JeremyRand You need to set that reference to an instance of Most likely you are right and something should be readily available already somewhere, but I'm not 100% sure where. I guess you could look through the RPC handling code to find the place where normal RPC methods get it set. |
Okay, thanks @domob1812 . I'll see if I can trace where that's being stored. |
@domob1812 I figured it out. Constructing a |
e5fffd0
to
cce3dc4
Compare
Ready for review. Note that this PR includes a copy of #353 ; this PR should not be merged until #353 is merged and this PR is then rebased on top of @randy-waterhouse You may be interested in reviewing this. Note that this PR only makes the Renew functionality accessible via the context menu; the button isn't added yet (that'll be in a subsequent PR). Also note that this PR supports renewing multiple names simultaneously; just select multiple names before you right-click. |
cce3dc4
to
66c171d
Compare
I've tested now and the crash on opening old wallet is fixed. I renewed a name with it and appears to work correctly. I think functionality is mostly there. Things that need polishing:
|
66c171d
to
a5f5ced
Compare
0543958
to
baa62b2
Compare
I fixed a minor bug in which the "Copy Name" and "Copy Value" context menu actions were still available when multiple names were selected (activating the action in this case would result in a randomly chosen name's data being copied); now those actions are disabled unless exactly one name is selected. Also rebased now that #353 is merged. @domob1812 AFAICT this is ready to consider for merging. Can you review this? |
@domob1812 Any chance you could review this soon? I now have 2 other name management GUI PR's that are queued behind this PR; I'd prefer not to have the queue get any longer. |
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.
Looks good, just a few minor things.
src/qt/managenamespage.cpp
Outdated
QModelIndexList indexes = GUIUtil::getEntryData(ui->tableView, NameTableModel::Name); | ||
|
||
bool singleNameSelected = indexes.size() == 1; | ||
bool anyNamesSelected = indexes.size() >= 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.
Nit: These two can be marked const
.
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 catch, will fix these shortly.
src/qt/managenamespage.cpp
Outdated
if (!ctx.isValid ()) | ||
return; | ||
|
||
for (QModelIndexList::iterator i = indexes.begin(); i != indexes.end(); i++) |
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.
Out of curiosity: Is it possible to use a C++11 "for each" loop here (I don't konw the details of QModelIndexList
)?
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 catch. I just ran grep -r QModelIndex ./src/qt | grep for
, and the existing three cases from upstream all use a for each loop. I'll adjust this code to match upstream style.
src/qt/nametablemodel.cpp
Outdated
res = walletModel->node().executeRpc("name_update", params, walletURI); | ||
} | ||
catch (const UniValue& e) { | ||
UniValue message = find_value( e, "message"); |
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: The whitespace is a bit messed up here (in particular the space between (
and e
).
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.
This style is copied from elsewhere in this file. I agree it should be fixed. Should I fix the rest of this file as part of this PR (in a separate commit) while we're thinking of it, or should I do that as a separate PR?
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.
Really? I thought this was just a typo. I think just fixing the style here is fine for now.
5ef3a7d
to
3b349ee
Compare
@domob1812 Fixes added as separate commits to make review easier; let me know when this passes review and I'll squash before you merge it. |
Thanks for the fixes, ACK 3b349ee. When you squash them together, I will merge it. |
Fixes namecoin#377 Based on namecoin#187 by Brandon Roberts.
3b349ee
to
e3506f4
Compare
@domob1812 Squashed. |
Thanks, merged. |
Port of the name renew Qt GUI to master branch.
Fixes #377 .