#include <QScrollBar>
#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);
}
RPCConsole::RPCConsole(QWidget *parent) :
- QDialog(parent, DIALOGWINDOWHINTS),
+ QWidget(parent),
ui(new Ui::RPCConsole),
historyPtr(0)
{
#ifndef Q_OS_MAC
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
+ ui->openConfigurationfileButton->setIcon(QIcon(":/icons/export"));
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
#endif
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
- // set OpenSSL version label
+ // set library version labels
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
+ ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0));
startExecutor();
setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS);
}
}
}
- return QDialog::eventFilter(obj, event);
+ return QWidget::eventFilter(obj, event);
}
void RPCConsole::setClientModel(ClientModel *model)
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());
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; } "
void RPCConsole::setNumConnections(int count)
{
- ui->numberOfConnections->setText(QString::number(count));
+ if (!clientModel)
+ return;
+
+ QString connections = QString::number(count) + " (";
+ connections += tr("Inbound:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / ";
+ connections += tr("Outbound:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")";
+
+ ui->numberOfConnections->setText(connections);
}
void RPCConsole::setNumBlocks(int count, int countOfPeers)
{
message(CMD_REQUEST, cmd);
emit cmdRequest(cmd);
- // Truncate history from current position
- history.erase(history.begin() + historyPtr, history.end());
+ // Remove command, if already in history
+ history.removeOne(cmd);
// Append command to history
history.append(cmd);
// Enforce maximum history size
GUIUtil::openDebugLogfile();
}
+void RPCConsole::on_openConfigurationfileButton_clicked()
+{
+ GUIUtil::openConfigfile();
+}
+
void RPCConsole::scrollToEnd()
{
QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar();
if (!clientModel)
return;
}
+
+void RPCConsole::keyPressEvent(QKeyEvent *event)
+{
+#ifdef ANDROID
+ if(windowType() != Qt::Widget && event->key() == Qt::Key_Back)
+ {
+ close();
+ }
+#else
+ if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
+ {
+ close();
+ }
+#endif
+}