summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigFloatSlider.h
blob: e0dfccec1530c25cfc2f12eb87a3781da83ee7b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <QLabel>

#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"

#include "Common/Config/ConfigInfo.h"

// Automatically converts an int slider into a float one.
// Do not read the int values or ranges directly from it.
class ConfigFloatSlider final : public ConfigControl<ToolTipSlider>
{
  Q_OBJECT
public:
  ConfigFloatSlider(float minimum, float maximum, const Config::Info<float>& setting, float step,
                    Config::Layer* layer = nullptr);
  void Update(int value);

  // Returns the adjusted float value
  float GetValue() const;

protected:
  void OnConfigChanged() override;

private:
  float m_minimum;
  float m_step;
  const Config::Info<float> m_setting;
};

class ConfigFloatLabel final : public QLabel
{
public:
  ConfigFloatLabel(const QString& text, ConfigFloatSlider* widget);
};