[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