diff --git a/samples/blackgui/mainwindow.cpp b/samples/blackgui/mainwindow.cpp
index e0b499f82..a5c78d7ff 100644
--- a/samples/blackgui/mainwindow.cpp
+++ b/samples/blackgui/mainwindow.cpp
@@ -39,6 +39,8 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
m_timerStatusBar(nullptr), m_timerAudioTests(nullptr),
// context menus
m_contextMenuAudio(nullptr), m_contextMenuStatusMessageList(nullptr),
+ // cockpit
+ m_inputFocusedWidget(nullptr),
// status bar
m_statusBarIcon(nullptr), m_statusBarLabel(nullptr)
{
diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h
index 318703963..df48af20e 100644
--- a/samples/blackgui/mainwindow.h
+++ b/samples/blackgui/mainwindow.h
@@ -157,6 +157,7 @@ private:
// cockpit
QString m_transponderResetValue; /*!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas */
+ QWidget *m_inputFocusedWidget; /*!< currently used widget for input, mainly used with cockpit */
// status bar
QLabel *m_statusBarIcon; /*!< status bar icon */
@@ -208,10 +209,8 @@ private:
*/
bool isCockpitUpdatePending() const;
- /*!
- * \brief Round the COM frequency display
- */
- void roundComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
+ //! \brief Update the COM frequency displays
+ void updateComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
/*!
* \brief Add new text message tab
@@ -360,14 +359,10 @@ private slots:
*/
void appendTextMessagesToGui(const BlackMisc::Network::CTextMessageList &messages, bool sending = false);
- /*!
- * \brief Reload settings
- */
+ //!\brief Reload settings
void reloadSettings();
- /*!
- * \brief Send cockpit updates
- */
+ //! \brief Send cockpit updates
void sendCockpitUpdates();
//
@@ -500,6 +495,11 @@ private slots:
//! \brief start the MIC tests (Squelch)
void startAudioTest();
+
+ //! \brief inputFocusChanged
+ //! \sa QApplication::focusChanged
+ void inputFocusChanged(QWidget *oldWidget, QWidget *newWidget);
+
};
#pragma pop_macro("interface")
diff --git a/samples/blackgui/mainwindow.ui b/samples/blackgui/mainwindow.ui
index dbc89fec1..ff6d50945 100644
--- a/samples/blackgui/mainwindow.ui
+++ b/samples/blackgui/mainwindow.ui
@@ -454,7 +454,7 @@ QStatusBar QLabel {
QFrame::NoFrame
- 7
+ 0
@@ -564,8 +564,8 @@ QStatusBar QLabel {
0
0
- 86
- 59
+ 326
+ 267
@@ -607,8 +607,8 @@ QStatusBar QLabel {
0
0
- 90
- 55
+ 326
+ 267
@@ -2842,6 +2842,7 @@ QStatusBar QLabel {
cb_StatusWithDBus
le_StatusNetworkContext
le_StatusVoiceContext
+ tv_StatusMessages
le_CommandLineInput
tw_AtcStations
tv_AtcStationsOnline
@@ -2852,6 +2853,7 @@ QStatusBar QLabel {
tv_AtcStationsBooked
pb_ReloadAtcStationsBooked
tv_AircraftsInRange
+ tv_AllUsers
pb_CockpitToggleCom1
ds_CockpitCom1Active
ds_CockpitCom1Standby
@@ -2913,6 +2915,14 @@ QStatusBar QLabel {
pb_MainKeypadOpacity050
pb_SoundMute
pb_SoundMaxVolume
+ te_StatusPageConsole
+ rb_SetttingsNormalLoginMode
+ rb_SettingsLoginStealthMode
+ rb_SettingsLoginObserver
+ pb_SettingsAudioSquelchTest
+ pb_SettingsAudioMicrophoneTest
+ pte_SettingsAudioTestActionAndResult
+ hs_SettingsGuiUserRefreshTime
diff --git a/samples/blackgui/mainwindow_cockpit.cpp b/samples/blackgui/mainwindow_cockpit.cpp
index 658d36b15..40c493317 100644
--- a/samples/blackgui/mainwindow_cockpit.cpp
+++ b/samples/blackgui/mainwindow_cockpit.cpp
@@ -81,10 +81,16 @@ void MainWindow::updateCockpitFromContext()
const CComSystem com2 = this->m_ownAircraft.getCom2System();
const CTransponder transponder = this->m_ownAircraft.getTransponder();
- this->roundComFrequencyDisplays(com1, com2);
- qint32 tc = transponder.getTransponderCode();
- if (tc != static_cast(this->ui->ds_CockpitTransponder->value()))
- this->ui->ds_CockpitTransponder->setValue(tc);
+ // update the frequencies
+ this->updateComFrequencyDisplays(com1, com2);
+
+ if (this->m_inputFocusedWidget != this->ui->ds_CockpitTransponder)
+ {
+ // update transponder if this is not input focused
+ qint32 tc = transponder.getTransponderCode();
+ if (tc != static_cast(this->ui->ds_CockpitTransponder->value()))
+ this->ui->ds_CockpitTransponder->setValue(tc);
+ }
QString tm = this->ui->cb_CockpitTransponderMode->currentText().trimmed().toUpper();
switch (transponder.getTransponderMode())
@@ -178,25 +184,38 @@ void MainWindow::updateCockpitFromContext()
/*
* Round the com frequency displays
*/
-void MainWindow::roundComFrequencyDisplays(const CComSystem &com1, const CComSystem &com2)
+void MainWindow::updateComFrequencyDisplays(const CComSystem &com1, const CComSystem &com2)
{
// do not just set! Leads to unwanted signals fired
- double freq = com1.getFrequencyActive().valueRounded(3);
- if (freq != this->ui->ds_CockpitCom1Active->value())
- this->ui->ds_CockpitCom1Active->setValue(freq);
+ // only update if not focused
- freq = com2.getFrequencyActive().valueRounded(3);
- if (freq != this->ui->ds_CockpitCom2Active->value())
- this->ui->ds_CockpitCom2Active->setValue(freq);
+ if (this->m_inputFocusedWidget != ui->ds_CockpitCom1Active)
+ {
+ double freq = com1.getFrequencyActive().valueRounded(3);
+ if (freq != this->ui->ds_CockpitCom1Active->value())
+ this->ui->ds_CockpitCom1Active->setValue(freq);
+ }
- freq = com1.getFrequencyStandby().valueRounded(3);
- if (freq != this->ui->ds_CockpitCom1Standby->value())
+ if (this->m_inputFocusedWidget != ui->ds_CockpitCom2Active)
+ {
+ double freq = com2.getFrequencyActive().valueRounded(3);
+ if (freq != this->ui->ds_CockpitCom2Active->value())
+ this->ui->ds_CockpitCom2Active->setValue(freq);
+ }
- this->ui->ds_CockpitCom1Standby->setValue(freq);
+ if (this->m_inputFocusedWidget != ui->ds_CockpitCom1Standby)
+ {
+ double freq = com1.getFrequencyStandby().valueRounded(3);
+ if (freq != this->ui->ds_CockpitCom1Standby->value())
+ this->ui->ds_CockpitCom1Standby->setValue(freq);
+ }
- freq = com2.getFrequencyStandby().valueRounded(3);
- if (freq != this->ui->ds_CockpitCom2Standby->value())
- this->ui->ds_CockpitCom2Standby->setValue(freq);
+ if (this->m_inputFocusedWidget != ui->ds_CockpitCom2Standby)
+ {
+ double freq = com2.getFrequencyStandby().valueRounded(3);
+ if (freq != this->ui->ds_CockpitCom2Standby->value())
+ this->ui->ds_CockpitCom2Standby->setValue(freq);
+ }
}
/*
@@ -263,7 +282,7 @@ void MainWindow::sendCockpitUpdates()
com1.setFrequencyStandbyMHz(this->ui->ds_CockpitCom1Standby->value());
com2.setFrequencyActiveMHz(this->ui->ds_CockpitCom2Active->value());
com2.setFrequencyStandbyMHz(this->ui->ds_CockpitCom2Standby->value());
- this->roundComFrequencyDisplays(com1, com2);
+ this->updateComFrequencyDisplays(com1, com2);
//
// Send to context
@@ -358,3 +377,12 @@ QString MainWindow::getSelcalCode() const
QString selcal = this->ui->cb_CockpitSelcal1->currentText().append(this->ui->cb_CockpitSelcal2->currentText());
return selcal;
}
+
+/*
+ * Current input focus
+ */
+void MainWindow::inputFocusChanged(QWidget *oldWidget, QWidget *newWidget)
+{
+ Q_UNUSED(oldWidget);
+ this->m_inputFocusedWidget = newWidget;
+}
diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp
index 3233b6a39..7975a35ee 100644
--- a/samples/blackgui/mainwindow_init.cpp
+++ b/samples/blackgui/mainwindow_init.cpp
@@ -299,6 +299,7 @@ void MainWindow::initGuiSignals()
this->connect(this->ui->pb_CockpitToggleCom2, &QPushButton::clicked, this, &MainWindow::cockpitValuesChanged);
this->connect(this->ui->pb_CockpitIdent, &QPushButton::clicked, this, &MainWindow::cockpitValuesChanged);
this->connect(this->ui->pb_CockpitSelcalTest, &QPushButton::clicked, this, &MainWindow::testSelcal);
+ this->connect(qApp, &QApplication::focusChanged, this, &MainWindow::inputFocusChanged);
// voice
connected = this->connect(this->ui->cb_SettingsAudioInputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(audioDeviceSelected(int)));