diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp
index 09e43d21e..e936cf7b4 100644
--- a/src/blackgui/components/mainkeypadareacomponent.cpp
+++ b/src/blackgui/components/mainkeypadareacomponent.cpp
@@ -31,7 +31,6 @@ namespace BlackGui
{
namespace Components
{
-
CMainKeypadAreaComponent::CMainKeypadAreaComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CMainKeypadAreaComponent)
@@ -62,7 +61,7 @@ namespace BlackGui
connect(ui->pb_SoundMute, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected);
// command line
- this->connect(ui->le_CommandLineInput, &QLineEdit::returnPressed, this, &CMainKeypadAreaComponent::ps_commandEntered);
+ this->connect(ui->lep_CommandLineInput, &QLineEdit::returnPressed, this, &CMainKeypadAreaComponent::ps_commandEntered);
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::ps_connectionStatusChanged);
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged);
@@ -154,10 +153,9 @@ namespace BlackGui
void CMainKeypadAreaComponent::ps_commandEntered()
{
- QString c(ui->le_CommandLineInput->text().trimmed().simplified());
+ QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
if (c.isEmpty()) { return; }
emit this->commandEntered(c, keypadIdentifier());
- ui->le_CommandLineInput->clear();
}
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
diff --git a/src/blackgui/components/mainkeypadareacomponent.ui b/src/blackgui/components/mainkeypadareacomponent.ui
index aebb3c13c..457d27eb3 100644
--- a/src/blackgui/components/mainkeypadareacomponent.ui
+++ b/src/blackgui/components/mainkeypadareacomponent.ui
@@ -7,7 +7,7 @@
0
0
410
- 120
+ 122
@@ -62,13 +62,143 @@
2
- -
-
-
- command line (e.g. ".com1", ".x", ".msg com1")
+
-
+
+
+ false
-
- .dot commands or text message
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Flightplan
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Log
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Rendering
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Cockpit
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Text/Chat
+
+
+ true
@@ -138,8 +268,20 @@
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 62
+ 22
+
+
16777215
@@ -147,26 +289,7 @@
- Users
-
-
- true
-
-
-
- -
-
-
-
- 16777215
- 16777215
-
-
-
- Simulator
-
-
- true
+ 100%
@@ -192,20 +315,8 @@
- -
-
-
-
- 0
- 0
-
-
-
-
- 62
- 22
-
-
+
-
+
16777215
@@ -213,7 +324,42 @@
- 100%
+ Simulator
+
+
+ true
+
+
+
+ -
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Users
+
+
+ true
+
+
+
+ -
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Ident
+
+
+ true
@@ -274,66 +420,6 @@
- -
-
-
-
- 16777215
- 16777215
-
-
-
- Ident
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Text/Chat
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Cockpit
-
-
- true
-
-
-
-
@@ -359,99 +445,19 @@
- -
-
-
-
- 0
- 0
-
-
-
+
-
+
+
- 16777215
- 16777215
+ 0
+ 24
-
- Log
+
+ command line (e.g. ".com1", ".x", ".msg com1")
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Flightplan
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Rendering
-
-
- true
-
-
-
- -
-
-
- false
-
-
-
-
-
-
- -
-
-
- false
-
-
-
-
-
-
- -
-
-
- false
-
-
-
+
+ .dot commands or text message
@@ -460,8 +466,15 @@
+
+
+ BlackGui::CLineEditHistory
+ QLineEdit
+ blackgui/lineedithistory.h
+
+
- le_CommandLineInput
+ lep_CommandLineInput
pb_Connect
pb_MainAircrafts
pb_MainAtc
diff --git a/src/blackgui/lineedithistory.cpp b/src/blackgui/lineedithistory.cpp
new file mode 100644
index 000000000..1a725c9cf
--- /dev/null
+++ b/src/blackgui/lineedithistory.cpp
@@ -0,0 +1,58 @@
+/* Copyright (C) 2017
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "lineedithistory.h"
+#include
+
+namespace BlackGui
+{
+ QString CLineEditHistory::getLastEnteredLine() const
+ {
+ if (m_history.isEmpty()) return {};
+ return m_history.first();
+ }
+
+ QString CLineEditHistory::getLastEnteredLineFormatted() const
+ {
+ return getLastEnteredLine().trimmed().simplified();
+ }
+
+ void CLineEditHistory::keyPressEvent(QKeyEvent *event)
+ {
+ if (event->key() == Qt::Key_Up)
+ {
+ // move back in history
+ if (m_history.size() > m_position)
+ {
+ setText(m_history.at(m_position++));
+ }
+ }
+ else if (event->key() == Qt::Key_Down)
+ {
+ // move forward in history
+ if (m_position <= 0) { clear(); return; }
+ if (m_position == m_history.size()) { --m_position; } // avoid need of 2xKeyDown at end
+ if (m_position > 0 && m_history.size() > --m_position)
+ {
+ setText(m_history.at(m_position));
+ }
+ }
+ else if (event->key() == Qt::Key_Return)
+ {
+ if (!text().isEmpty())
+ {
+ m_history.push_front(text());
+ m_position = 0;
+ clear();
+ }
+ }
+ // default handler for event
+ QLineEdit::keyPressEvent(event);
+ }
+} // ns
diff --git a/src/blackgui/lineedithistory.h b/src/blackgui/lineedithistory.h
new file mode 100644
index 000000000..3ffd37c60
--- /dev/null
+++ b/src/blackgui/lineedithistory.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2017
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_LINEEDITHISTORY_H
+#define BLACKGUI_LINEEDITHISTORY_H
+
+#include
+#include
+
+namespace BlackGui
+{
+ /*!
+ * Line edit with history
+ */
+ class CLineEditHistory : public QLineEdit
+ {
+ public:
+ //! Constructors
+ using QLineEdit::QLineEdit;
+
+ //! Get the last entered line
+ QString getLastEnteredLine() const;
+
+ //! Get the last entered line but simplified and trimmed
+ QString getLastEnteredLineFormatted() const;
+
+ protected:
+ //! \copydoc QLineEdit::keyPressEvent
+ virtual void keyPressEvent(QKeyEvent *event) override;
+
+ private:
+ QStringList m_history;
+ int m_position = 0;
+ };
+} // ns
+#endif // guard
diff --git a/src/blackgui/share/qss/stdwidget.qss b/src/blackgui/share/qss/stdwidget.qss
index 3c73fdefe..af16f4187 100644
--- a/src/blackgui/share/qss/stdwidget.qss
+++ b/src/blackgui/share/qss/stdwidget.qss
@@ -240,7 +240,7 @@ QLabel {
}
QLineEdit {
- background: transparent;
+ background: black;
border: 1px solid green;
border-radius: 5px;
}