diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h index 23b9f963f..06f097cbb 100644 --- a/samples/blackgui/mainwindow.h +++ b/samples/blackgui/mainwindow.h @@ -130,6 +130,7 @@ private: QPixmap m_resPixmapVoiceMuted; QPoint m_dragPosition; /*!< position, if moving is handled with frameless window */ QMenu *m_contextMenuAudio; /*! Audio context menu */ + QString m_transponderResetValue; /*! Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas */ /*! * \brief GUI status update @@ -421,14 +422,9 @@ private slots: void audioDeviceSelected(int index); /*! - * \brief Reset transponder to standby + * \brief Reset transponder to Standby / Charly */ - void resetTransponderModerToStandby(); - - /*! - * \brief Reset transponder to Charly - */ - void resetTransponderModerToCharly(); + void resetTransponderMode(); /*! * \brief Override voice room (allows to set an arbitrary voice room for testing purposes) diff --git a/samples/blackgui/mainwindow_cockpit.cpp b/samples/blackgui/mainwindow_cockpit.cpp index 0e41eb04a..c82812a22 100644 --- a/samples/blackgui/mainwindow_cockpit.cpp +++ b/samples/blackgui/mainwindow_cockpit.cpp @@ -40,7 +40,16 @@ void MainWindow::cockpitValuesChanged() else if (sender == this->ui->pb_CockpitIdent) { // trigger the real button - this->ui->cb_CockpitTransponderMode->setCurrentText("I"); + if (this->ui->cb_CockpitTransponderMode->currentText() == "I") + { + this->ui->pb_CockpitIdent->setStyleSheet(""); + this->resetTransponderMode(); + } + else + { + this->ui->pb_CockpitIdent->setStyleSheet("background: red"); + this->ui->cb_CockpitTransponderMode->setCurrentText("I"); // trigger real button and whole process + } return; } @@ -138,19 +147,16 @@ void MainWindow::updateCockpitFromContext() } /* - * Reset transponder mode to Standby + * Reset transponder mode to Standby / Charly */ -void MainWindow::resetTransponderModerToStandby() +void MainWindow::resetTransponderMode() { - this->ui->cb_CockpitTransponderMode->setCurrentText("S"); -} - -/* - * Reset transponder mode to Standby - */ -void MainWindow::resetTransponderModerToCharly() -{ - this->ui->cb_CockpitTransponderMode->setCurrentText("C"); + this->ui->pb_CockpitIdent->setStyleSheet(""); + if (this->ui->cb_CockpitTransponderMode->currentText() == "I") + { + // only reset if still "I" + this->ui->cb_CockpitTransponderMode->setCurrentText(this->m_transponderResetValue); + } } /* @@ -185,10 +191,16 @@ void MainWindow::sendCockpitUpdates() { // ident shall be sent for some time, then reset transponder.setTransponderMode(CTransponder::StateIdent); + this->ui->pb_CockpitIdent->setStyleSheet("background: red"); if (this->m_ownAircraft.getTransponderMode() == CTransponder::ModeS) - QTimer::singleShot(5000, this, SLOT(resetTransponderModerToStandby())); + { + this->m_transponderResetValue = "S"; + } else - QTimer::singleShot(5000, this, SLOT(resetTransponderModerToCharly())); + { + this->m_transponderResetValue = "C"; + } + QTimer::singleShot(5000, this, SLOT(resetTransponderMode())); } // @@ -199,7 +211,6 @@ void MainWindow::sendCockpitUpdates() com2.setFrequencyActiveMHz(this->ui->ds_CockpitCom2Active->value()); com2.setFrequencyStandbyMHz(this->ui->ds_CockpitCom2Standby->value()); - // // Send to context //