diff --git a/samples/blackgui/mainwindow.ui b/samples/blackgui/mainwindow.ui index 53d2cd127..dd1915125 100644 --- a/samples/blackgui/mainwindow.ui +++ b/samples/blackgui/mainwindow.ui @@ -167,6 +167,23 @@ QGroupBox { border: 1px solid green; } +QToolBox { + border: none; +} + +QToolBox::tab { + border: 1px solid green; + border-radius: 6px; + min-width: 30px; + padding: 2px; + padding-left: 4px; + padding-right: 4px; +} + +QToolBox::tab::selected { + background-color: rgba(0, 0, 255, 128); +} + QRadioButton { font: 10px; } @@ -414,7 +431,7 @@ QSizeGrip { QFrame::NoFrame - 4 + 0 @@ -425,7 +442,7 @@ QSizeGrip { - 2 + 4 2 @@ -512,19 +529,92 @@ QSizeGrip { - - - - 0 - 0 - + + + 0 - - QPlainTextEdit::NoWrap - - - true + + 3 + + + + 0 + 0 + 326 + 267 + + + + Messages + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + 0 + 0 + 90 + 55 + + + + Console + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QPlainTextEdit::NoWrap + + + true + + + + + @@ -1252,26 +1342,6 @@ QSizeGrip { 0 - - - AB - - - - - AC - - - - - AD - - - - - AE - - @@ -1282,21 +1352,6 @@ QSizeGrip { 0 - - - AB - - - - - AC - - - - - AD - - @@ -2004,7 +2059,7 @@ QSizeGrip { - + Voice @@ -2016,7 +2071,7 @@ QSizeGrip { 2 - + QFormLayout::AllNonFixedFieldsGrow @@ -2033,27 +2088,27 @@ QSizeGrip { 2 - + In - + - + Out - + - + Qt::Vertical @@ -2066,7 +2121,7 @@ QSizeGrip { - + Tests @@ -2713,7 +2768,6 @@ QSizeGrip { cb_StatusWithDBus le_StatusNetworkContext le_StatusVoiceContext - te_StatusMessages le_CommandLineInput tw_AtcStations tv_AtcStationsOnline @@ -2764,8 +2818,8 @@ QSizeGrip { le_SettingsIcaoTypeDesignator le_SettingsIcaoAirline le_SettingsIcaoType - cb_VoiceInputDevice - cb_VoiceOutputDevice + cb_SettingsAudioInputDevice + cb_SettingsAudioOutputDevice pb_VoiceStartMicTest pb_VoiceStartSquelchTest hs_SettingsGuiOpacity diff --git a/samples/blackgui/mainwindow_cockpit.cpp b/samples/blackgui/mainwindow_cockpit.cpp index 06b951efb..5f64d960f 100644 --- a/samples/blackgui/mainwindow_cockpit.cpp +++ b/samples/blackgui/mainwindow_cockpit.cpp @@ -1,6 +1,5 @@ #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" @@ -16,7 +15,6 @@ using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; using namespace BlackMisc::Math; using namespace BlackMisc::Voice; -using namespace BlackSound; /* * Cockpit values @@ -153,6 +151,10 @@ void MainWindow::updateCockpitFromContext() this->ui->le_CockpitVoiceRoomCom2->setText(s); } } + + // update some other GUI elements + this->ui->tw_TextMessages->setTabToolTip(this->ui->tw_TextMessages->indexOf(this->ui->tb_TextMessagesCOM1), com1.getFrequencyActive().valueRoundedWithUnit(3)); + this->ui->tw_TextMessages->setTabToolTip(this->ui->tw_TextMessages->indexOf(this->ui->tb_TextMessagesCOM2), com2.getFrequencyActive().valueRoundedWithUnit(3)); } /* @@ -312,14 +314,22 @@ void MainWindow::setAudioVoiceRooms() */ void MainWindow::testSelcal() { - QString selcal = this->getSelcalCode(); - if (!CSelcal::isValidCode(selcal)) + QString selcalCode = this->getSelcalCode(); + if (!CSelcal::isValidCode(selcalCode)) { this->displayStatusMessage( CStatusMessage(CStatusMessage::TypeValidation, CStatusMessage::SeverityWarning, "invalid SELCAL codde")); return; } - CSoundGenerator::playSelcal(90, CSelcal(selcal)); + if (this->m_contextVoiceAvailable) + { + CSelcal selcal(selcalCode); + this->m_contextVoice->playSelcalTone(selcal); + } + else + { + this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeAudio, CStatusMessage::SeverityError, "No audi available")); + } } /* diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index 04836a2b9..99acebcc6 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -121,6 +121,8 @@ void MainWindow::init(GuiModes::CoreMode coreMode) this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true); // SELCAL pairs in cockpit + this->ui->cb_CockpitSelcal1->clear(); + this->ui->cb_CockpitSelcal2->clear(); this->ui->cb_CockpitSelcal1->addItems(BlackMisc::Aviation::CSelcal::codePairs()); this->ui->cb_CockpitSelcal2->addItems(BlackMisc::Aviation::CSelcal::codePairs()); @@ -273,9 +275,9 @@ void MainWindow::initGuiSignals() 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))); + connected = this->connect(this->ui->cb_SettingsAudioInputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(audioDeviceSelected(int))); Q_ASSERT(connected); - connected = this->connect(this->ui->cb_VoiceOutputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(audioDeviceSelected(int))); + connected = this->connect(this->ui->cb_SettingsAudioOutputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(audioDeviceSelected(int))); Q_ASSERT(connected); // ATC diff --git a/samples/blackgui/mainwindow_textmessages.cpp b/samples/blackgui/mainwindow_textmessages.cpp index c85140a7c..b6b658860 100644 --- a/samples/blackgui/mainwindow_textmessages.cpp +++ b/samples/blackgui/mainwindow_textmessages.cpp @@ -1,5 +1,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "blacksound/soundgenerator.h" using namespace BlackCore; using namespace BlackMisc; @@ -9,6 +10,7 @@ using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; +using namespace BlackMisc::Voice; /* * Text messages received or send, append to GUI @@ -18,6 +20,25 @@ void MainWindow::appendTextMessagesToGui(const CTextMessageList &messages, bool if (messages.isEmpty()) return; foreach(CTextMessage message, messages) { + const QString currentSelcal = this->getSelcalCode(); + if (CSelcal::isValidCode(currentSelcal) && message.isSelcalMessageFor(currentSelcal)) + { + if (this->m_ownAircraft.isActiveFrequencyWithin25kHzChannel(message.getFrequency())) + { + // this is SELCAL for me + if (this->m_contextVoiceAvailable) + { + CAudioDevice dev = this->m_contextVoice->getCurrentAudioDevices().getOutputDevices()[0]; + BlackSound::CSoundGenerator::playSelcal(90, CSelcal(currentSelcal), dev); + } + else + { + this->displayOverlayInfo("SELCAL received"); + } + } + continue; // not displayed + } + bool relevantForMe = false; QString m = message.asString(true, true, "\t"); m = message.asString(true, false, "\t"); @@ -93,7 +114,6 @@ bool MainWindow::isCorrespondingTextMessageTabSelected(CTextMessage textMessage) } } - /* * Add new text message tab */ diff --git a/samples/blackgui/mainwindow_voice.cpp b/samples/blackgui/mainwindow_voice.cpp index a6140f0a3..a27a4f030 100644 --- a/samples/blackgui/mainwindow_voice.cpp +++ b/samples/blackgui/mainwindow_voice.cpp @@ -22,18 +22,18 @@ using namespace BlackMisc::Math; void MainWindow::setAudioDeviceLists() { if (!this->isContextVoiceAvailableCheck()) return; - this->ui->cb_VoiceOutputDevice->clear(); - this->ui->cb_VoiceInputDevice->clear(); + this->ui->cb_SettingsAudioOutputDevice->clear(); + this->ui->cb_SettingsAudioInputDevice->clear(); foreach(CAudioDevice device, this->m_contextVoice->getAudioDevices()) { if (device.getType() == CAudioDevice::InputDevice) { - this->ui->cb_VoiceInputDevice->addItem(device.toQString(true)); + this->ui->cb_SettingsAudioInputDevice->addItem(device.toQString(true)); } else if (device.getType() == CAudioDevice::OutputDevice) { - this->ui->cb_VoiceOutputDevice->addItem(device.toQString(true)); + this->ui->cb_SettingsAudioOutputDevice->addItem(device.toQString(true)); } } @@ -41,11 +41,11 @@ void MainWindow::setAudioDeviceLists() { if (device.getType() == CAudioDevice::InputDevice) { - this->ui->cb_VoiceInputDevice->setCurrentText(device.toQString(true)); + this->ui->cb_SettingsAudioInputDevice->setCurrentText(device.toQString(true)); } else if (device.getType() == CAudioDevice::OutputDevice) { - this->ui->cb_VoiceOutputDevice->setCurrentText(device.toQString(true)); + this->ui->cb_SettingsAudioOutputDevice->setCurrentText(device.toQString(true)); } } } @@ -62,14 +62,14 @@ void MainWindow::audioDeviceSelected(int index) if (devices.isEmpty()) return; CAudioDevice selectedDevice; QObject *sender = QObject::sender(); - if (sender == this->ui->cb_VoiceInputDevice) + if (sender == this->ui->cb_SettingsAudioInputDevice) { CAudioDeviceList inputDevices = devices.getInputDevices(); if (index >= inputDevices.size()) return; selectedDevice = inputDevices[index]; this->m_contextVoice->setCurrentAudioDevice(selectedDevice); } - else if (sender == this->ui->cb_VoiceOutputDevice) + else if (sender == this->ui->cb_SettingsAudioOutputDevice) { CAudioDeviceList outputDevices = devices.getOutputDevices(); if (index >= outputDevices.size()) return;