mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
Qt: Rename GraphicsChoice to ConfigChoice
GraphicsChoice is used by the panes in the Graphics config window to create combo boxes 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 ConfigChoice better reflects its purpose. This should also make it less confusing when ConfigChoices are eventually added to the other config windows.
This commit is contained in:
32
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
Normal file
32
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& setting)
|
||||
: m_setting(setting)
|
||||
{
|
||||
addItems(options);
|
||||
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &ConfigChoice::Update);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
|
||||
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);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigChoice::Update(int choice)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, choice);
|
||||
}
|
Reference in New Issue
Block a user