From c750ad1dfc4f0bec8fdb46c8c5bf7de3dd653a85 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 2 Jun 2018 01:56:20 +0200 Subject: [PATCH] As a follow up of voice testing * allow to directly go from ATC component to audio component (control volume) * reordered keypad a bit * audio setup, "private slots" -> "private" --- .../components/atcstationcomponent.cpp | 2 + src/blackgui/components/atcstationcomponent.h | 3 + .../components/atcstationcomponent.ui | 38 +- .../components/audiosetupcomponent.cpp | 30 +- src/blackgui/components/audiosetupcomponent.h | 17 +- src/blackgui/components/cockpitcomponent.h | 2 +- .../components/maininfoareacomponent.cpp | 6 + .../components/maininfoareacomponent.h | 3 + .../components/mainkeypadareacomponent.ui | 352 +++++++++--------- src/swiftguistandard/swiftguistdinit.cpp | 9 +- 10 files changed, 241 insertions(+), 221 deletions(-) diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index 3684ed8e2..222bfb399 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -59,6 +59,7 @@ namespace BlackGui CIdentifiable(this), ui(new Ui::CAtcStationComponent) { + Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui"); ui->setupUi(this); this->setCurrentIndex(0); this->tabBar()->setExpanding(false); @@ -82,6 +83,7 @@ namespace BlackGui // Signal / Slots connect(ui->le_AtcStationsOnlineMetar, &QLineEdit::returnPressed, this, &CAtcStationComponent::getMetarAsEntered); connect(ui->tb_AtcStationsLoadMetar, &QPushButton::clicked, this, &CAtcStationComponent::getMetarAsEntered); + connect(ui->pb_Audio, &QPushButton::clicked, this, &CAtcStationComponent::requestAudioWidget); connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::atcStationsTabChanged); // "local" tab changed (booked, online) connect(ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::onlineAtcStationSelected); connect(ui->tvp_AtcStationsOnline, &CAtcStationView::testRequestDummyAtcOnlineStations, this, &CAtcStationComponent::testCreateDummyOnlineAtcStations); diff --git a/src/blackgui/components/atcstationcomponent.h b/src/blackgui/components/atcstationcomponent.h index 51f4763d4..4acc0c96a 100644 --- a/src/blackgui/components/atcstationcomponent.h +++ b/src/blackgui/components/atcstationcomponent.h @@ -74,6 +74,9 @@ namespace BlackGui //! Request a text message void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign); + //! Request audio widget + void requestAudioWidget(); + private: //! \copydoc Models::CAtcStationListModel::changedAtcStationConnectionStatus void changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &station, bool added); diff --git a/src/blackgui/components/atcstationcomponent.ui b/src/blackgui/components/atcstationcomponent.ui index 7e43c6641..44249b3c1 100644 --- a/src/blackgui/components/atcstationcomponent.ui +++ b/src/blackgui/components/atcstationcomponent.ui @@ -95,20 +95,7 @@ - - - - - 100 - 0 - - - - Qt::StrongFocus - - - - + Qt::Horizontal @@ -153,6 +140,26 @@ + + + + + 100 + 0 + + + + Qt::StrongFocus + + + + + + + audio + + + @@ -290,10 +297,11 @@ le_AtcStationsOnlineMetar tb_AtcStationsLoadMetar tb_AtcStationsAtisReload + pb_Audio comp_AtcStationsSettings te_AtcStationsOnlineInfo - tvp_AtcStationsBooked tvp_AtcStationsOnlineTree + tvp_AtcStationsBooked diff --git a/src/blackgui/components/audiosetupcomponent.cpp b/src/blackgui/components/audiosetupcomponent.cpp index 246a12536..307bceae4 100644 --- a/src/blackgui/components/audiosetupcomponent.cpp +++ b/src/blackgui/components/audiosetupcomponent.cpp @@ -47,9 +47,9 @@ namespace BlackGui this->setEnabled(audio); ui->lbl_ExtraInfo->setText(audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change."); - bool c = connect(ui->tb_ExpandNotificationSounds, &QToolButton::toggled, this, &CAudioSetupComponent::ps_onToggleNotificationSoundsVisibility); + bool c = connect(ui->tb_ExpandNotificationSounds, &QToolButton::toggled, this, &CAudioSetupComponent::onToggleNotificationSoundsVisibility); Q_ASSERT(c); - c = connect(ui->cb_SetupAudioLoopback, &QCheckBox::toggled, this, &CAudioSetupComponent::ps_onLoopbackToggled); + c = connect(ui->cb_SetupAudioLoopback, &QCheckBox::toggled, this, &CAudioSetupComponent::onLoopbackToggled); Q_ASSERT(c); if (audio) @@ -60,18 +60,18 @@ namespace BlackGui ui->cb_SetupAudioLoopback->setChecked(sGui->getIContextAudio()->isAudioLoopbackEnabled()); // the connects depend on initAudioDeviceLists - c = connect(ui->cb_SetupAudioInputDevice, static_cast (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::ps_audioDeviceSelected); + c = connect(ui->cb_SetupAudioInputDevice, static_cast (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected); Q_ASSERT(c); - c = connect(ui->cb_SetupAudioOutputDevice, static_cast (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::ps_audioDeviceSelected); + c = connect(ui->cb_SetupAudioOutputDevice, static_cast (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected); Q_ASSERT(c); // context - c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::ps_onAudioDevicesChanged); + c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::onAudioDevicesChanged); Q_ASSERT(c); - c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::ps_onCurrentAudioDevicesChanged); + c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::onCurrentAudioDevicesChanged); Q_ASSERT(c); } - this->ps_reloadSettings(); + this->reloadSettings(); ui->tb_ExpandNotificationSounds->setChecked(false); // collapse Q_UNUSED(c); } @@ -79,7 +79,7 @@ namespace BlackGui CAudioSetupComponent::~CAudioSetupComponent() { } - void CAudioSetupComponent::ps_reloadSettings() + void CAudioSetupComponent::reloadSettings() { CSettings as(m_audioSettings.getThreadLocal()); ui->cb_SetupAudioPlayNotificationSounds->setChecked(true); @@ -87,7 +87,7 @@ namespace BlackGui ui->cb_SetupAudioNotificationVoiceRoom->setChecked(as.getNotificationFlag(CNotificationSounds::NotificationVoiceRoomJoined)); } - void CAudioSetupComponent::ps_onToggleNotificationSoundsVisibility(bool checked) + void CAudioSetupComponent::onToggleNotificationSoundsVisibility(bool checked) { ui->fr_NotificationSoundsInner->setVisible(checked); } @@ -95,8 +95,8 @@ namespace BlackGui void CAudioSetupComponent::initAudioDeviceLists() { if (!this->hasAudio()) { return; } - this->ps_onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices()); - this->ps_onCurrentAudioDevicesChanged(sGui->getIContextAudio()->getCurrentAudioDevices()); + this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices()); + this->onCurrentAudioDevicesChanged(sGui->getIContextAudio()->getCurrentAudioDevices()); } bool CAudioSetupComponent::hasAudio() const @@ -109,7 +109,7 @@ namespace BlackGui return ui->cb_SetupAudioPlayNotificationSounds->isChecked(); } - void CAudioSetupComponent::ps_audioDeviceSelected(int index) + void CAudioSetupComponent::onAudioDeviceSelected(int index) { if (!sGui->getIContextAudio()) return; if (index < 0) { return; } @@ -134,7 +134,7 @@ namespace BlackGui } } - void CAudioSetupComponent::ps_onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices) + void CAudioSetupComponent::onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices) { for (auto &device : devices) { @@ -149,7 +149,7 @@ namespace BlackGui } } - void CAudioSetupComponent::ps_onAudioDevicesChanged(const CAudioDeviceInfoList &devices) + void CAudioSetupComponent::onAudioDevicesChanged(const CAudioDeviceInfoList &devices) { ui->cb_SetupAudioOutputDevice->clear(); ui->cb_SetupAudioInputDevice->clear(); @@ -167,7 +167,7 @@ namespace BlackGui } } - void CAudioSetupComponent::ps_onLoopbackToggled(bool loopback) + void CAudioSetupComponent::onLoopbackToggled(bool loopback) { Q_ASSERT(sGui->getIContextAudio()); if (sGui->getIContextAudio()->isAudioLoopbackEnabled() == loopback) { return; } diff --git a/src/blackgui/components/audiosetupcomponent.h b/src/blackgui/components/audiosetupcomponent.h index fe9c39215..f4b99b432 100644 --- a/src/blackgui/components/audiosetupcomponent.h +++ b/src/blackgui/components/audiosetupcomponent.h @@ -43,27 +43,26 @@ namespace BlackGui //! Play notification sounds (at all) bool playNotificationSounds() const; - private slots: + private: //! Reload settings - void ps_reloadSettings(); + void reloadSettings(); //! Audio device selected //! \param index audio device index (COM1, COM2) - void ps_audioDeviceSelected(int index); + void onAudioDeviceSelected(int index); //! Current audio devices changed - void ps_onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); + void onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); //! Audio devices changed - void ps_onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); + void onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices); //! Loopback toggled - void ps_onLoopbackToggled(bool loopback); + void onLoopbackToggled(bool loopback); //! Visibilty (show/hide buttons) - void ps_onToggleNotificationSoundsVisibility(bool checked); + void onToggleNotificationSoundsVisibility(bool checked); - private: //! Audio device lists from settings void initAudioDeviceLists(); @@ -71,7 +70,7 @@ namespace BlackGui bool hasAudio() const; QScopedPointer ui; - BlackMisc::CSetting m_audioSettings { this, &CAudioSetupComponent::ps_reloadSettings }; + BlackMisc::CSetting m_audioSettings { this, &CAudioSetupComponent::reloadSettings }; }; } // namespace } // namespace diff --git a/src/blackgui/components/cockpitcomponent.h b/src/blackgui/components/cockpitcomponent.h index 225d94b5b..531fd02e4 100644 --- a/src/blackgui/components/cockpitcomponent.h +++ b/src/blackgui/components/cockpitcomponent.h @@ -50,7 +50,7 @@ namespace BlackGui //! \copydoc BlackGui::Components::CTransponderModeSelector::setSelectedTransponderModeStateIdent void setSelectedTransponderModeStateIdent(); - //! Show the audio ui + //! Show the audio UI void showAudio(); private: diff --git a/src/blackgui/components/maininfoareacomponent.cpp b/src/blackgui/components/maininfoareacomponent.cpp index 74cd7bef2..92ec54aff 100644 --- a/src/blackgui/components/maininfoareacomponent.cpp +++ b/src/blackgui/components/maininfoareacomponent.cpp @@ -159,6 +159,12 @@ namespace BlackGui ui->comp_Settings->setSettingsTab(static_cast(index)); } + void CMainInfoAreaComponent::selectAudioTab() + { + this->getCockpitComponent()->showAudio(); + this->selectArea(CMainInfoAreaComponent::InfoAreaCockpit); + } + const QPixmap &CMainInfoAreaComponent::indexToPixmap(int areaIndex) const { const InfoArea area = static_cast(areaIndex); diff --git a/src/blackgui/components/maininfoareacomponent.h b/src/blackgui/components/maininfoareacomponent.h index 2f3cab1f1..cc561ca3f 100644 --- a/src/blackgui/components/maininfoareacomponent.h +++ b/src/blackgui/components/maininfoareacomponent.h @@ -126,6 +126,9 @@ namespace BlackGui //! Select settings with given area void selectSettingsTab(int index); + //! Select the audio tab + void selectAudioTab(); + protected: // CInfoArea overrides virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override; diff --git a/src/blackgui/components/mainkeypadareacomponent.ui b/src/blackgui/components/mainkeypadareacomponent.ui index 7358d4db5..5f5ed98b2 100644 --- a/src/blackgui/components/mainkeypadareacomponent.ui +++ b/src/blackgui/components/mainkeypadareacomponent.ui @@ -62,6 +62,105 @@ 2 + + + + + 0 + 24 + + + + command line (e.g. ".com1", ".x", ".msg com1") + + + .dot commands or text message + + + + + + + + 0 + 0 + + + + Use "SHIFT" for overview + + + Qt::LeftToRight + + + Settings + + + true + + + + + + + + 0 + 0 + + + + 100% + + + + + + + + 0 + 0 + + + + Interpolation + + + Interpol. + + + true + + + + + + + + 0 + 0 + + + + Weather + + + true + + + + + + + + 0 + 0 + + + + Audio + + + @@ -75,52 +174,7 @@ - - - - false - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Audio - - - - - - - 0 - 0 - - - - Log - - - true - - - - @@ -152,7 +206,23 @@ - + + + + + 0 + 0 + + + + Log + + + true + + + + @@ -171,38 +241,6 @@ - - - - - 0 - 0 - - - - Aircraft - - - true - - - - - - - - 0 - 0 - - - - Text/Chat - - - true - - - @@ -219,7 +257,23 @@ - + + + + + 0 + 0 + + + + Aircraft + + + true + + + + @@ -235,7 +289,23 @@ - + + + + + 0 + 0 + + + + Text/Chat + + + true + + + + @@ -252,70 +322,6 @@ - - - - 0 - 0 - - - - 100% - - - - - - - - 0 - 0 - - - - Users - - - true - - - - - - - - 0 - 0 - - - - Mute - - - - - - - - 0 - 0 - - - - Use "SHIFT" for overview - - - Qt::LeftToRight - - - Settings - - - true - - - - @@ -328,7 +334,7 @@ - + @@ -344,8 +350,8 @@ - - + + 0 @@ -353,45 +359,39 @@ - Weather - - - true + Mute - - + + + + false + 0 0 - - Interpolation - - Interpol. - - - true + - - - - - 0 - 24 - + + + + + 0 + 0 + - - command line (e.g. ".com1", ".x", ".msg com1") + + Users - - .dot commands or text message + + true @@ -413,7 +413,7 @@ pb_Connect pb_MainAircrafts pb_MainAtc - pb_MainUsers + pb_Audio pb_MainCockpit pb_MainSimulator pb_MainMappings @@ -423,13 +423,13 @@ pb_MainLog pb_MainSettings pb_MainWeather - pb_Empty - pb_SoundMaxVolume + pb_MainUsers + pb_Opacity050 pb_Opacity100 pb_CockpitIdent - pb_Audio + pb_Empty pb_SoundMute - pb_Opacity050 + pb_SoundMaxVolume diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 7c1e59ea5..00a9a171c 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -206,13 +206,12 @@ void SwiftGuiStd::initGuiSignals() connect(ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this, &SwiftGuiStd::onChangedWindowOpacity); connect(ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent); connect(ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::textEntered, ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::handleGlobalCommandLineText); - connect(ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::audioPressed, [ = ] - { - ui->comp_MainInfoArea->getCockpitComponent()->showAudio(); - ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaCockpit); - }); + connect(ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::audioPressed, ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectAudioTab); connect(ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedInfoAreaStatus, ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::onMainInfoAreaChanged); + // audio + connect(ui->comp_MainInfoArea->getAtcStationComponent(), &CAtcStationComponent::requestAudioWidget, ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectAudioTab); + // menu connect(ui->menu_TestLocationsEDDF, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked); connect(ui->menu_TestLocationsEDDM, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);