-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Add autocomplete to bitcoin-qt's console window. #7613
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
Conversation
Concept ACK. |
Nice! |
Concept ACK. Nice! The build without wallet failed - see https://travis-ci.org/bitcoin/bitcoin/jobs/112189472#L1844
|
@@ -274,6 +277,19 @@ RPCConsole::RPCConsole(const PlatformStyle *platformStyle, QWidget *parent) : | |||
connect(ui->fontSmallerButton, SIGNAL(clicked()), this, SLOT(fontSmaller())); | |||
connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear())); | |||
|
|||
//Setup autocomplete and attach it | |||
QStringList wordList; | |||
for (int i =0; i < 53; ++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.
Any reason why we are not using std::array
?
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 need to build the 53
dynamic by something like ARRAYLEN(vRPCCommands).
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.
@MarcoFalke That would require C++11 which i believe at this point is not supported yet in the codebase.
@jonasschnelli Apparently this is much trickier than it would seem to be. Straightforward way would be to use vector but would be kind of redundant for a const array. Will see what i can do about it.
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.
@GamerSg Right, somehow forgot we are still waiting on travis to get c++11 rolled out.
You could take a look at src/utilstrencodings.h
which has a #define ARRAYLEN(array)
.
Concept ACK, nice idea. |
bool fDisableWallet = GetBoolArg("-disablewallet", false); | ||
if(!fDisableWallet) | ||
{//Only add commands if wallet is not disabled | ||
for (int i =0; i < 43; ++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.
You need to build the 43
dynamic by something like ARRAYLEN(vWalletRPCCommands)
.
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.
@GamerSg Are you still working on this? I'd like to see this merged :)
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.
Yes. I also think this is a nice improvement. We just need to remove the magic numbers.
Just tell me or Marco if on of us should continue this (without losing you commit/author name).
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.
ARRAYLEN
will not work for an external array, the information is not available at compile time. Please see my suggestion below to add a call to TableRPC
.
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.
@MarcoFalke Sorry, been busy past few days. I'll iron out any remaining issues over the weekend.
As @laanwj said, sizeof(array) does not work either, because the data is in a seperate cpp file and unavailable at compile time to other compilation units.
#ifdef ENABLE_WALLET | ||
bool fDisableWallet = GetBoolArg("-disablewallet", false); | ||
if(!fDisableWallet) | ||
{//Only add commands if wallet is not disabled |
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 need for this comment. Also you don't have to parse the arg. Maybe try just if (pwalletMain)
?
Concept ACK |
Looks good to me now! |
Sweet, utACK after style nits for (size_t i =0; i < commandList.size(); ++i)
{
wordList<<commandList[i].c_str();
}
autoCompleter = new QCompleter(wordList,this); |
Currently, the wallet RPC commands are missing. |
@jonasschnelli good catch! |
Hi all, i just find time during the weekends to work on this, so ill fix up the remaining issues tomorrow. |
Removed externs Added listCommands() to CRPCTable Move autocomplete init to RPCConsole::setClientModel()
Moved the initialisation to setClientModel() as @jonasschnelli suggested. |
Looks like this works just fine, now. ACK ce7413f: |
Works OK. Please fix the indentation of "}" in |
Tested ACK ce7413f |
ce7413f Add autocomplete to bitcoin-qt's console window. (Luv Khemani)
ce7413f Add autocomplete to bitcoin-qt's console window. (Luv Khemani)
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR #8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - #7613 - #7772 - #8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
Backport Boost removal PRs Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7613 - bitcoin/bitcoin#10502 - bitcoin/bitcoin#10193 - bitcoin/bitcoin#13961 - bitcoin/bitcoin#13734 - Only the second commit (we don't need the first). - bitcoin/bitcoin#14480 Part of #4819.
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
081cc02 Fix QCompleter popup regression (Hennadii Stepanov) Pull request description: The PR bitcoin#8129 has introduced a regression with the `QCompleter` popup in the Debug window. How to reproduce: 1. open the Debug window; 2. go to the 'Console' tab; 3. start writing some RPC command and try to pick it from the list using arrow keys, press Enter. Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup. The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10. This PR fixes this regression. Refs: - bitcoin#7613 - bitcoin#7772 - bitcoin#8129 Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
Would have preferred if the command arrays were in a vector, would have prevented hardcoding of array sizes in for loop. I will probably do that in another pull request.