mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 21:08:04 +03:00

This reduces code duplication in the different ConfigControls. This is helpful for the next commit, which will modify the now deduplicated code.
24 lines
660 B
C++
24 lines
660 B
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
|
|
|
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse)
|
|
: ConfigControl(label, setting.GetLocation()), m_setting(setting), m_reverse(reverse)
|
|
{
|
|
setChecked(ReadValue(setting) ^ reverse);
|
|
|
|
connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
|
|
}
|
|
|
|
void ConfigBool::Update()
|
|
{
|
|
const bool value = static_cast<bool>(isChecked() ^ m_reverse);
|
|
|
|
SaveValue(m_setting, value);
|
|
}
|
|
|
|
void ConfigBool::OnConfigChanged()
|
|
{
|
|
setChecked(ReadValue(m_setting) ^ m_reverse);
|
|
}
|