ran clang-format on all files

This commit is contained in:
fourtf
2018-06-26 17:20:03 +02:00
parent 6ee1fc303e
commit 08e552f5f6
63 changed files with 175 additions and 200 deletions
+11 -11
View File
@@ -1,8 +1,8 @@
#include "providers/bttv/BttvEmotes.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp"
#include "messages/Image.hpp"
#include "common/UrlFetch.hpp"
namespace chatterino {
@@ -37,11 +37,11 @@ void BTTVEmotes::loadGlobalEmotes()
EmoteData emoteData;
emoteData.image1x = new chatterino::Image(getEmoteLink(urlTemplate, id, "1x"), 1, code,
code + "<br />Global BTTV Emote");
emoteData.image2x = new chatterino::Image(getEmoteLink(urlTemplate, id, "2x"), 0.5, code,
code + "<br />Global BTTV Emote");
emoteData.image3x = new chatterino::Image(getEmoteLink(urlTemplate, id, "3x"), 0.25, code,
code + "<br />Global BTTV Emote");
code + "<br />Global BTTV Emote");
emoteData.image2x = new chatterino::Image(getEmoteLink(urlTemplate, id, "2x"), 0.5,
code, code + "<br />Global BTTV Emote");
emoteData.image3x = new chatterino::Image(getEmoteLink(urlTemplate, id, "3x"), 0.25,
code, code + "<br />Global BTTV Emote");
emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id;
this->globalEmotes.insert(code, emoteData);
@@ -91,17 +91,17 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<Emo
link.detach();
emoteData.image1x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "1x"), 1,
code, code + "<br />Channel BTTV Emote");
code, code + "<br />Channel BTTV Emote");
link = linkTemplate;
link.detach();
emoteData.image2x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "2x"), 0.5,
code, code + "<br />Channel BTTV Emote");
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "2x"),
0.5, code, code + "<br />Channel BTTV Emote");
link = linkTemplate;
link.detach();
emoteData.image3x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "3x"), 0.25,
code, code + "<br />Channel BTTV Emote");
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "3x"),
0.25, code, code + "<br />Channel BTTV Emote");
emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id;
return emoteData;
+2 -3
View File
@@ -1,8 +1,8 @@
#pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map>
@@ -18,8 +18,7 @@ public:
std::map<QString, SignalVector<QString>> channelEmoteCodes;
void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName,
std::weak_ptr<EmoteMap> channelEmoteMap);
void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
private:
EmoteMap channelEmoteCache;
+5 -7
View File
@@ -112,7 +112,7 @@ void Emojis::loadEmojis()
if (result.Code() != rapidjson::kParseErrorNone) {
Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
result.Offset());
result.Offset());
return;
}
@@ -266,8 +266,7 @@ void Emojis::loadEmojiSet()
});
}
void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords,
const QString &text)
void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords, const QString &text)
{
int lastParsedEmojiEndIndex = 0;
@@ -328,13 +327,12 @@ void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords,
if (charactersFromLastParsedEmoji > 0) {
// Add characters inbetween emojis
parsedWords.emplace_back(EmoteData(), text.mid(lastParsedEmojiEndIndex,
charactersFromLastParsedEmoji));
parsedWords.emplace_back(
EmoteData(), text.mid(lastParsedEmojiEndIndex, charactersFromLastParsedEmoji));
}
// Push the emoji as a word to parsedWords
parsedWords.push_back(
std::tuple<EmoteData, QString>(matchedEmoji->emoteData, QString()));
parsedWords.push_back(std::tuple<EmoteData, QString>(matchedEmoji->emoteData, QString()));
lastParsedEmojiEndIndex = currentParsedEmojiEndIndex;
+1 -1
View File
@@ -1,8 +1,8 @@
#pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <QMap>
#include <QRegularExpression>
+1 -1
View File
@@ -1,8 +1,8 @@
#include "providers/ffz/FfzEmotes.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp"
#include "messages/Image.hpp"
#include "common/UrlFetch.hpp"
namespace chatterino {
+2 -3
View File
@@ -1,8 +1,8 @@
#pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map>
@@ -18,8 +18,7 @@ public:
std::map<QString, SignalVector<QString>> channelEmoteCodes;
void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName,
std::weak_ptr<EmoteMap> channelEmoteMap);
void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
private:
ConcurrentMap<int, EmoteData> channelEmoteCache;
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include "providers/irc/IrcAccount.hpp"
#include "providers/irc/AbstractIrcServer.hpp"
#include "providers/irc/IrcAccount.hpp"
namespace chatterino {
+2 -3
View File
@@ -140,8 +140,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
auto chan = app->twitch.server->getChannelOrEmpty(chanName);
if (chan->isEmpty()) {
Log("[IrcMessageHandler:handleClearChatMessage] Twitch channel {} not found",
chanName);
Log("[IrcMessageHandler:handleClearChatMessage] Twitch channel {} not found", chanName);
return;
}
@@ -312,7 +311,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
if (channel->isEmpty()) {
Log("[IrcManager:handleNoticeMessage] Channel {} not found in channel manager ",
channelName);
channelName);
return;
}
+5 -6
View File
@@ -507,8 +507,8 @@ void PubSub::unlistenAllModerationActions()
}
}
void PubSub::listenToChannelModerationActions(
const QString &channelID, std::shared_ptr<TwitchAccount> account)
void PubSub::listenToChannelModerationActions(const QString &channelID,
std::shared_ptr<TwitchAccount> account)
{
assert(!channelID.isEmpty());
assert(account != nullptr);
@@ -527,8 +527,7 @@ void PubSub::listenToChannelModerationActions(
this->listenToTopic(topic, account);
}
void PubSub::listenToTopic(const std::string &topic,
std::shared_ptr<TwitchAccount> account)
void PubSub::listenToTopic(const std::string &topic, std::shared_ptr<TwitchAccount> account)
{
auto message = createListenMessage({topic}, account);
@@ -581,7 +580,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl, WebsocketMessagePtr webs
if (!res) {
Log("Error parsing message '{}' from PubSub: {}", payload,
rapidjson::GetParseError_En(res.Code()));
rapidjson::GetParseError_En(res.Code()));
return;
}
@@ -713,7 +712,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!res) {
Log("Error parsing message '{}' from PubSub: {}", payload,
rapidjson::GetParseError_En(res.Code()));
rapidjson::GetParseError_En(res.Code()));
return;
}
+3 -4
View File
@@ -121,14 +121,13 @@ public:
void unlistenAllModerationActions();
void listenToChannelModerationActions(
const QString &channelID, std::shared_ptr<TwitchAccount> account);
void listenToChannelModerationActions(const QString &channelID,
std::shared_ptr<TwitchAccount> account);
std::vector<std::unique_ptr<rapidjson::Document>> requests;
private:
void listenToTopic(const std::string &topic,
std::shared_ptr<TwitchAccount> account);
void listenToTopic(const std::string &topic, std::shared_ptr<TwitchAccount> account);
void listen(rapidjson::Document &&msg);
bool tryListen(rapidjson::Document &msg);
+3 -3
View File
@@ -1,10 +1,10 @@
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/Const.hpp"
#include "debug/Log.hpp"
#include "common/NetworkRequest.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp"
#include "providers/twitch/Const.hpp"
#include "util/RapidjsonHelpers.hpp"
namespace chatterino {
@@ -1,8 +1,8 @@
#include "providers/twitch/TwitchAccountManager.hpp"
#include "common/Common.hpp"
#include "providers/twitch/Const.hpp"
#include "debug/Log.hpp"
#include "providers/twitch/Const.hpp"
namespace chatterino {
@@ -123,11 +123,10 @@ void TwitchAccountManager::load()
auto user = this->findUserByUsername(newUsername);
if (user) {
Log("[AccountManager:currentUsernameChanged] User successfully updated to {}",
newUsername);
newUsername);
this->currentUser = user;
} else {
Log(
"[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
Log("[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
this->currentUser = this->anonymousUser;
}
+5 -5
View File
@@ -1,6 +1,7 @@
#include "providers/twitch/TwitchChannel.hpp"
#include "common/Common.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp"
#include "messages/Message.hpp"
#include "providers/twitch/Pubsub.hpp"
@@ -9,7 +10,6 @@
#include "singletons/IrcManager.hpp"
#include "singletons/SettingsManager.hpp"
#include "util/PostToThread.hpp"
#include "common/UrlFetch.hpp"
#include <IrcConnection>
#include <QThread>
@@ -84,7 +84,7 @@ TwitchChannel::TwitchChannel(const QString &channelName, Communi::IrcConnection
}
twitchApiGet("https://tmi.twitch.tv/group/user/" + this->name + "/chatters",
QThread::currentThread(), refreshChatters);
QThread::currentThread(), refreshChatters);
};
doRefreshChatters();
@@ -145,7 +145,7 @@ void TwitchChannel::sendMessage(const QString &message)
// manager" dialog
this->addMessage(
chatterino::Message::createSystemMessage("You need to log in to send messages. You can "
"link your Twitch account in the settings."));
"link your Twitch account in the settings."));
return;
}
@@ -234,7 +234,7 @@ void TwitchChannel::addJoinedUser(const QString &user)
std::lock_guard<std::mutex> guard(this->joinedUserMutex);
auto message = chatterino::Message::createSystemMessage("Users joined: " +
this->joinedUsers.join(", "));
this->joinedUsers.join(", "));
message->flags |= chatterino::Message::Collapsed;
this->addMessage(message);
this->joinedUsers.clear();
@@ -263,7 +263,7 @@ void TwitchChannel::addPartedUser(const QString &user)
std::lock_guard<std::mutex> guard(this->partedUserMutex);
auto message = chatterino::Message::createSystemMessage("Users parted: " +
this->partedUsers.join(", "));
this->partedUsers.join(", "));
message->flags |= chatterino::Message::Collapsed;
this->addMessage(message);
this->partedUsers.clear();
+1 -1
View File
@@ -4,10 +4,10 @@
#include "common/Channel.hpp"
#include "common/Common.hpp"
#include "common/MutexValue.hpp"
#include "singletons/EmoteManager.hpp"
#include "singletons/IrcManager.hpp"
#include "util/ConcurrentMap.hpp"
#include "common/MutexValue.hpp"
#include <pajlada/signals/signalholder.hpp>
+1 -1
View File
@@ -1,10 +1,10 @@
#pragma once
#include "common/Emotemap.hpp"
#include "providers/twitch/EmoteValue.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchEmotes.hpp"
#include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map>
+1 -2
View File
@@ -32,8 +32,7 @@ void TwitchServer::initialize()
[this]() { postToThread([this] { this->connect(); }); });
}
void TwitchServer::initializeConnection(IrcConnection *connection, bool isRead,
bool isWrite)
void TwitchServer::initializeConnection(IrcConnection *connection, bool isRead, bool isWrite)
{
std::shared_ptr<TwitchAccount> account = getApp()->accounts->twitch.getCurrent();