dolphin/Source/Core/DolphinQt/Config/Graphics/GraphicsChoice.cpp

35 lines
964 B
C++
Raw Normal View History

// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
2018-07-06 22:40:15 +00:00
#include "DolphinQt/Config/Graphics/GraphicsChoice.h"
#include <QSignalBlocker>
#include "Common/Config/Config.h"
2018-05-28 01:48:04 +00:00
2018-07-06 22:40:15 +00:00
#include "DolphinQt/Settings.h"
GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigInfo<int>& setting)
: m_setting(setting)
{
addItems(options);
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GraphicsChoice::Update);
setCurrentIndex(Config::Get(m_setting));
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
2017-09-20 16:12:03 +00:00
QFont bf = font();
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
setFont(bf);
const QSignalBlocker blocker(this);
setCurrentIndex(Config::Get(m_setting));
});
}
void GraphicsChoice::Update(int choice)
{
Config::SetBaseOrCurrent(m_setting, choice);
}