feat: add SettingWidget::dropdown support for int style enums (#6303)

This commit is contained in:
pajlada
2025-06-28 14:31:11 +02:00
committed by GitHub
parent f3c11a5159
commit 42fb5ad077
10 changed files with 163 additions and 65 deletions
+10 -12
View File
@@ -2,8 +2,10 @@
#include "common/ChatterinoSetting.hpp"
#include "common/enums/MessageOverflow.hpp"
#include "common/LastMessageLineStyle.hpp"
#include "common/Modes.hpp"
#include "common/SignalVector.hpp"
#include "common/ThumbnailPreviewMode.hpp"
#include "common/TimeoutStackStyle.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include "controllers/highlights/HighlightBadge.hpp"
@@ -16,7 +18,6 @@
#include "controllers/sound/ISoundController.hpp"
#include "providers/emoji/EmojiStyle.hpp"
#include "singletons/Toasts.hpp"
#include "util/QMagicEnumTagged.hpp"
#include "util/RapidJsonSerializeQString.hpp" // IWYU pragma: keep
#include "widgets/NotebookEnums.hpp"
@@ -24,6 +25,9 @@
#include <pajlada/settings/settinglistener.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <optional>
#include <string_view>
using TimeoutButton = std::pair<QString, int>;
namespace chatterino {
@@ -52,14 +56,6 @@ enum UsernameDisplayMode : int {
UsernameAndLocalizedName = 3, // Username (Localized name)
};
enum ThumbnailPreviewMode : int {
DontShow = 0,
AlwaysShow = 1,
ShowOnShift = 2,
};
enum UsernameRightClickBehavior : int {
Reply = 0,
Mention = 1,
@@ -106,7 +102,7 @@ enum class EmoteTooltipScale : std::uint8_t {
Huge,
};
constexpr qmagicenum::customize_t qmagicenumDisplayName(
constexpr std::optional<std::string_view> qmagicenumDisplayName(
EmoteTooltipScale value) noexcept
{
switch (value)
@@ -163,8 +159,10 @@ public:
"h:mm"};
BoolSetting showLastMessageIndicator = {
"/appearance/messages/showLastMessageIndicator", false};
EnumSetting<Qt::BrushStyle> lastMessagePattern = {
"/appearance/messages/lastMessagePattern", Qt::SolidPattern};
EnumSetting<LastMessageLineStyle> lastMessagePattern = {
"/appearance/messages/lastMessagePattern",
LastMessageLineStyle::Solid,
};
QStringSetting lastMessageColor = {"/appearance/messages/lastMessageColor",
"#7f2026"};
BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};