configuration_shared: Initial functions and data for manual tristate

Sets up initial support for implementing colored tristate functions. These functions color a QWidget blue when it's overriding a global setting, and discolor it when not. The lack of color indicates it uses the global state, replacing the Qt::CheckState::PartiallyChecked state with the global state.
This commit is contained in:
lat9nq
2020-07-13 17:08:24 -04:00
parent ad0b295125
commit e26e82d8d5
2 changed files with 58 additions and 0 deletions

View File

@ -15,8 +15,20 @@ constexpr int USE_GLOBAL_INDEX = 0;
constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1;
constexpr int USE_GLOBAL_OFFSET = 2;
enum CheckState {
Off,
On,
Global,
Count,
};
struct Trackers {
} extern trackers;
// Global-aware apply and set functions
void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox,
const CheckState& tracker);
void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox);
void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox);
void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
@ -31,6 +43,10 @@ void SetPerGameSetting(QComboBox* combobox,
void SetPerGameSetting(QComboBox* combobox,
const Settings::Setting<Settings::GPUAccuracy>* setting);
void SetBGColor(QWidget* widget, bool highlighted);
void SetColoredTristate(QCheckBox* checkbox, Settings::Setting<bool>& setting,
ConfigurationShared::CheckState& tracker);
void InsertGlobalItem(QComboBox* combobox);
} // namespace ConfigurationShared