refactor: fix clang-tidy auto*, const&, and curly braces (#5083)

This commit is contained in:
pajlada
2024-01-14 17:54:52 +01:00
committed by GitHub
parent 292f9b9734
commit 5b6675abb4
78 changed files with 647 additions and 228 deletions
+29 -7
View File
@@ -442,7 +442,9 @@ std::optional<ChannelPointReward> TwitchChannel::channelPointReward(
auto it = rewards->find(rewardId);
if (it == rewards->end())
{
return std::nullopt;
}
return it->second;
}
@@ -572,7 +574,7 @@ void TwitchChannel::roomIdChanged()
QString TwitchChannel::prepareMessage(const QString &message) const
{
auto app = getApp();
auto *app = getApp();
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
parsedMessage = parsedMessage.simplified();
@@ -618,7 +620,7 @@ QString TwitchChannel::prepareMessage(const QString &message) const
void TwitchChannel::sendMessage(const QString &message)
{
auto app = getApp();
auto *app = getApp();
if (!app->accounts->twitch.isLoggedIn())
{
if (!message.isEmpty())
@@ -652,7 +654,7 @@ void TwitchChannel::sendMessage(const QString &message)
void TwitchChannel::sendReply(const QString &message, const QString &replyId)
{
auto app = getApp();
auto *app = getApp();
if (!app->accounts->twitch.isLoggedIn())
{
if (!message.isEmpty())
@@ -803,7 +805,9 @@ std::optional<EmotePtr> TwitchChannel::bttvEmote(const EmoteName &name) const
auto it = emotes->find(name);
if (it == emotes->end())
{
return std::nullopt;
}
return it->second;
}
@@ -813,7 +817,9 @@ std::optional<EmotePtr> TwitchChannel::ffzEmote(const EmoteName &name) const
auto it = emotes->find(name);
if (it == emotes->end())
{
return std::nullopt;
}
return it->second;
}
@@ -1181,11 +1187,15 @@ void TwitchChannel::loadRecentMessages()
[weak](const auto &messages) {
auto shared = weak.lock();
if (!shared)
{
return;
}
auto tc = dynamic_cast<TwitchChannel *>(shared.get());
auto *tc = dynamic_cast<TwitchChannel *>(shared.get());
if (!tc)
{
return;
}
tc->addMessagesAtStart(messages);
tc->loadingRecentMessages_.clear();
@@ -1208,11 +1218,15 @@ void TwitchChannel::loadRecentMessages()
[weak]() {
auto shared = weak.lock();
if (!shared)
{
return;
}
auto tc = dynamic_cast<TwitchChannel *>(shared.get());
auto *tc = dynamic_cast<TwitchChannel *>(shared.get());
if (!tc)
{
return;
}
tc->loadingRecentMessages_.clear();
},
@@ -1253,11 +1267,15 @@ void TwitchChannel::loadRecentMessagesReconnect()
[weak](const auto &messages) {
auto shared = weak.lock();
if (!shared)
{
return;
}
auto tc = dynamic_cast<TwitchChannel *>(shared.get());
auto *tc = dynamic_cast<TwitchChannel *>(shared.get());
if (!tc)
{
return;
}
tc->fillInMissingMessages(messages);
tc->loadingRecentMessages_.clear();
@@ -1265,11 +1283,15 @@ void TwitchChannel::loadRecentMessagesReconnect()
[weak]() {
auto shared = weak.lock();
if (!shared)
{
return;
}
auto tc = dynamic_cast<TwitchChannel *>(shared.get());
auto *tc = dynamic_cast<TwitchChannel *>(shared.get());
if (!tc)
{
return;
}
tc->loadingRecentMessages_.clear();
},