[AFV], Ref T731, Ref T739 remember audio settings in launcher

This commit is contained in:
Klaus Basan
2019-11-28 00:47:42 +01:00
committed by Mat Sutcliffe
parent 386a0ccd5d
commit 8dd0a06c81
5 changed files with 64 additions and 53 deletions

View File

@@ -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<ColumnIndex>();
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<ColumnIndex>();
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;

View File

@@ -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<int>(mode); }
//! Audio mode
AudioMode getAudioMode() const { return static_cast<AudioMode>(m_audioMode); }
//! Audio mode
void setAudioMode(AudioMode mode) { m_audioMode = static_cast<int>(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<int>(Standalone); //!< core
bool m_windowFrameless = false; //!< frameless window
int m_coreMode = static_cast<int>(Standalone); //!< core
int m_audioMode = static_cast<int>(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

View File

@@ -2,14 +2,6 @@
<ui version="4.0">
<class>CDBusServerAddressSelector</class>
<widget class="QFrame" name="CDBusServerAddressSelector">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>158</width>
<height>118</height>
</rect>
</property>
<property name="windowTitle">
<string>DBus selector</string>
</property>

View File

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

View File

@@ -88,7 +88,7 @@
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>2</number>
<number>4</number>
</property>
<property name="tabSpacing">
<number>6</number>
@@ -99,7 +99,7 @@
<x>0</x>
<y>0</y>
<width>392</width>
<height>309</height>
<height>334</height>
</rect>
</property>
<attribute name="label">
@@ -154,7 +154,7 @@
<x>0</x>
<y>0</y>
<width>392</width>
<height>309</height>
<height>334</height>
</rect>
</property>
<attribute name="label">
@@ -218,8 +218,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>332</height>
<width>392</width>
<height>334</height>
</rect>
</property>
<attribute name="label">
@@ -342,13 +342,13 @@
<number>4</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>2</number>
</property>
<property name="topMargin">
<number>4</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>2</number>
</property>
<property name="bottomMargin">
<number>4</number>
@@ -396,7 +396,7 @@
<x>0</x>
<y>0</y>
<width>392</width>
<height>309</height>
<height>334</height>
</rect>
</property>
<attribute name="label">
@@ -478,7 +478,7 @@
<x>0</x>
<y>0</y>
<width>376</width>
<height>126</height>
<height>151</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vl_DataUpdatesScrollArea">
@@ -529,7 +529,7 @@
<x>0</x>
<y>0</y>
<width>392</width>
<height>309</height>
<height>334</height>
</rect>
</property>
<attribute name="label">
@@ -623,21 +623,13 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>175</height>
<height>150</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pg_Start">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<height>151</height>
</rect>
</property>
<attribute name="label">
<string>Start application</string>
</attribute>