diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h index 7048f5863..b32619b04 100644 --- a/samples/blackgui/mainwindow.h +++ b/samples/blackgui/mainwindow.h @@ -276,6 +276,11 @@ private: */ void stopUpdateTimers(bool disconnect = false); + /*! + * \brief Currently selected SELCAL code + */ + QString getSelcalCode() const; + private slots: // @@ -470,6 +475,10 @@ private slots: */ void audioIconContextMenu(const QPoint &position); + /*! + * \brief Test SELCAL (code valid? play tone) + */ + void testSelcal(); }; #pragma pop_macro("interface") diff --git a/samples/blackgui/mainwindow_cockpit.cpp b/samples/blackgui/mainwindow_cockpit.cpp index b3d6ebca5..06b951efb 100644 --- a/samples/blackgui/mainwindow_cockpit.cpp +++ b/samples/blackgui/mainwindow_cockpit.cpp @@ -1,5 +1,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "blacksound/soundgenerator.h" #include "blackgui/atcstationlistmodel.h" #include "blackcore/dbus_server.h" #include "blackcore/context_network.h" @@ -15,6 +16,7 @@ using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; using namespace BlackMisc::Math; using namespace BlackMisc::Voice; +using namespace BlackSound; /* * Cockpit values @@ -304,3 +306,27 @@ void MainWindow::setAudioVoiceRooms() // set the real voice rooms for audio output this->m_contextVoice->setComVoiceRooms(room1, room2); } + +/* + * Test SELCAL code + */ +void MainWindow::testSelcal() +{ + QString selcal = this->getSelcalCode(); + if (!CSelcal::isValidCode(selcal)) + { + this->displayStatusMessage( + CStatusMessage(CStatusMessage::TypeValidation, CStatusMessage::SeverityWarning, "invalid SELCAL codde")); + return; + } + CSoundGenerator::playSelcal(90, CSelcal(selcal)); +} + +/* + * SELCAL value selected + */ +QString MainWindow::getSelcalCode() const +{ + QString selcal = this->ui->cb_CockpitSelcal1->currentText().append(this->ui->cb_CockpitSelcal2->currentText()); + return selcal; +} diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index b26c6498c..04836a2b9 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -1,9 +1,10 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include "blackgui/atcstationlistmodel.h" #include "blackcore/dbus_server.h" #include "blackcore/context_network.h" #include "blackcore/coreruntime.h" +#include "blackgui/atcstationlistmodel.h" +#include "blackmisc/avselcal.h" #include #include #include @@ -119,6 +120,10 @@ void MainWindow::init(GuiModes::CoreMode coreMode) this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents(); this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true); + // SELCAL pairs in cockpit + this->ui->cb_CockpitSelcal1->addItems(BlackMisc::Aviation::CSelcal::codePairs()); + this->ui->cb_CockpitSelcal2->addItems(BlackMisc::Aviation::CSelcal::codePairs()); + // timer if (this->m_timerUpdateAircraftsInRange == nullptr) this->m_timerUpdateAircraftsInRange = new QTimer(this); if (this->m_timerUpdateAtcStationsOnline == nullptr) this->m_timerUpdateAtcStationsOnline = new QTimer(this); @@ -265,6 +270,7 @@ void MainWindow::initGuiSignals() this->connect(this->ui->pb_CockpitToggleCom1, &QPushButton::clicked, this, &MainWindow::cockpitValuesChanged); 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); // voice connected = this->connect(this->ui->cb_VoiceInputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(audioDeviceSelected(int)));