закрытие консоли по кнопке "Назад" для Android
[novacoin.git] / src / qt / rpcconsole.cpp
index 95a45b3..21b16fd 100644 (file)
@@ -345,7 +345,14 @@ void RPCConsole::message(int category, const QString &message, bool html)
 
 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)
@@ -369,8 +376,8 @@ void RPCConsole::on_lineEdit_returnPressed()
     {
         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
@@ -499,8 +506,15 @@ void RPCConsole::hideEvent(QHideEvent *event)
 
 void RPCConsole::keyPressEvent(QKeyEvent *event)
 {
+#ifdef ANDROID
+    if(windowType() != Qt::Widget && event->key() == event->key() == Qt::Key_Back)
+    {
+        close();
+    }
+#else
     if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
     {
         close();
     }
-}
\ No newline at end of file
+#endif
+}