-
Notifications
You must be signed in to change notification settings - Fork 92
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
Added clearer error messages for the nRequest amount validation #609
Added clearer error messages for the nRequest amount validation #609
Conversation
if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) { | ||
str = "Requested amount %1 is more than avaible coins in the proposal (%2)\n"; | ||
} | ||
msgBox.setText(tr(str.c_str()).arg(NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount), NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true)))); |
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.
tr() should receive a string as an argument so the parser can correctly extract the text iirc.
std::string str = tr("Requested amount must be greater than 0 NAV (Zero)");
if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) {
str = tr("Requested amount %1 is more than avaible coins in the proposal (%2)");
}
msgBox.setText(str.arg(NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount), NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true))));
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.
@aguycalled you mean the tr()
call needs to have the string passed inline? and not via variable?
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.
yep iirc
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.
Like this:
QString str = tr("Requested amount must be greater than 0 NAV (Zero)\n");
if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) {
str = tr("Requested amount %1 is more than avaible coins in the proposal (%2)\n")
.arg(
NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount),
NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true))
);
}
msgBox.setText(str);
41c5257
to
9d35495
Compare
…st-errors Conflicts: src/qt/communityfundcreatepaymentrequestdialog.cpp
Fixed merge conflict |
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.
Lets merge this after 4.7.1 release |
str = "Requested amount %1 is more than avaible coins in the proposal (%2)\n"; |
good catch but isn't it actually "available" ? |
…oin#609) * Added clearer error messages for the nRequest amount validation * Added fix for tr calls
No description provided.