From 2b89642490802d33cb4e72e10cce3e4b95358b27 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 15 Jun 2025 00:52:21 +0200 Subject: [PATCH] fix(clang-tidy): modernize-type-traits (#6269) --- src/common/ChatterinoSetting.hpp | 5 ++--- src/common/UniqueAccess.hpp | 3 +-- src/messages/MessageBuilder.hpp | 2 +- src/widgets/settingspages/GeneralPage.cpp | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/common/ChatterinoSetting.hpp b/src/common/ChatterinoSetting.hpp index 9db04def..fb4a536c 100644 --- a/src/common/ChatterinoSetting.hpp +++ b/src/common/ChatterinoSetting.hpp @@ -63,10 +63,9 @@ using QStringSetting = ChatterinoSetting; using QSizeSetting = ChatterinoSetting; template -class EnumSetting - : public ChatterinoSetting::type> +class EnumSetting : public ChatterinoSetting> { - using Underlying = typename std::underlying_type::type; + using Underlying = std::underlying_type_t; public: using ChatterinoSetting::ChatterinoSetting; diff --git a/src/common/UniqueAccess.hpp b/src/common/UniqueAccess.hpp index d7595599..577310b8 100644 --- a/src/common/UniqueAccess.hpp +++ b/src/common/UniqueAccess.hpp @@ -85,8 +85,7 @@ public: return AccessGuard(this->element_, this->mutex_); } - template ::value>> + template >> SharedAccessGuard accessConst() const { return SharedAccessGuard(this->element_, this->mutex_); diff --git a/src/messages/MessageBuilder.hpp b/src/messages/MessageBuilder.hpp index c6bdb626..e9f50580 100644 --- a/src/messages/MessageBuilder.hpp +++ b/src/messages/MessageBuilder.hpp @@ -144,7 +144,7 @@ public: template T *emplace(Args &&...args) { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "T must extend MessageElement"); auto unique = std::make_unique(std::forward(args)...); diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index ab2b68f6..e20f5f7a 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -55,7 +55,7 @@ const QStringList ZOOM_LEVELS = { void addKeyboardModifierSetting(GeneralPageView &layout, const QString &title, EnumSetting &setting) { - layout.addDropdown::type>( + layout.addDropdown>( title, {"None", "Shift", "Control", "Alt", META_KEY}, setting, [](int index) { switch (index) @@ -216,7 +216,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) return fuzzyToFloat(args.value, 1.f); }); ComboBox *tabDirectionDropdown = - layout.addDropdown::type>( + layout.addDropdown>( "Tab layout", {"Top", "Left", "Right", "Bottom"}, s.tabDirection, [](auto val) { switch (val) @@ -256,7 +256,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) tabDirectionDropdown->setMinimumWidth( tabDirectionDropdown->minimumSizeHint().width()); - layout.addDropdown::type>( + layout.addDropdown>( "Tab visibility", {"All tabs", "Only live tabs"}, s.tabVisibility, [](auto val) { switch (val) @@ -402,7 +402,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) layout.addCheckbox( "Allow sending duplicate messages", s.allowDuplicateMessages, false, "Allow a single message to be repeatedly sent without any changes."); - layout.addDropdown::type>( + layout.addDropdown>( "Message overflow", {"Highlight", "Prevent", "Allow"}, s.messageOverflow, [](auto index) { @@ -414,7 +414,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) false, "Specify how Chatterino will handle messages that exceed Twitch " "message limits"); - layout.addDropdown::type>( + layout.addDropdown>( "Username right-click behavior", { "Reply", @@ -431,7 +431,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) false, "Specify how Chatterino will handle right-clicking a username in " "chat when not holding the modifier."); - layout.addDropdown::type>( + layout.addDropdown>( "Username right-click with modifier behavior", { "Reply", @@ -448,7 +448,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) false, "Specify how Chatterino will handle right-clicking a username in " "chat when holding down the modifier."); - layout.addDropdown::type>( + layout.addDropdown>( "Modifier for alternate right-click action", {"Shift", "Control", "Alt", META_KEY}, s.usernameRightClickModifier, [](int index) { @@ -552,7 +552,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) s.showLastMessageIndicator, false, "Adds an underline below the most recent message " "sent before you tabbed out of Chatterino."); - layout.addDropdown::type>( + layout.addDropdown>( "Line style", {"Dotted", "Solid"}, s.lastMessagePattern, [](int value) { switch (value) @@ -634,7 +634,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) }); }, false); - layout.addDropdown::type>( + layout.addDropdown>( "Show emote & badge thumbnail on hover", { "Don't show", @@ -716,7 +716,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) "change while streaming"); ComboBox *dankDropdown = - layout.addDropdown::type>( + layout.addDropdown>( "Enable Streamer Mode", {"Disabled", "Enabled", "Automatic (Detect streaming software)"}, s.enableStreamerMode, @@ -1240,7 +1240,7 @@ void GeneralPage::initLayout(GeneralPageView &layout) "Username and localized name"}; ComboBox *nameDropdown = - layout.addDropdown::type>( + layout.addDropdown>( "Username style", usernameDisplayModes, s.usernameDisplayMode, [usernameDisplayModes](auto val) { return usernameDisplayModes.at(val - 1);