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
|
|
|
|
|
2023-11-04 22:33:19 +00:00
|
|
|
#include <string>
|
2023-11-11 22:02:08 +00:00
|
|
|
#include <utility>
|
2023-11-04 22:33:19 +00:00
|
|
|
#include <vector>
|
|
|
|
|
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/ToolTipComboBox.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 ConfigChoice final : public ConfigControl<ToolTipComboBox>
|
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:
|
2024-09-18 06:29:13 +00:00
|
|
|
ConfigChoice(const QStringList& options, const Config::Info<int>& setting,
|
|
|
|
Config::Layer* layer = nullptr);
|
2017-06-15 23:42:12 +00:00
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
protected:
|
|
|
|
void OnConfigChanged() override;
|
|
|
|
|
2017-06-15 23:42:12 +00:00
|
|
|
private:
|
|
|
|
void Update(int choice);
|
|
|
|
|
2020-05-02 12:39:40 +00:00
|
|
|
Config::Info<int> m_setting;
|
2017-06-15 23:42:12 +00:00
|
|
|
};
|
2023-11-04 22:33:19 +00:00
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
class ConfigStringChoice final : public ConfigControl<ToolTipComboBox>
|
2023-11-04 22:33:19 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ConfigStringChoice(const std::vector<std::string>& options,
|
2024-09-18 06:29:13 +00:00
|
|
|
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
|
2023-11-11 22:02:08 +00:00
|
|
|
ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
|
2024-09-18 06:29:13 +00:00
|
|
|
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
|
|
|
|
void Load();
|
2023-11-04 22:33:19 +00:00
|
|
|
|
2024-09-18 06:29:13 +00:00
|
|
|
protected:
|
|
|
|
void OnConfigChanged() override;
|
|
|
|
|
2023-11-04 22:33:19 +00:00
|
|
|
private:
|
|
|
|
void Update(int index);
|
|
|
|
|
2024-12-23 21:54:26 +00:00
|
|
|
const Config::Info<std::string> m_setting;
|
2023-11-11 22:02:08 +00:00
|
|
|
bool m_text_is_data = false;
|
2023-11-04 22:33:19 +00:00
|
|
|
};
|
2024-10-21 21:47:42 +00:00
|
|
|
|
|
|
|
class ConfigComplexChoice final : public ToolTipComboBox
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
using InfoVariant = std::variant<Config::Info<u32>, Config::Info<int>, Config::Info<bool>>;
|
|
|
|
using OptionVariant = std::variant<u32, int, bool>;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ConfigComplexChoice(const InfoVariant setting1, const InfoVariant setting2,
|
|
|
|
Config::Layer* layer = nullptr);
|
|
|
|
|
|
|
|
void Add(const QString& name, const OptionVariant option1, const OptionVariant option2);
|
|
|
|
void Refresh();
|
|
|
|
void Reset();
|
|
|
|
const std::pair<Config::Location, Config::Location> GetLocation() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void SaveValue(int choice);
|
|
|
|
void UpdateComboIndex();
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
|
|
|
|
|
|
Config::Layer* m_layer;
|
|
|
|
const InfoVariant m_setting1;
|
|
|
|
const InfoVariant m_setting2;
|
|
|
|
std::vector<std::pair<OptionVariant, OptionVariant>> m_options;
|
|
|
|
};
|