From 643a50ad5a6f6851db63ece41a399d9783dc5acd Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 2 Aug 2015 20:09:56 +0200 Subject: - changed the way flags on executables are stored in memory - some coding style fixes --- src/executableslist.h | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'src/executableslist.h') diff --git a/src/executableslist.h b/src/executableslist.h index 4e1ad644..907b37aa 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -39,32 +39,23 @@ struct Executable { QString m_SteamAppID; QString m_WorkingDirectory; - enum class Type { - Game, - Custom + enum Flag { + CustomExecutable = 0x01, + ShowInToolbar = 0x02, + UseApplicationIcon = 0x04 }; - enum class Toolbar { - Disabled, - Enabled - }; - - enum class Icon { - MO, - Application - }; + Q_DECLARE_FLAGS(Flags, Flag) - Type m_Type; - Toolbar m_Toolbar; - Icon m_Icon; + Flags m_Flags; - bool isCustom() const { return m_Type == Type::Custom; } + bool isCustom() const { return m_Flags.testFlag(CustomExecutable); } - bool shownOnToolbar() const { return m_Toolbar == Toolbar::Enabled; } + bool shownOnToolbar() const { return m_Flags.testFlag(ShowInToolbar); } - void showOnToolbar(bool state) { m_Toolbar = state ? Toolbar::Enabled : Toolbar::Disabled; } + void showOnToolbar(bool state); - bool usesOwnIcon() const { return m_Icon == Icon::Application; } + bool usesOwnIcon() const { return m_Flags.testFlag(UseApplicationIcon); } }; @@ -149,9 +140,7 @@ public: const QString &workingDirectory, MOBase::ExecutableInfo::CloseMOStyle closeMO, const QString &steamAppID, - Executable::Type custom, - Executable::Toolbar toolbar, - Executable::Icon ownicon); + Executable::Flags flags); /** * @brief remove the executable with the specified file name. This needs to be an absolute file path @@ -198,4 +187,6 @@ private: }; +Q_DECLARE_OPERATORS_FOR_FLAGS(Executable::Flags) + #endif // EXECUTABLESLIST_H -- cgit v1.3.1