2015-12-10 16:33:14 +00:00
|
|
|
#ifndef CSM_PREFS_ENUMSETTING_H
|
|
|
|
#define CSM_PREFS_ENUMSETTING_H
|
|
|
|
|
2024-01-03 21:55:00 +00:00
|
|
|
#include <span>
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <string>
|
2024-01-03 21:55:00 +00:00
|
|
|
#include <string_view>
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <utility>
|
2015-12-10 16:33:14 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2024-01-03 21:55:00 +00:00
|
|
|
#include "enumvalueview.hpp"
|
2015-12-10 16:33:14 +00:00
|
|
|
#include "setting.hpp"
|
|
|
|
|
2017-05-09 07:50:16 +00:00
|
|
|
class QComboBox;
|
|
|
|
|
2015-12-10 16:33:14 +00:00
|
|
|
namespace CSMPrefs
|
|
|
|
{
|
2022-10-19 17:02:00 +00:00
|
|
|
class Category;
|
|
|
|
|
2023-11-11 23:52:09 +00:00
|
|
|
class EnumSetting final : public TypedSetting<std::string>
|
2015-12-10 16:33:14 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
std::string mTooltip;
|
2024-01-03 21:55:00 +00:00
|
|
|
std::span<const EnumValueView> mValues;
|
2017-05-09 07:50:16 +00:00
|
|
|
QComboBox* mWidget;
|
2015-12-10 16:33:14 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
2024-01-03 21:55:00 +00:00
|
|
|
explicit EnumSetting(Category* parent, QMutex* mutex, std::string_view key, const QString& label,
|
|
|
|
std::span<const EnumValueView> values, Settings::Index& index);
|
2015-12-10 16:33:14 +00:00
|
|
|
|
|
|
|
EnumSetting& setTooltip(const std::string& tooltip);
|
|
|
|
|
|
|
|
/// Return label, input widget.
|
2023-11-10 12:28:10 +00:00
|
|
|
SettingWidgets makeWidgets(QWidget* parent) override;
|
2015-12-10 16:33:14 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void updateWidget() override;
|
2017-05-09 07:50:16 +00:00
|
|
|
|
2015-12-10 16:33:14 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void valueChanged(int value);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|