fix(clang-tidy): modernize-type-traits (#6269)

This commit is contained in:
pajlada
2025-06-15 00:52:21 +02:00
committed by GitHub
parent 6398570bcc
commit 2b89642490
4 changed files with 15 additions and 17 deletions
+2 -3
View File
@@ -63,10 +63,9 @@ using QStringSetting = ChatterinoSetting<QString>;
using QSizeSetting = ChatterinoSetting<QSize>;
template <typename Enum>
class EnumSetting
: public ChatterinoSetting<typename std::underlying_type<Enum>::type>
class EnumSetting : public ChatterinoSetting<std::underlying_type_t<Enum>>
{
using Underlying = typename std::underlying_type<Enum>::type;
using Underlying = std::underlying_type_t<Enum>;
public:
using ChatterinoSetting<Underlying>::ChatterinoSetting;
+1 -2
View File
@@ -85,8 +85,7 @@ public:
return AccessGuard<T>(this->element_, this->mutex_);
}
template <typename X = T,
typename = std::enable_if_t<!std::is_const<X>::value>>
template <typename X = T, typename = std::enable_if_t<!std::is_const_v<X>>>
SharedAccessGuard<const X> accessConst() const
{
return SharedAccessGuard<const T>(this->element_, this->mutex_);
+1 -1
View File
@@ -144,7 +144,7 @@ public:
template <typename T, typename... Args>
T *emplace(Args &&...args)
{
static_assert(std::is_base_of<MessageElement, T>::value,
static_assert(std::is_base_of_v<MessageElement, T>,
"T must extend MessageElement");
auto unique = std::make_unique<T>(std::forward<Args>(args)...);
+11 -11
View File
@@ -55,7 +55,7 @@ const QStringList ZOOM_LEVELS = {
void addKeyboardModifierSetting(GeneralPageView &layout, const QString &title,
EnumSetting<Qt::KeyboardModifier> &setting)
{
layout.addDropdown<std::underlying_type<Qt::KeyboardModifier>::type>(
layout.addDropdown<std::underlying_type_t<Qt::KeyboardModifier>>(
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<std::underlying_type<NotebookTabLocation>::type>(
layout.addDropdown<std::underlying_type_t<NotebookTabLocation>>(
"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<std::underlying_type<NotebookTabVisibility>::type>(
layout.addDropdown<std::underlying_type_t<NotebookTabVisibility>>(
"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<std::underlying_type<MessageOverflow>::type>(
layout.addDropdown<std::underlying_type_t<MessageOverflow>>(
"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<std::underlying_type<UsernameRightClickBehavior>::type>(
layout.addDropdown<std::underlying_type_t<UsernameRightClickBehavior>>(
"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<std::underlying_type<UsernameRightClickBehavior>::type>(
layout.addDropdown<std::underlying_type_t<UsernameRightClickBehavior>>(
"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<std::underlying_type<Qt::KeyboardModifier>::type>(
layout.addDropdown<std::underlying_type_t<Qt::KeyboardModifier>>(
"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<std::underlying_type<Qt::BrushStyle>::type>(
layout.addDropdown<std::underlying_type_t<Qt::BrushStyle>>(
"Line style", {"Dotted", "Solid"}, s.lastMessagePattern,
[](int value) {
switch (value)
@@ -634,7 +634,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
});
},
false);
layout.addDropdown<std::underlying_type<ThumbnailPreviewMode>::type>(
layout.addDropdown<std::underlying_type_t<ThumbnailPreviewMode>>(
"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<std::underlying_type<StreamerModeSetting>::type>(
layout.addDropdown<std::underlying_type_t<StreamerModeSetting>>(
"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<std::underlying_type<UsernameDisplayMode>::type>(
layout.addDropdown<std::underlying_type_t<UsernameDisplayMode>>(
"Username style", usernameDisplayModes, s.usernameDisplayMode,
[usernameDisplayModes](auto val) {
return usernameDisplayModes.at(val - 1);