Merge pull request #6887 from spycrab/qt_slider_accuracy

Qt/HacksWidget: Fix slider not showing overridden settings
This commit is contained in:
spycrab 2018-05-19 03:00:34 +02:00 committed by GitHub
commit adcaf3c581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -11,9 +11,12 @@
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DolphinQt2/Config/Graphics/GraphicsBool.h" #include "DolphinQt2/Config/Graphics/GraphicsBool.h"
#include "DolphinQt2/Config/Graphics/GraphicsSlider.h" #include "DolphinQt2/Config/Graphics/GraphicsSlider.h"
#include "DolphinQt2/Config/Graphics/GraphicsWindow.h" #include "DolphinQt2/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt2/Settings.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent) HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent)
@ -25,6 +28,7 @@ HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent)
connect(parent, &GraphicsWindow::BackendChanged, this, &HacksWidget::OnBackendChanged); connect(parent, &GraphicsWindow::BackendChanged, this, &HacksWidget::OnBackendChanged);
OnBackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend)); OnBackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
connect(&Settings::Instance(), &Settings::ConfigChanged, this, &HacksWidget::LoadSettings);
} }
void HacksWidget::CreateWidgets() void HacksWidget::CreateWidgets()
@ -62,7 +66,9 @@ void HacksWidget::CreateWidgets()
auto* safe_label = new QLabel(tr("Safe")); auto* safe_label = new QLabel(tr("Safe"));
safe_label->setAlignment(Qt::AlignRight); safe_label->setAlignment(Qt::AlignRight);
texture_cache_layout->addWidget(new QLabel(tr("Accuracy:")), 0, 0); m_accuracy_label = new QLabel(tr("Accuracy:"));
texture_cache_layout->addWidget(m_accuracy_label, 0, 0);
texture_cache_layout->addWidget(safe_label, 0, 1); texture_cache_layout->addWidget(safe_label, 0, 1);
texture_cache_layout->addWidget(m_accuracy, 0, 2); texture_cache_layout->addWidget(m_accuracy, 0, 2);
texture_cache_layout->addWidget(new QLabel(tr("Fast")), 0, 3); texture_cache_layout->addWidget(new QLabel(tr("Fast")), 0, 3);
@ -126,6 +132,7 @@ void HacksWidget::ConnectWidgets()
void HacksWidget::LoadSettings() void HacksWidget::LoadSettings()
{ {
const bool old = m_accuracy->blockSignals(true);
auto samples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES); auto samples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
int slider_pos = 0; int slider_pos = 0;
@ -147,6 +154,15 @@ void HacksWidget::LoadSettings()
} }
m_accuracy->setValue(slider_pos); m_accuracy->setValue(slider_pos);
QFont bf = m_accuracy_label->font();
bf.setBold(Config::GetActiveLayerForConfig(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES) !=
Config::LayerType::Base);
m_accuracy_label->setFont(bf);
m_accuracy->blockSignals(old);
} }
void HacksWidget::SaveSettings() void HacksWidget::SaveSettings()

View File

@ -8,6 +8,7 @@
class GraphicsWindow; class GraphicsWindow;
class QCheckBox; class QCheckBox;
class QLabel;
class QRadioButton; class QRadioButton;
class QSlider; class QSlider;
@ -29,6 +30,7 @@ private:
QCheckBox* m_store_efb_copies; QCheckBox* m_store_efb_copies;
// Texture Cache // Texture Cache
QLabel* m_accuracy_label;
QSlider* m_accuracy; QSlider* m_accuracy;
QCheckBox* m_gpu_texture_decoding; QCheckBox* m_gpu_texture_decoding;