Files
dolphin/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
862 B
C++
Raw Normal View History

2017-06-16 01:42:12 +02:00
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2017-06-16 01:42:12 +02:00
2023-04-21 14:02:53 -07:00
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
2017-06-16 01:42:12 +02:00
2023-04-21 14:02:53 -07:00
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse)
: ConfigBool(label, setting, nullptr, reverse)
{
}
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting,
Config::Layer* layer, bool reverse)
: ConfigControl(label, setting.GetLocation(), layer), m_setting(setting), m_reverse(reverse)
2017-06-16 01:42:12 +02:00
{
setChecked(ReadValue(setting) ^ reverse);
2023-04-21 14:02:53 -07:00
connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
2017-06-16 01:42:12 +02:00
}
2023-04-21 14:02:53 -07:00
void ConfigBool::Update()
2017-06-16 01:42:12 +02:00
{
const bool value = static_cast<bool>(isChecked() ^ m_reverse);
SaveValue(m_setting, value);
}
void ConfigBool::OnConfigChanged()
{
setChecked(ReadValue(m_setting) ^ m_reverse);
2017-06-16 01:42:12 +02:00
}