diff options
author | Luv Khemani <luvb@hotmail.com> | 2016-02-27 11:57:12 +0800 |
---|---|---|
committer | Luv Khemani <luvb@hotmail.com> | 2016-03-12 13:04:23 +0800 |
commit | ce7413fcb7d28bd72e5ade7dc9756504de766fc2 (patch) | |
tree | 0b5fe6bab7c5914b2efc729d86e0a458822c169d /src/qt | |
parent | 0fa88ef784dda77422fdb20b7358803f9b30a5c1 (diff) |
Add autocomplete to bitcoin-qt's console window.
Removed externs
Added listCommands() to CRPCTable
Move autocomplete init to RPCConsole::setClientModel()
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/rpcconsole.cpp | 15 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 4e2530ffab..e40d144645 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -36,6 +36,7 @@ #include <QThread> #include <QTime> #include <QTimer> +#include <QStringList> #if QT_VERSION < 0x050000 #include <QUrl> @@ -446,7 +447,19 @@ void RPCConsole::setClientModel(ClientModel *model) ui->buildDate->setText(model->formatBuildDate()); ui->startupTime->setText(model->formatClientStartupTime()); ui->networkName->setText(QString::fromStdString(Params().NetworkIDString())); - } + + //Setup autocomplete and attach it + QStringList wordList; + std::vector<std::string> commandList = tableRPC.listCommands(); + for (size_t i = 0; i < commandList.size(); ++i) + { + wordList << commandList[i].c_str(); + } + + autoCompleter = new QCompleter(wordList, this); + ui->lineEdit->setCompleter(autoCompleter); + + } } static QString categoryClass(int category) diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 648e32638f..ad10ec12aa 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -11,6 +11,7 @@ #include "net.h" #include <QWidget> +#include <QCompleter> class ClientModel; class PlatformStyle; @@ -138,6 +139,7 @@ private: QMenu *peersTableContextMenu; QMenu *banTableContextMenu; int consoleFontSize; + QCompleter *autoCompleter; }; #endif // BITCOIN_QT_RPCCONSOLE_H |