}
}
+std::vector<std::string> CRPCTable::listCommands() const
+{
+ std::vector<std::string> commandList;
+ typedef std::map<std::string, const CRPCCommand*> commandMap;
+
+ std::transform( mapCommands.begin(), mapCommands.end(),
+ std::back_inserter(commandList),
+ boost::bind(&commandMap::value_type::first,_1) );
+ return commandList;
+}
Object CallRPC(const string& strMethod, const Array& params)
{
* @throws an exception (json_spirit::Value) when an error happens.
*/
json_spirit::Value execute(const std::string &method, const json_spirit::Array ¶ms) const;
+ /**
+ * Returns a list of registered commands
+ * @returns List of registered commands.
+ */
+ std::vector<std::string> listCommands() const;
};
extern const CRPCTable tableRPC;
#include <QKeyEvent>
#include <QUrl>
#include <QScrollBar>
+#include <QStringList>
#include <openssl/crypto.h>
#include <db_cxx.h>
return true;
}
break;
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ // forward these events to lineEdit
+ if(obj == autoCompleter->popup()) {
+ QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
+ return true;
+ }
+ break;
default:
// Typing in messages widget brings focus to line edit, and redirects key there
// Exclude most combinations and keys that emit no text, except paste shortcuts
ui->isTestNet->setChecked(model->isTestNet());
setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers());
+
+ //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);
+
+ // clear the lineEdit after activating from QCompleter
+ autoCompleter->popup()->installEventFilter(this);
}
}