2017-06-15 23:42:12 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-06-15 23:42:12 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-12-25 03:31:03 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2024-09-30 00:12:22 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QPointer>
|
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
2020-10-17 05:05:43 +00:00
|
|
|
#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"
|
2017-06-15 23:42:12 +00:00
|
|
|
|
2024-12-23 21:54:26 +00:00
|
|
|
#include "Common/Config/ConfigInfo.h"
|
2017-06-15 23:42:12 +00:00
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
class ConfigSlider final : public ConfigControl<ToolTipSlider>
|
2017-06-15 23:42:12 +00:00
|
|
|
{
|
2018-05-13 20:16:20 +00:00
|
|
|
Q_OBJECT
|
2017-06-15 23:42:12 +00:00
|
|
|
public:
|
2023-04-29 03:11:55 +00:00
|
|
|
ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick = 0);
|
2024-09-18 06:29:13 +00:00
|
|
|
ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, Config::Layer* layer,
|
|
|
|
int tick = 0);
|
|
|
|
|
2024-12-25 03:31:03 +00:00
|
|
|
// Generates a slider with tick_values.size() ticks. Each tick corresponds to the integer at that
|
|
|
|
// index in the vector.
|
|
|
|
ConfigSlider(std::vector<int> tick_values, const Config::Info<int>& setting,
|
|
|
|
Config::Layer* layer);
|
|
|
|
|
2017-06-15 23:42:12 +00:00
|
|
|
void Update(int value);
|
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
protected:
|
|
|
|
void OnConfigChanged() override;
|
|
|
|
|
2017-06-15 23:42:12 +00:00
|
|
|
private:
|
2024-12-23 21:54:26 +00:00
|
|
|
const Config::Info<int> m_setting;
|
2024-12-25 03:31:03 +00:00
|
|
|
|
|
|
|
// Mappings for slider ticks to config values. Identity mapping is assumed if this is empty.
|
|
|
|
std::vector<int> m_tick_values;
|
2017-06-15 23:42:12 +00:00
|
|
|
};
|
2024-09-30 00:12:22 +00:00
|
|
|
|
|
|
|
class ConfigSliderLabel final : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ConfigSliderLabel(const QString& text, ConfigSlider* slider);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPointer<ConfigSlider> m_slider;
|
|
|
|
};
|