From 8dd0a06c815b1dafb1496ad504575e3b38ad4b6e Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 28 Nov 2019 00:47:42 +0100 Subject: [PATCH] [AFV], Ref T731, Ref T739 remember audio settings in launcher --- src/blackcore/data/launchersetup.cpp | 28 ++++++---------- src/blackcore/data/launchersetup.h | 30 ++++++++++++++--- .../components/dbusserveraddressselector.ui | 8 ----- src/swiftlauncher/swiftlauncher.cpp | 19 +++++++++-- src/swiftlauncher/swiftlauncher.ui | 32 +++++++------------ 5 files changed, 64 insertions(+), 53 deletions(-) diff --git a/src/blackcore/data/launchersetup.cpp b/src/blackcore/data/launchersetup.cpp index a05130feb..771bcd223 100644 --- a/src/blackcore/data/launchersetup.cpp +++ b/src/blackcore/data/launchersetup.cpp @@ -17,7 +17,7 @@ namespace BlackCore { QString CLauncherSetup::convertToQString(bool i18n) const { - Q_UNUSED(i18n); + Q_UNUSED(i18n) return QStringLiteral("DBus: %1 frameless: %2 mode: %3").arg(m_dBusAddress, boolToYesNo(m_windowFrameless)).arg(m_coreMode); } @@ -27,14 +27,11 @@ namespace BlackCore const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDBusAddress: - return CVariant::fromValue(this->m_dBusAddress); - case IndexFramelessWindow: - return CVariant::fromValue(this->m_windowFrameless); - case IndexCoreMode: - return CVariant::fromValue(this->m_coreMode); - default: - return CValueObject::propertyByIndex(index); + case IndexDBusAddress: return CVariant::fromValue(m_dBusAddress); + case IndexFramelessWindow: return CVariant::fromValue(m_windowFrameless); + case IndexCoreMode: return CVariant::fromValue(m_coreMode); + case IndexAudioMode: return CVariant::fromValue(m_audioMode); + default: return CValueObject::propertyByIndex(index); } } @@ -44,15 +41,10 @@ namespace BlackCore const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDBusAddress: - this->setDBusAddress(variant.toQString()); - break; - case IndexFramelessWindow: - this->m_windowFrameless = variant.toBool(); - break; - case IndexCoreMode: - this->m_coreMode = variant.toInt(); - break; + case IndexDBusAddress: this->setDBusAddress(variant.toQString()); break; + case IndexFramelessWindow: m_windowFrameless = variant.toBool(); break; + case IndexCoreMode: m_coreMode = variant.toInt(); break; + case IndexAudioMode: m_audioMode = variant.toInt(); break; default: CValueObject::setPropertyByIndex(index, variant); break; diff --git a/src/blackcore/data/launchersetup.h b/src/blackcore/data/launchersetup.h index cf054557e..309346ac5 100644 --- a/src/blackcore/data/launchersetup.h +++ b/src/blackcore/data/launchersetup.h @@ -30,7 +30,8 @@ namespace BlackCore { IndexDBusAddress = BlackMisc::CPropertyIndex::GlobalIndexCLauncherSetup, IndexFramelessWindow, - IndexCoreMode + IndexCoreMode, + IndexAudioMode }; //! Core mode @@ -40,6 +41,16 @@ namespace BlackCore Distributed }; + //! Audio setup + enum AudioModeFlag + { + AudioNothingDisabled = 0, + AudioDisableStandaloneAudio = 1 << 0, + AudioDisableDistributedCoreAudio = 1 << 1, + AudioDisableDistributedGuiAudio = 1 << 2 + }; + Q_DECLARE_FLAGS(AudioMode, AudioModeFlag) + //! Default constructor CLauncherSetup() {} @@ -58,6 +69,12 @@ namespace BlackCore //! Core mode void setCoreMode(CoreMode mode) { m_coreMode = static_cast(mode); } + //! Audio mode + AudioMode getAudioMode() const { return static_cast(m_audioMode); } + + //! Audio mode + void setAudioMode(AudioMode mode) { m_audioMode = static_cast(mode); } + //! Frameless window? bool useFramelessWindow() const { return m_windowFrameless; } @@ -75,14 +92,16 @@ namespace BlackCore private: QString m_dBusAddress { "tcp:host=127.0.0.1,port=45000" }; //!< DBus address - bool m_windowFrameless = false; //!< frameless window - int m_coreMode = static_cast(Standalone); //!< core + bool m_windowFrameless = false; //!< frameless window + int m_coreMode = static_cast(Standalone); //!< core + int m_audioMode = static_cast(AudioNothingDisabled); BLACK_METACLASS( CLauncherSetup, BLACK_METAMEMBER(dBusAddress), BLACK_METAMEMBER(windowFrameless), - BLACK_METAMEMBER(coreMode) + BLACK_METAMEMBER(coreMode), + BLACK_METAMEMBER(audioMode) ); }; @@ -99,5 +118,8 @@ namespace BlackCore } // ns Q_DECLARE_METATYPE(BlackCore::Data::CLauncherSetup) +Q_DECLARE_METATYPE(BlackCore::Data::CLauncherSetup::AudioModeFlag) +Q_DECLARE_METATYPE(BlackCore::Data::CLauncherSetup::AudioMode) +Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::Data::CLauncherSetup::AudioMode) #endif // guard diff --git a/src/blackgui/components/dbusserveraddressselector.ui b/src/blackgui/components/dbusserveraddressselector.ui index 440308a82..fb5d588a7 100644 --- a/src/blackgui/components/dbusserveraddressselector.ui +++ b/src/blackgui/components/dbusserveraddressselector.ui @@ -2,14 +2,6 @@ CDBusServerAddressSelector - - - 0 - 0 - 158 - 118 - - DBus selector diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index 8b857d427..a754d107a 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -406,8 +406,13 @@ void CSwiftLauncher::setDefaults() ui->rb_WindowNormal->setChecked(!setup.useFramelessWindow()); const CLauncherSetup::CoreMode mode = setup.getCoreMode(); - ui->rb_SwiftStandalone->setChecked(mode == CLauncherSetup::Standalone ? true : false); + ui->rb_SwiftStandalone->setChecked(mode == CLauncherSetup::Standalone ? true : false); ui->rb_SwiftDistributed->setChecked(mode == CLauncherSetup::Distributed ? true : false); + + const CLauncherSetup::AudioMode audio = setup.getAudioMode(); + ui->cb_DisableCoreAudio->setChecked(audio.testFlag(CLauncherSetup::AudioDisableDistributedCoreAudio)); + ui->cb_DisableGUIAfv->setChecked(audio.testFlag(CLauncherSetup::AudioDisableDistributedGuiAudio)); + ui->cb_DisableSaAfv->setChecked(audio.testFlag(CLauncherSetup::AudioDisableStandaloneAudio)); } void CSwiftLauncher::saveSetup() @@ -417,10 +422,18 @@ void CSwiftLauncher::saveSetup() if (!dBus.isEmpty()) { setup.setDBusAddress(dBus); } setup.setFramelessWindow(ui->rb_WindowFrameless->isChecked()); setup.setCoreMode(CLauncherSetup::Standalone); + + CLauncherSetup::AudioMode audio = CLauncherSetup::AudioNothingDisabled; + audio.setFlag(CLauncherSetup::AudioDisableDistributedCoreAudio, ui->cb_DisableCoreAudio->isChecked()); + audio.setFlag(CLauncherSetup::AudioDisableDistributedGuiAudio, ui->cb_DisableGUIAfv->isChecked()); + audio.setFlag(CLauncherSetup::AudioDisableStandaloneAudio, ui->cb_DisableSaAfv->isChecked()); + setup.setAudioMode(audio); + if (ui->rb_SwiftDistributed->isChecked()) { setup.setCoreMode(CLauncherSetup::Distributed); } + const CStatusMessage msg = m_setup.set(setup); Q_UNUSED(msg) } @@ -566,9 +579,9 @@ void CSwiftLauncher::showLogPage() void CSwiftLauncher::checkRunningApplicationsAndCore() { // wait some time before buttons are enabled (allows startup) - if (m_startCoreWaitCycles > 0) { m_startCoreWaitCycles--; } + if (m_startCoreWaitCycles > 0) { m_startCoreWaitCycles--; } if (m_startMappingToolWaitCycles > 0) { m_startMappingToolWaitCycles--; } - if (m_startGuiWaitCycles > 0) { m_startGuiWaitCycles--; } + if (m_startGuiWaitCycles > 0) { m_startGuiWaitCycles--; } const CApplicationInfoList runningApps = sGui->getRunningApplications(); const bool foundLocalCore = runningApps.containsApplication(CApplicationInfo::PilotClientCore); diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 26f21c235..548570f1a 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -88,7 +88,7 @@ - 2 + 4 6 @@ -99,7 +99,7 @@ 0 0 392 - 309 + 334 @@ -154,7 +154,7 @@ 0 0 392 - 309 + 334 @@ -218,8 +218,8 @@ 0 0 - 381 - 332 + 392 + 334 @@ -342,13 +342,13 @@ 4 - 4 + 2 - 4 + 2 - 0 + 2 4 @@ -396,7 +396,7 @@ 0 0 392 - 309 + 334 @@ -478,7 +478,7 @@ 0 0 376 - 126 + 151 @@ -529,7 +529,7 @@ 0 0 392 - 309 + 334 @@ -623,21 +623,13 @@ 0 - 175 + 150 0 - - - 0 - 0 - 392 - 151 - - Start application