#include <QKeyEvent>
#include <QUrl>
#include <QScrollBar>
+#include <QStringList>
#include <openssl/crypto.h>
#include <db_cxx.h>
// TODO: make it possible to filter out categories (esp debug messages when implemented)
// TODO: receive errors and debug messages through ClientModel
-const int CONSOLE_SCROLLBACK = 50;
const int CONSOLE_HISTORY = 50;
const QSize ICON_SIZE(24, 24);
#ifndef Q_OS_MAC
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
+ ui->openConfigurationfileButton->setIcon(QIcon(":/icons/export"));
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
#endif
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->lineEdit->setFocus();
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
+ autoCompleter->popup()->hide();
return true;
}
}
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
- updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
+ updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
// Provide initial values
ui->clientVersion->setText(model->formatFullVersion());
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();
+ wordList << ("help " + commandList[i]).c_str();
+ }
+
+ wordList.sort();
+ autoCompleter = new QCompleter(wordList, this);
+ autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel);
+ // ui->lineEdit is initially disabled because running commands is only
+ // possible from now on.
+ ui->lineEdit->setEnabled(true);
+ ui->lineEdit->setCompleter(autoCompleter);
+ autoCompleter->popup()->installEventFilter(this);
}
}
void RPCConsole::clear()
{
ui->messagesWidget->clear();
+ history.clear();
+ historyPtr = 0;
ui->lineEdit->clear();
ui->lineEdit->setFocus();
ui->messagesWidget->document()->setDefaultStyleSheet(
"table { }"
"td.time { color: #808080; padding-top: 3px; } "
- "td.message { font-family: Monospace; font-size: 12px; } "
+ "td.message { font-family: Monospace; } "
"td.cmd-request { color: #006060; } "
"td.cmd-error { color: red; } "
"b { color: #006060; } "
GUIUtil::openDebugLogfile();
}
+void RPCConsole::on_openConfigurationfileButton_clicked()
+{
+ GUIUtil::openConfigfile();
+}
+
void RPCConsole::scrollToEnd()
{
QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar();