|
|
@ -95,17 +95,17 @@ void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name,
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
|
|
|
|
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
|
|
|
|
const Settings::Setting<bool>& setting,
|
|
|
|
const Settings::Setting<bool>& setting,
|
|
|
|
ConfigurationShared::CheckState& tracker) {
|
|
|
|
CheckState& tracker) {
|
|
|
|
if (setting.UsingGlobal()) {
|
|
|
|
if (setting.UsingGlobal()) {
|
|
|
|
tracker = CheckState::Global;
|
|
|
|
tracker = CheckState::Global;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off;
|
|
|
|
tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetHighlight(checkbox, name, tracker != CheckState::Global);
|
|
|
|
SetHighlight(checkbox, name, tracker != CheckState::Global);
|
|
|
|
QObject::connect(
|
|
|
|
QObject::connect(checkbox, &QCheckBox::clicked, checkbox,
|
|
|
|
checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() {
|
|
|
|
[checkbox, name, setting, &tracker]() {
|
|
|
|
tracker =
|
|
|
|
tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
|
|
|
|
static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count);
|
|
|
|
static_cast<int>(CheckState::Count));
|
|
|
|
if (tracker == CheckState::Global) {
|
|
|
|
if (tracker == CheckState::Global) {
|
|
|
|
checkbox->setChecked(setting.GetValue(true));
|
|
|
|
checkbox->setChecked(setting.GetValue(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -115,17 +115,17 @@ void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::str
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
|
|
|
|
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
|
|
|
|
bool global, bool state, bool global_state,
|
|
|
|
bool global, bool state, bool global_state,
|
|
|
|
ConfigurationShared::CheckState& tracker) {
|
|
|
|
CheckState& tracker) {
|
|
|
|
if (global) {
|
|
|
|
if (global) {
|
|
|
|
tracker = CheckState::Global;
|
|
|
|
tracker = CheckState::Global;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
tracker = (state == global_state) ? CheckState::On : CheckState::Off;
|
|
|
|
tracker = (state == global_state) ? CheckState::On : CheckState::Off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetHighlight(checkbox, name, tracker != CheckState::Global);
|
|
|
|
SetHighlight(checkbox, name, tracker != CheckState::Global);
|
|
|
|
QObject::connect(
|
|
|
|
QObject::connect(checkbox, &QCheckBox::clicked, checkbox,
|
|
|
|
checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, global_state, &tracker]() {
|
|
|
|
[checkbox, name, global_state, &tracker]() {
|
|
|
|
tracker =
|
|
|
|
tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
|
|
|
|
static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count);
|
|
|
|
static_cast<int>(CheckState::Count));
|
|
|
|
if (tracker == CheckState::Global) {
|
|
|
|
if (tracker == CheckState::Global) {
|
|
|
|
checkbox->setChecked(global_state);
|
|
|
|
checkbox->setChecked(global_state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|