mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Qt: Rename GraphicsRadioInt to ConfigRadioInt
GraphicsRadioInt is used by the panes in the Graphics config window to create radio buttons that change their associated config setting, and update their own state when something else changes the config setting. Despite its current name nothing about this class is particular to the Graphics window, so renaming it to ConfigRadioInt better reflects its purpose. This should also make it less confusing when ConfigRadioInts are added to other config panes.
This commit is contained in:
34
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
Normal file
34
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value)
|
||||
: ToolTipRadioButton(label), m_setting(setting), m_value(value)
|
||||
{
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigRadioInt::Update()
|
||||
{
|
||||
if (!isChecked())
|
||||
return;
|
||||
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
}
|
21
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h
Normal file
21
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipRadioButton.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
class ConfigRadioInt : public ToolTipRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
Config::Info<int> m_setting;
|
||||
int m_value;
|
||||
};
|
Reference in New Issue
Block a user