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