SELCAL test (playing the SELCAL tone) and selection (from 2 code pairs).

This commit is contained in:
Klaus Basan
2014-01-28 00:57:01 +01:00
committed by Mathew Sutcliffe
parent 5619c29cb6
commit e877c5c368
3 changed files with 42 additions and 1 deletions

View File

@@ -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")

View File

@@ -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;
}

View File

@@ -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 <QSortFilterProxyModel>
#include <QSizeGrip>
#include <QHBoxLayout>
@@ -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)));