diff options
| author | TryTwo <taolas@gmail.com> | 2024-09-29 17:12:22 -0700 |
|---|---|---|
| committer | TryTwo <taolas@gmail.com> | 2024-12-10 13:42:30 -0700 |
| commit | 9541bb6cf7f966cc9fefaaa4ef2bc4d45babed22 (patch) | |
| tree | 012bceb365419a79c227d85d8f405b14f9e06336 /Source/Core/DolphinQt/Config/ConfigControls | |
| parent | ac129d318b02f6878352cb1c93d2ebf3542ace1c (diff) | |
Add method to bold slider/spin labels when a user game ini setting is being used
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls')
4 files changed, 51 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp index 8d724505e3..a81bfd7aed 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp @@ -29,3 +29,13 @@ void ConfigInteger::OnConfigChanged() { setValue(ReadValue(m_setting)); } + +ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget) + : QLabel(text), m_widget(QPointer<ConfigInteger>(widget)) +{ + connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() { + // Label shares font changes with ConfigInteger to mark game ini settings. + if (m_widget) + setFont(m_widget->font()); + }); +} diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h index 2979423f74..9a0e718279 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h @@ -3,6 +3,9 @@ #pragma once +#include <QLabel> +#include <QPointer> + #include "DolphinQt/Config/ConfigControls/ConfigControl.h" #include "DolphinQt/Config/ToolTipControls/ToolTipSpinBox.h" @@ -28,3 +31,14 @@ protected: private: const Config::Info<int>& m_setting; }; + +class ConfigIntegerLabel final : public QLabel +{ + Q_OBJECT + +public: + ConfigIntegerLabel(const QString& text, ConfigInteger* widget); + +private: + QPointer<ConfigInteger> m_widget; +}; diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp index 9192410e03..a296d57e86 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp @@ -1,7 +1,10 @@ // Copyright 2017 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include <QFont> + #include "DolphinQt/Config/ConfigControls/ConfigSlider.h" +#include "DolphinQt/Settings.h" ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick) : ConfigSlider(minimum, maximum, setting, nullptr, tick) @@ -30,3 +33,13 @@ void ConfigSlider::OnConfigChanged() { setValue(ReadValue(m_setting)); } + +ConfigSliderLabel::ConfigSliderLabel(const QString& text, ConfigSlider* slider) + : QLabel(text), m_slider(QPointer<ConfigSlider>(slider)) +{ + connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() { + // Label shares font changes with slider to mark game ini settings. + if (m_slider) + setFont(m_slider->font()); + }); +} diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h index 7ac81d03d5..7d10dcafb2 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h @@ -3,6 +3,9 @@ #pragma once +#include <QLabel> +#include <QPointer> + #include "DolphinQt/Config/ConfigControls/ConfigControl.h" #include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h" @@ -28,3 +31,14 @@ protected: private: const Config::Info<int>& m_setting; }; + +class ConfigSliderLabel final : public QLabel +{ + Q_OBJECT + +public: + ConfigSliderLabel(const QString& text, ConfigSlider* slider); + +private: + QPointer<ConfigSlider> m_slider; +}; |
