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

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "common/CompletionModel.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "messages/LimitedQueue.hpp" #include "messages/LimitedQueue.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "common/CompletionModel.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include <QString> #include <QString>

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "debug/Log.hpp"
#include "common/NetworkRequester.hpp" #include "common/NetworkRequester.hpp"
#include "common/NetworkWorker.hpp" #include "common/NetworkWorker.hpp"
#include "debug/Log.hpp"
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
@ -50,11 +50,11 @@ public:
worker->moveToThread(&NetworkManager::workerThread); worker->moveToThread(&NetworkManager::workerThread);
QObject::connect( QObject::connect(
&requester, &NetworkRequester::requestUrl, worker, &requester, &NetworkRequester::requestUrl, worker,
[worker, onFinished = std::move(onFinished), request = std::move(request)]() { [ worker, onFinished = std::move(onFinished), request = std::move(request) ]() {
QNetworkReply *reply = NetworkManager::NaM.get(request); QNetworkReply *reply = NetworkManager::NaM.get(request);
reply->connect(reply, &QNetworkReply::finished, reply->connect(reply, &QNetworkReply::finished,
[worker, reply, onFinished = std::move(onFinished)]() { [ worker, reply, onFinished = std::move(onFinished) ]() {
onFinished(reply); onFinished(reply);
delete worker; delete worker;
}); });
@ -110,11 +110,11 @@ public:
worker->moveToThread(&NetworkManager::workerThread); worker->moveToThread(&NetworkManager::workerThread);
QObject::connect( QObject::connect(
&requester, &NetworkRequester::requestUrl, worker, &requester, &NetworkRequester::requestUrl, worker,
[worker, data, onFinished = std::move(onFinished), request = std::move(request)]() { [ worker, data, onFinished = std::move(onFinished), request = std::move(request) ]() {
QNetworkReply *reply = NetworkManager::NaM.put(request, *data); QNetworkReply *reply = NetworkManager::NaM.put(request, *data);
reply->connect(reply, &QNetworkReply::finished, reply->connect(reply, &QNetworkReply::finished,
[worker, reply, onFinished = std::move(onFinished)]() { [ worker, reply, onFinished = std::move(onFinished) ]() {
onFinished(reply); onFinished(reply);
delete worker; delete worker;
}); });
@ -132,11 +132,11 @@ public:
worker->moveToThread(&NetworkManager::workerThread); worker->moveToThread(&NetworkManager::workerThread);
QObject::connect( QObject::connect(
&requester, &NetworkRequester::requestUrl, worker, &requester, &NetworkRequester::requestUrl, worker,
[onFinished = std::move(onFinished), request = std::move(request), worker]() { [ onFinished = std::move(onFinished), request = std::move(request), worker ]() {
QNetworkReply *reply = NetworkManager::NaM.put(request, ""); QNetworkReply *reply = NetworkManager::NaM.put(request, "");
reply->connect(reply, &QNetworkReply::finished, reply->connect(reply, &QNetworkReply::finished,
[onFinished = std::move(onFinished), reply, worker]() { [ onFinished = std::move(onFinished), reply, worker ]() {
onFinished(reply); onFinished(reply);
delete worker; delete worker;
}); });
@ -154,11 +154,11 @@ public:
worker->moveToThread(&NetworkManager::workerThread); worker->moveToThread(&NetworkManager::workerThread);
QObject::connect( QObject::connect(
&requester, &NetworkRequester::requestUrl, worker, &requester, &NetworkRequester::requestUrl, worker,
[onFinished = std::move(onFinished), request = std::move(request), worker]() { [ onFinished = std::move(onFinished), request = std::move(request), worker ]() {
QNetworkReply *reply = NetworkManager::NaM.deleteResource(request); QNetworkReply *reply = NetworkManager::NaM.deleteResource(request);
reply->connect(reply, &QNetworkReply::finished, reply->connect(reply, &QNetworkReply::finished,
[onFinished = std::move(onFinished), reply, worker]() { [ onFinished = std::move(onFinished), reply, worker ]() {
onFinished(reply); onFinished(reply);
delete worker; delete worker;
}); });

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "Application.hpp" #include "Application.hpp"
#include "singletons/PathManager.hpp"
#include "common/NetworkManager.hpp" #include "common/NetworkManager.hpp"
#include "common/NetworkRequester.hpp" #include "common/NetworkRequester.hpp"
#include "common/NetworkWorker.hpp" #include "common/NetworkWorker.hpp"
#include "singletons/PathManager.hpp"
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <rapidjson/error/en.h> #include <rapidjson/error/en.h>
@ -32,7 +32,7 @@ static rapidjson::Document parseJSONFromData2(const QByteArray &data)
if (result.Code() != rapidjson::kParseErrorNone) { if (result.Code() != rapidjson::kParseErrorNone) {
Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()), Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
result.Offset()); result.Offset());
return ret; return ret;
} }
@ -52,7 +52,7 @@ static rapidjson::Document parseJSONFromReply2(QNetworkReply *reply)
if (result.Code() != rapidjson::kParseErrorNone) { if (result.Code() != rapidjson::kParseErrorNone) {
Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()), Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
result.Offset()); result.Offset());
return ret; return ret;
} }
@ -215,7 +215,7 @@ public:
if (this->data.caller != nullptr) { if (this->data.caller != nullptr) {
QObject::connect(worker, &NetworkWorker::doneUrl, this->data.caller, QObject::connect(worker, &NetworkWorker::doneUrl, this->data.caller,
[onFinished, data = this->data](auto reply) mutable { [ onFinished, data = this->data ](auto reply) mutable {
if (reply->error() != QNetworkReply::NetworkError::NoError) { if (reply->error() != QNetworkReply::NetworkError::NoError) {
// TODO: We might want to call an onError callback here // TODO: We might want to call an onError callback here
return; return;
@ -237,7 +237,7 @@ public:
QObject::connect( QObject::connect(
&requester, &NetworkRequester::requestUrl, worker, &requester, &NetworkRequester::requestUrl, worker,
[timer, data = std::move(this->data), worker, onFinished{std::move(onFinished)}]() { [ timer, data = std::move(this->data), worker, onFinished{std::move(onFinished)} ]() {
QNetworkReply *reply = NetworkManager::NaM.get(data.request); QNetworkReply *reply = NetworkManager::NaM.get(data.request);
if (timer != nullptr) { if (timer != nullptr) {
@ -252,21 +252,21 @@ public:
data.onReplyCreated(reply); data.onReplyCreated(reply);
} }
QObject::connect(reply, &QNetworkReply::finished, worker, QObject::connect(reply, &QNetworkReply::finished, worker, [
[data = std::move(data), worker, reply, data = std::move(data), worker, reply, onFinished = std::move(onFinished)
onFinished = std::move(onFinished)]() mutable { ]() mutable {
if (data.caller == nullptr) { if (data.caller == nullptr) {
QByteArray bytes = reply->readAll(); QByteArray bytes = reply->readAll();
data.writeToCache(bytes); data.writeToCache(bytes);
onFinished(bytes); onFinished(bytes);
reply->deleteLater(); reply->deleteLater();
} else { } else {
emit worker->doneUrl(reply); emit worker->doneUrl(reply);
} }
delete worker; delete worker;
}); });
}); });
emit requester.requestUrl(); emit requester.requestUrl();
@ -275,7 +275,7 @@ public:
template <typename FinishedCallback> template <typename FinishedCallback>
void getJSON(FinishedCallback onFinished) void getJSON(FinishedCallback onFinished)
{ {
this->get([onFinished{std::move(onFinished)}](const QByteArray &bytes) -> bool { this->get([onFinished{std::move(onFinished)}](const QByteArray &bytes)->bool {
auto object = parseJSONFromData(bytes); auto object = parseJSONFromData(bytes);
onFinished(object); onFinished(object);
@ -288,7 +288,7 @@ public:
template <typename FinishedCallback> template <typename FinishedCallback>
void getJSON2(FinishedCallback onFinished) void getJSON2(FinishedCallback onFinished)
{ {
this->get([onFinished{std::move(onFinished)}](const QByteArray &bytes) -> bool { this->get([onFinished{std::move(onFinished)}](const QByteArray &bytes)->bool {
auto object = parseJSONFromData2(bytes); auto object = parseJSONFromData2(bytes);
onFinished(object); onFinished(object);
@ -366,8 +366,8 @@ private:
worker->moveToThread(&NetworkManager::workerThread); worker->moveToThread(&NetworkManager::workerThread);
if (this->data.caller != nullptr) { if (this->data.caller != nullptr) {
QObject::connect(worker, &NetworkWorker::doneUrl, this->data.caller, QObject::connect(worker, &NetworkWorker::doneUrl,
[data = this->data](auto reply) mutable { this->data.caller, [data = this->data](auto reply) mutable {
if (reply->error() != QNetworkReply::NetworkError::NoError) { if (reply->error() != QNetworkReply::NetworkError::NoError) {
if (data.onError) { if (data.onError) {
data.onError(reply->error()); data.onError(reply->error());
@ -390,7 +390,7 @@ private:
} }
QObject::connect(&requester, &NetworkRequester::requestUrl, worker, QObject::connect(&requester, &NetworkRequester::requestUrl, worker,
[timer, data = std::move(this->data), worker]() { [ timer, data = std::move(this->data), worker ]() {
QNetworkReply *reply = nullptr; QNetworkReply *reply = nullptr;
switch (data.requestType) { switch (data.requestType) {
case GetRequest: { case GetRequest: {
@ -426,7 +426,7 @@ private:
} }
QObject::connect(reply, &QNetworkReply::finished, worker, QObject::connect(reply, &QNetworkReply::finished, worker,
[data = std::move(data), worker, reply]() mutable { [ data = std::move(data), worker, reply ]() mutable {
if (data.caller == nullptr) { if (data.caller == nullptr) {
QByteArray bytes = reply->readAll(); QByteArray bytes = reply->readAll();
data.writeToCache(bytes); data.writeToCache(bytes);

View file

@ -3,5 +3,4 @@
namespace chatterino { namespace chatterino {
enum class ProviderId { Twitch }; enum class ProviderId { Twitch };
} }

View file

@ -2,10 +2,10 @@
#include <QObject> #include <QObject>
#include "common/SignalVector2.hpp"
#include "controllers/accounts/Account.hpp" #include "controllers/accounts/Account.hpp"
#include "providers/twitch/TwitchAccountManager.hpp" #include "providers/twitch/TwitchAccountManager.hpp"
#include "util/SharedPtrElementLess.hpp" #include "util/SharedPtrElementLess.hpp"
#include "common/SignalVector2.hpp"
namespace chatterino { namespace chatterino {
@ -23,8 +23,7 @@ public:
TwitchAccountManager twitch; TwitchAccountManager twitch;
private: private:
SortedSignalVector<std::shared_ptr<Account>, SharedPtrElementLess<Account>> SortedSignalVector<std::shared_ptr<Account>, SharedPtrElementLess<Account>> accounts;
accounts;
}; };
} // namespace chatterino } // namespace chatterino

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/accounts/Account.hpp" #include "controllers/accounts/Account.hpp"
#include "util/QstringHash.hpp" #include "util/QstringHash.hpp"
#include "common/SignalVectorModel.hpp"
#include <unordered_map> #include <unordered_map>

View file

@ -4,13 +4,12 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include "controllers/commands/Command.hpp"
#include "common/SignalVector2.hpp" #include "common/SignalVector2.hpp"
#include "controllers/commands/Command.hpp"
namespace chatterino { namespace chatterino {
class Channel; class Channel;
class CommandModel; class CommandModel;
class CommandController class CommandController

View file

@ -2,8 +2,8 @@
#include <QObject> #include <QObject>
#include "controllers/commands/Command.hpp"
#include "common/SignalVectorModel.hpp" #include "common/SignalVectorModel.hpp"
#include "controllers/commands/Command.hpp"
namespace chatterino { namespace chatterino {

View file

@ -2,8 +2,8 @@
#include <QObject> #include <QObject>
#include "controllers/highlights/HighlightPhrase.hpp"
#include "common/SignalVectorModel.hpp" #include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "util/RapidjsonHelpers.hpp"
#include "common/SerializeCustom.hpp" #include "common/SerializeCustom.hpp"
#include "util/RapidjsonHelpers.hpp"
#include <QRegularExpression> #include <QRegularExpression>
#include <QString> #include <QString>
@ -94,8 +94,7 @@ struct Deserialize<chatterino::HighlightPhrase> {
static chatterino::HighlightPhrase get(const rapidjson::Value &value) static chatterino::HighlightPhrase get(const rapidjson::Value &value)
{ {
if (!value.IsObject()) { if (!value.IsObject()) {
return chatterino::HighlightPhrase(QString(), true, false, return chatterino::HighlightPhrase(QString(), true, false, false);
false);
} }
QString _pattern; QString _pattern;
@ -108,8 +107,7 @@ struct Deserialize<chatterino::HighlightPhrase> {
chatterino::rj::getSafe(value, "sound", _sound); chatterino::rj::getSafe(value, "sound", _sound);
chatterino::rj::getSafe(value, "regex", _isRegex); chatterino::rj::getSafe(value, "regex", _isRegex);
return chatterino::HighlightPhrase(_pattern, _alert, _sound, return chatterino::HighlightPhrase(_pattern, _alert, _sound, _isRegex);
_isRegex);
} }
}; };

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/SignalVector2.hpp"
#include "controllers/ignores/IgnorePhrase.hpp" #include "controllers/ignores/IgnorePhrase.hpp"
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "common/SignalVector2.hpp"
namespace chatterino { namespace chatterino {
@ -20,8 +20,7 @@ public:
private: private:
bool initialized = false; bool initialized = false;
chatterino::ChatterinoSetting<std::vector<IgnorePhrase>> ignoresSetting = { chatterino::ChatterinoSetting<std::vector<IgnorePhrase>> ignoresSetting = {"/ignore/phrases"};
"/ignore/phrases"};
}; };
} // namespace chatterino } // namespace chatterino

View file

@ -2,8 +2,8 @@
#include <QObject> #include <QObject>
#include "controllers/ignores/IgnorePhrase.hpp"
#include "common/SignalVectorModel.hpp" #include "common/SignalVectorModel.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "util/RapidjsonHelpers.hpp"
#include "common/SerializeCustom.hpp" #include "common/SerializeCustom.hpp"
#include "util/RapidjsonHelpers.hpp"
#include <QRegularExpression> #include <QRegularExpression>
#include <QString> #include <QString>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "controllers/taggedusers/TaggedUser.hpp"
#include "common/SignalVector2.hpp" #include "common/SignalVector2.hpp"
#include "controllers/taggedusers/TaggedUser.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "controllers/taggedusers/TaggedUser.hpp"
#include "common/SignalVectorModel.hpp" #include "common/SignalVectorModel.hpp"
#include "controllers/taggedusers/TaggedUser.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/FlagsEnum.hpp"
#include "messages/MessageElement.hpp" #include "messages/MessageElement.hpp"
#include "providers/twitch/PubsubActions.hpp" #include "providers/twitch/PubsubActions.hpp"
#include "common/FlagsEnum.hpp"
#include "widgets/helper/ScrollbarHighlight.hpp" #include "widgets/helper/ScrollbarHighlight.hpp"
#include <QTime> #include <QTime>
@ -74,8 +74,7 @@ public:
static std::shared_ptr<Message> createTimeoutMessage(const BanAction &action, static std::shared_ptr<Message> createTimeoutMessage(const BanAction &action,
uint32_t count = 1); uint32_t count = 1);
static std::shared_ptr<Message> createUntimeoutMessage( static std::shared_ptr<Message> createUntimeoutMessage(const UnbanAction &action);
const UnbanAction &action);
}; };
using MessagePtr = std::shared_ptr<Message>; using MessagePtr = std::shared_ptr<Message>;

View file

@ -1,11 +1,11 @@
#include "messages/MessageElement.hpp" #include "messages/MessageElement.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/Emotemap.hpp"
#include "debug/Benchmark.hpp"
#include "messages/layouts/MessageLayoutContainer.hpp" #include "messages/layouts/MessageLayoutContainer.hpp"
#include "messages/layouts/MessageLayoutElement.hpp" #include "messages/layouts/MessageLayoutElement.hpp"
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "debug/Benchmark.hpp"
#include "common/Emotemap.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,10 +1,10 @@
#include "messages/layouts/MessageLayout.hpp" #include "messages/layouts/MessageLayout.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "debug/Benchmark.hpp"
#include "singletons/EmoteManager.hpp" #include "singletons/EmoteManager.hpp"
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "debug/Benchmark.hpp"
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "messages/layouts/MessageLayoutContainer.hpp" #include "common/FlagsEnum.hpp"
#include "messages/layouts/MessageLayoutElement.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "messages/Selection.hpp" #include "messages/Selection.hpp"
#include "common/FlagsEnum.hpp" #include "messages/layouts/MessageLayoutContainer.hpp"
#include "messages/layouts/MessageLayoutElement.hpp"
#include <QPixmap> #include <QPixmap>

View file

@ -1,8 +1,8 @@
#include "providers/bttv/BttvEmotes.hpp" #include "providers/bttv/BttvEmotes.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "common/UrlFetch.hpp"
namespace chatterino { namespace chatterino {
@ -37,11 +37,11 @@ void BTTVEmotes::loadGlobalEmotes()
EmoteData emoteData; EmoteData emoteData;
emoteData.image1x = new chatterino::Image(getEmoteLink(urlTemplate, id, "1x"), 1, code, emoteData.image1x = new chatterino::Image(getEmoteLink(urlTemplate, id, "1x"), 1, code,
code + "<br />Global BTTV Emote"); code + "<br />Global BTTV Emote");
emoteData.image2x = new chatterino::Image(getEmoteLink(urlTemplate, id, "2x"), 0.5, code, emoteData.image2x = new chatterino::Image(getEmoteLink(urlTemplate, id, "2x"), 0.5,
code + "<br />Global BTTV Emote"); code, code + "<br />Global BTTV Emote");
emoteData.image3x = new chatterino::Image(getEmoteLink(urlTemplate, id, "3x"), 0.25, code, emoteData.image3x = new chatterino::Image(getEmoteLink(urlTemplate, id, "3x"), 0.25,
code + "<br />Global BTTV Emote"); code, code + "<br />Global BTTV Emote");
emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id; emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id;
this->globalEmotes.insert(code, emoteData); this->globalEmotes.insert(code, emoteData);
@ -91,17 +91,17 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<Emo
link.detach(); link.detach();
emoteData.image1x = emoteData.image1x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "1x"), 1, 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 = linkTemplate;
link.detach(); link.detach();
emoteData.image2x = emoteData.image2x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "2x"), 0.5, new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "2x"),
code, code + "<br />Channel BTTV Emote"); 0.5, code, code + "<br />Channel BTTV Emote");
link = linkTemplate; link = linkTemplate;
link.detach(); link.detach();
emoteData.image3x = emoteData.image3x =
new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "3x"), 0.25, new chatterino::Image(link.replace("{{id}}", id).replace("{{image}}", "3x"),
code, code + "<br />Channel BTTV Emote"); 0.25, code, code + "<br />Channel BTTV Emote");
emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id; emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id;
return emoteData; return emoteData;

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp" #include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map> #include <map>
@ -18,8 +18,7 @@ public:
std::map<QString, SignalVector<QString>> channelEmoteCodes; std::map<QString, SignalVector<QString>> channelEmoteCodes;
void loadGlobalEmotes(); void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName, void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
std::weak_ptr<EmoteMap> channelEmoteMap);
private: private:
EmoteMap channelEmoteCache; EmoteMap channelEmoteCache;

View file

@ -112,7 +112,7 @@ void Emojis::loadEmojis()
if (result.Code() != rapidjson::kParseErrorNone) { if (result.Code() != rapidjson::kParseErrorNone) {
Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()), Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
result.Offset()); result.Offset());
return; return;
} }
@ -266,8 +266,7 @@ void Emojis::loadEmojiSet()
}); });
} }
void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords, void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords, const QString &text)
const QString &text)
{ {
int lastParsedEmojiEndIndex = 0; int lastParsedEmojiEndIndex = 0;
@ -328,13 +327,12 @@ void Emojis::parse(std::vector<std::tuple<EmoteData, QString>> &parsedWords,
if (charactersFromLastParsedEmoji > 0) { if (charactersFromLastParsedEmoji > 0) {
// Add characters inbetween emojis // Add characters inbetween emojis
parsedWords.emplace_back(EmoteData(), text.mid(lastParsedEmojiEndIndex, parsedWords.emplace_back(
charactersFromLastParsedEmoji)); EmoteData(), text.mid(lastParsedEmojiEndIndex, charactersFromLastParsedEmoji));
} }
// Push the emoji as a word to parsedWords // Push the emoji as a word to parsedWords
parsedWords.push_back( parsedWords.push_back(std::tuple<EmoteData, QString>(matchedEmoji->emoteData, QString()));
std::tuple<EmoteData, QString>(matchedEmoji->emoteData, QString()));
lastParsedEmojiEndIndex = currentParsedEmojiEndIndex; lastParsedEmojiEndIndex = currentParsedEmojiEndIndex;

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp" #include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <QMap> #include <QMap>
#include <QRegularExpression> #include <QRegularExpression>

View file

@ -1,8 +1,8 @@
#include "providers/ffz/FfzEmotes.hpp" #include "providers/ffz/FfzEmotes.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "common/UrlFetch.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "common/Emotemap.hpp"
#include "common/SignalVector.hpp" #include "common/SignalVector.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map> #include <map>
@ -18,8 +18,7 @@ public:
std::map<QString, SignalVector<QString>> channelEmoteCodes; std::map<QString, SignalVector<QString>> channelEmoteCodes;
void loadGlobalEmotes(); void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName, void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
std::weak_ptr<EmoteMap> channelEmoteMap);
private: private:
ConcurrentMap<int, EmoteData> channelEmoteCache; ConcurrentMap<int, EmoteData> channelEmoteCache;

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "providers/irc/IrcAccount.hpp"
#include "providers/irc/AbstractIrcServer.hpp" #include "providers/irc/AbstractIrcServer.hpp"
#include "providers/irc/IrcAccount.hpp"
namespace chatterino { namespace chatterino {

View file

@ -140,8 +140,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
auto chan = app->twitch.server->getChannelOrEmpty(chanName); auto chan = app->twitch.server->getChannelOrEmpty(chanName);
if (chan->isEmpty()) { if (chan->isEmpty()) {
Log("[IrcMessageHandler:handleClearChatMessage] Twitch channel {} not found", Log("[IrcMessageHandler:handleClearChatMessage] Twitch channel {} not found", chanName);
chanName);
return; return;
} }
@ -312,7 +311,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
if (channel->isEmpty()) { if (channel->isEmpty()) {
Log("[IrcManager:handleNoticeMessage] Channel {} not found in channel manager ", Log("[IrcManager:handleNoticeMessage] Channel {} not found in channel manager ",
channelName); channelName);
return; return;
} }

View file

@ -507,8 +507,8 @@ void PubSub::unlistenAllModerationActions()
} }
} }
void PubSub::listenToChannelModerationActions( void PubSub::listenToChannelModerationActions(const QString &channelID,
const QString &channelID, std::shared_ptr<TwitchAccount> account) std::shared_ptr<TwitchAccount> account)
{ {
assert(!channelID.isEmpty()); assert(!channelID.isEmpty());
assert(account != nullptr); assert(account != nullptr);
@ -527,8 +527,7 @@ void PubSub::listenToChannelModerationActions(
this->listenToTopic(topic, account); this->listenToTopic(topic, account);
} }
void PubSub::listenToTopic(const std::string &topic, void PubSub::listenToTopic(const std::string &topic, std::shared_ptr<TwitchAccount> account)
std::shared_ptr<TwitchAccount> account)
{ {
auto message = createListenMessage({topic}, account); auto message = createListenMessage({topic}, account);
@ -581,7 +580,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl, WebsocketMessagePtr webs
if (!res) { if (!res) {
Log("Error parsing message '{}' from PubSub: {}", payload, Log("Error parsing message '{}' from PubSub: {}", payload,
rapidjson::GetParseError_En(res.Code())); rapidjson::GetParseError_En(res.Code()));
return; return;
} }
@ -713,7 +712,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
if (!res) { if (!res) {
Log("Error parsing message '{}' from PubSub: {}", payload, Log("Error parsing message '{}' from PubSub: {}", payload,
rapidjson::GetParseError_En(res.Code())); rapidjson::GetParseError_En(res.Code()));
return; return;
} }

View file

@ -121,14 +121,13 @@ public:
void unlistenAllModerationActions(); void unlistenAllModerationActions();
void listenToChannelModerationActions( void listenToChannelModerationActions(const QString &channelID,
const QString &channelID, std::shared_ptr<TwitchAccount> account); std::shared_ptr<TwitchAccount> account);
std::vector<std::unique_ptr<rapidjson::Document>> requests; std::vector<std::unique_ptr<rapidjson::Document>> requests;
private: private:
void listenToTopic(const std::string &topic, void listenToTopic(const std::string &topic, std::shared_ptr<TwitchAccount> account);
std::shared_ptr<TwitchAccount> account);
void listen(rapidjson::Document &&msg); void listen(rapidjson::Document &&msg);
bool tryListen(rapidjson::Document &msg); bool tryListen(rapidjson::Document &msg);

View file

@ -1,10 +1,10 @@
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/Const.hpp"
#include "debug/Log.hpp"
#include "common/NetworkRequest.hpp" #include "common/NetworkRequest.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "common/UrlFetch.hpp" #include "common/UrlFetch.hpp"
#include "debug/Log.hpp"
#include "providers/twitch/Const.hpp"
#include "util/RapidjsonHelpers.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,8 +1,8 @@
#include "providers/twitch/TwitchAccountManager.hpp" #include "providers/twitch/TwitchAccountManager.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "providers/twitch/Const.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "providers/twitch/Const.hpp"
namespace chatterino { namespace chatterino {
@ -123,11 +123,10 @@ void TwitchAccountManager::load()
auto user = this->findUserByUsername(newUsername); auto user = this->findUserByUsername(newUsername);
if (user) { if (user) {
Log("[AccountManager:currentUsernameChanged] User successfully updated to {}", Log("[AccountManager:currentUsernameChanged] User successfully updated to {}",
newUsername); newUsername);
this->currentUser = user; this->currentUser = user;
} else { } else {
Log( Log("[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
"[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
this->currentUser = this->anonymousUser; this->currentUser = this->anonymousUser;
} }

View file

@ -1,6 +1,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "providers/twitch/Pubsub.hpp" #include "providers/twitch/Pubsub.hpp"
@ -9,7 +10,6 @@
#include "singletons/IrcManager.hpp" #include "singletons/IrcManager.hpp"
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"
#include "common/UrlFetch.hpp"
#include <IrcConnection> #include <IrcConnection>
#include <QThread> #include <QThread>
@ -84,7 +84,7 @@ TwitchChannel::TwitchChannel(const QString &channelName, Communi::IrcConnection
} }
twitchApiGet("https://tmi.twitch.tv/group/user/" + this->name + "/chatters", twitchApiGet("https://tmi.twitch.tv/group/user/" + this->name + "/chatters",
QThread::currentThread(), refreshChatters); QThread::currentThread(), refreshChatters);
}; };
doRefreshChatters(); doRefreshChatters();
@ -145,7 +145,7 @@ void TwitchChannel::sendMessage(const QString &message)
// manager" dialog // manager" dialog
this->addMessage( this->addMessage(
chatterino::Message::createSystemMessage("You need to log in to send messages. You can " 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; return;
} }
@ -234,7 +234,7 @@ void TwitchChannel::addJoinedUser(const QString &user)
std::lock_guard<std::mutex> guard(this->joinedUserMutex); std::lock_guard<std::mutex> guard(this->joinedUserMutex);
auto message = chatterino::Message::createSystemMessage("Users joined: " + auto message = chatterino::Message::createSystemMessage("Users joined: " +
this->joinedUsers.join(", ")); this->joinedUsers.join(", "));
message->flags |= chatterino::Message::Collapsed; message->flags |= chatterino::Message::Collapsed;
this->addMessage(message); this->addMessage(message);
this->joinedUsers.clear(); this->joinedUsers.clear();
@ -263,7 +263,7 @@ void TwitchChannel::addPartedUser(const QString &user)
std::lock_guard<std::mutex> guard(this->partedUserMutex); std::lock_guard<std::mutex> guard(this->partedUserMutex);
auto message = chatterino::Message::createSystemMessage("Users parted: " + auto message = chatterino::Message::createSystemMessage("Users parted: " +
this->partedUsers.join(", ")); this->partedUsers.join(", "));
message->flags |= chatterino::Message::Collapsed; message->flags |= chatterino::Message::Collapsed;
this->addMessage(message); this->addMessage(message);
this->partedUsers.clear(); this->partedUsers.clear();

View file

@ -4,10 +4,10 @@
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/MutexValue.hpp"
#include "singletons/EmoteManager.hpp" #include "singletons/EmoteManager.hpp"
#include "singletons/IrcManager.hpp" #include "singletons/IrcManager.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include "common/MutexValue.hpp"
#include <pajlada/signals/signalholder.hpp> #include <pajlada/signals/signalholder.hpp>

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "common/Emotemap.hpp"
#include "providers/twitch/EmoteValue.hpp" #include "providers/twitch/EmoteValue.hpp"
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchEmotes.hpp" #include "providers/twitch/TwitchEmotes.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include "common/Emotemap.hpp"
#include <map> #include <map>

View file

@ -32,8 +32,7 @@ void TwitchServer::initialize()
[this]() { postToThread([this] { this->connect(); }); }); [this]() { postToThread([this] { this->connect(); }); });
} }
void TwitchServer::initializeConnection(IrcConnection *connection, bool isRead, void TwitchServer::initializeConnection(IrcConnection *connection, bool isRead, bool isWrite)
bool isWrite)
{ {
std::shared_ptr<TwitchAccount> account = getApp()->accounts->twitch.getCurrent(); std::shared_ptr<TwitchAccount> account = getApp()->accounts->twitch.getCurrent();

View file

@ -4,8 +4,8 @@
#include <QtGlobal> #include <QtGlobal>
#include "Application.hpp" #include "Application.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "WindowManager.hpp" #include "WindowManager.hpp"
#include "debug/AssertInGuiThread.hpp"
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#define DEFAULT_FONT_FAMILY "Segoe UI" #define DEFAULT_FONT_FAMILY "Segoe UI"

View file

@ -22,7 +22,7 @@
//#include <future> //#include <future>
//using namespace chatterino::messages; // using namespace chatterino::messages;
// void IrcManager::refreshIgnoredUsers(const QString &username, const QString &oauthClient, // void IrcManager::refreshIgnoredUsers(const QString &username, const QString &oauthClient,
// const QString &oauthToken) // const QString &oauthToken)

View file

@ -75,9 +75,9 @@ void UpdateManager::installUpdates()
return false; return false;
} }
QProcess::startDetached(combinePath(QCoreApplication::applicationDirPath(), QProcess::startDetached(
"updater.1/ChatterinoUpdater.exe"), combinePath(QCoreApplication::applicationDirPath(), "updater.1/ChatterinoUpdater.exe"),
{filename, "restart"}); {filename, "restart"});
QApplication::exit(0); QApplication::exit(0);
return false; return false;

View file

@ -1,12 +1,12 @@
#include "WindowManager.hpp" #include "WindowManager.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/FontManager.hpp" #include "singletons/FontManager.hpp"
#include "singletons/PathManager.hpp" #include "singletons/PathManager.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "util/Clamp.hpp" #include "util/Clamp.hpp"
#include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/AccountSwitchPopupWidget.hpp"
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"
@ -169,8 +169,7 @@ void WindowManager::initialize()
// get type // get type
QString type_val = window_obj.value("type").toString(); QString type_val = window_obj.value("type").toString();
Window::WindowType type = Window::WindowType type = type_val == "main" ? Window::Main : Window::Popup;
type_val == "main" ? Window::Main : Window::Popup;
if (type == Window::Main && mainWindow != nullptr) { if (type == Window::Main && mainWindow != nullptr) {
type = Window::Popup; type = Window::Popup;

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "widgets/splits/SplitContainer.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"
#include "widgets/splits/SplitContainer.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,8 +1,8 @@
#include "AccountSwitchWidget.hpp" #include "AccountSwitchWidget.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "providers/twitch/Const.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/Const.hpp"
namespace chatterino { namespace chatterino {

View file

@ -4,12 +4,12 @@
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "widgets/Window.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/helper/NotebookButton.hpp" #include "widgets/helper/NotebookButton.hpp"
#include "widgets/helper/NotebookTab.hpp" #include "widgets/helper/NotebookTab.hpp"
#include "widgets/helper/Shortcut.hpp" #include "widgets/helper/Shortcut.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include "widgets/Window.hpp"
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>

View file

@ -16,7 +16,8 @@ QualityPopup::QualityPopup(const QString &_channelName, QStringList options)
&QualityPopup::cancelButtonClicked); &QualityPopup::cancelButtonClicked);
this->ui_.buttonBox.addButton(&this->ui_.okButton, QDialogButtonBox::ButtonRole::AcceptRole); this->ui_.buttonBox.addButton(&this->ui_.okButton, QDialogButtonBox::ButtonRole::AcceptRole);
this->ui_.buttonBox.addButton(&this->ui_.cancelButton, QDialogButtonBox::ButtonRole::RejectRole); this->ui_.buttonBox.addButton(&this->ui_.cancelButton,
QDialogButtonBox::ButtonRole::RejectRole);
this->ui_.selector.addItems(options); this->ui_.selector.addItems(options);

View file

@ -1,14 +1,14 @@
#include "UserInfoPopup.hpp" #include "UserInfoPopup.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/UrlFetch.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "singletons/ResourceManager.hpp" #include "singletons/ResourceManager.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"
#include "common/UrlFetch.hpp" #include "widgets/Label.hpp"
#include "widgets/helper/Line.hpp" #include "widgets/helper/Line.hpp"
#include "widgets/helper/RippleEffectLabel.hpp" #include "widgets/helper/RippleEffectLabel.hpp"
#include "widgets/Label.hpp"
#include <QCheckBox> #include <QCheckBox>
#include <QDesktopServices> #include <QDesktopServices>
@ -86,8 +86,7 @@ UserInfoPopup::UserInfoPopup()
// userstate // userstate
this->userStateChanged.connect([this, mod, unmod]() mutable { this->userStateChanged.connect([this, mod, unmod]() mutable {
TwitchChannel *twitchChannel = TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
dynamic_cast<TwitchChannel *>(this->channel_.get());
if (twitchChannel) { if (twitchChannel) {
qDebug() << this->userName_; qDebug() << this->userName_;
@ -111,8 +110,7 @@ UserInfoPopup::UserInfoPopup()
auto timeout = moderation.emplace<TimeoutWidget>(); auto timeout = moderation.emplace<TimeoutWidget>();
this->userStateChanged.connect([this, lineMod, timeout]() mutable { this->userStateChanged.connect([this, lineMod, timeout]() mutable {
TwitchChannel *twitchChannel = TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
dynamic_cast<TwitchChannel *>(this->channel_.get());
if (twitchChannel) { if (twitchChannel) {
lineMod->setVisible(twitchChannel->hasModRights()); lineMod->setVisible(twitchChannel->hasModRights());
@ -171,8 +169,7 @@ void UserInfoPopup::installEvents()
this->ui_.follow->setEnabled(false); this->ui_.follow->setEnabled(false);
if (this->ui_.follow->isChecked()) { if (this->ui_.follow->isChecked()) {
twitchApiPut(requestUrl, twitchApiPut(requestUrl, [this](QJsonObject) { this->ui_.follow->setEnabled(true); });
[this](QJsonObject) { this->ui_.follow->setEnabled(true); });
} else { } else {
twitchApiDelete(requestUrl, [this] { this->ui_.follow->setEnabled(true); }); twitchApiDelete(requestUrl, [this] { this->ui_.follow->setEnabled(true); });
} }
@ -306,8 +303,7 @@ void UserInfoPopup::loadAvatar(const QUrl &url)
UserInfoPopup::TimeoutWidget::TimeoutWidget() UserInfoPopup::TimeoutWidget::TimeoutWidget()
: BaseWidget(nullptr) : BaseWidget(nullptr)
{ {
auto layout = auto layout = LayoutCreator<TimeoutWidget>(this).setLayoutType<QHBoxLayout>().withoutMargin();
LayoutCreator<TimeoutWidget>(this).setLayoutType<QHBoxLayout>().withoutMargin();
QColor color1(255, 255, 255, 80); QColor color1(255, 255, 255, 80);
QColor color2(255, 255, 255, 0); QColor color2(255, 255, 255, 0);

View file

@ -1,19 +1,19 @@
#include "ChannelView.hpp" #include "ChannelView.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "debug/Benchmark.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "messages/LimitedQueueSnapshot.hpp" #include "messages/LimitedQueueSnapshot.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "debug/Benchmark.hpp"
#include "util/DistanceBetweenPoints.hpp" #include "util/DistanceBetweenPoints.hpp"
#include "widgets/splits/Split.hpp"
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp" #include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/splits/Split.hpp"
#include <QClipboard> #include <QClipboard>
#include <QDebug> #include <QDebug>
@ -271,7 +271,8 @@ QString ChannelView::getSelectedText()
{ {
QString result = ""; QString result = "";
chatterino::LimitedQueueSnapshot<MessageLayoutPtr> messagesSnapshot = this->getMessagesSnapshot(); chatterino::LimitedQueueSnapshot<MessageLayoutPtr> messagesSnapshot =
this->getMessagesSnapshot();
Selection _selection = this->selection_; Selection _selection = this->selection_;
@ -436,7 +437,7 @@ void ChannelView::setChannel(ChannelPtr newChannel)
auto snapshot = this->messages.getSnapshot(); auto snapshot = this->messages.getSnapshot();
if (index >= snapshot.getLength()) { if (index >= snapshot.getLength()) {
Log("Tried to replace out of bounds message. Index: {}. Length: {}", index, Log("Tried to replace out of bounds message. Index: {}. Length: {}", index,
snapshot.getLength()); snapshot.getLength());
return; return;
} }
@ -882,8 +883,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
if (this->isMouseDown_) { if (this->isMouseDown_) {
this->isMouseDown_ = false; this->isMouseDown_ = false;
if (fabsf(distanceBetweenPoints(this->lastPressPosition_, event->screenPos())) > if (fabsf(distanceBetweenPoints(this->lastPressPosition_, event->screenPos())) > 15.f) {
15.f) {
return; return;
} }
} else { } else {
@ -893,8 +893,8 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
if (this->isRightMouseDown_) { if (this->isRightMouseDown_) {
this->isRightMouseDown_ = false; this->isRightMouseDown_ = false;
if (fabsf(distanceBetweenPoints(this->lastRightPressPosition_, if (fabsf(distanceBetweenPoints(this->lastRightPressPosition_, event->screenPos())) >
event->screenPos())) > 15.f) { 15.f) {
return; return;
} }
} else { } else {

View file

@ -2,13 +2,13 @@
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "messages/LimitedQueueSnapshot.hpp" #include "messages/LimitedQueueSnapshot.hpp"
#include "messages/MessageElement.hpp" #include "messages/MessageElement.hpp"
#include "messages/Selection.hpp" #include "messages/Selection.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "widgets/BaseWidget.hpp" #include "widgets/BaseWidget.hpp"
#include "widgets/helper/RippleEffectLabel.hpp"
#include "widgets/Scrollbar.hpp" #include "widgets/Scrollbar.hpp"
#include "widgets/helper/RippleEffectLabel.hpp"
#include <QPaintEvent> #include <QPaintEvent>
#include <QScroller> #include <QScroller>

View file

@ -1,7 +1,7 @@
#include "widgets/helper/NotebookButton.hpp" #include "widgets/helper/NotebookButton.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "widgets/helper/RippleEffectButton.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
#include "widgets/helper/RippleEffectButton.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include <QMouseEvent> #include <QMouseEvent>

View file

@ -203,4 +203,4 @@ QCompleter *ResizingTextEdit::getCompleter() const
return this->completer; return this->completer;
} }
} } // namespace chatterino

View file

@ -41,4 +41,4 @@ private slots:
void insertCompletion(const QString &completion); void insertCompletion(const QString &completion);
}; };
} } // namespace chatterino

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "widgets/BaseWidget.hpp" #include "widgets/BaseWidget.hpp"
#include "widgets/Label.hpp"
#include "widgets/helper/RippleEffectButton.hpp" #include "widgets/helper/RippleEffectButton.hpp"
#include "widgets/helper/SignalLabel.hpp" #include "widgets/helper/SignalLabel.hpp"
#include "widgets/Label.hpp"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>

View file

@ -16,8 +16,7 @@ class SettingsDialogTab : public BaseWidget
Q_OBJECT Q_OBJECT
public: public:
SettingsDialogTab(SettingsDialog *dialog, SettingsPage *page, SettingsDialogTab(SettingsDialog *dialog, SettingsPage *page, QString imageFileName);
QString imageFileName);
void setSelected(bool selected); void setSelected(bool selected);
SettingsPage *getSettingsPage(); SettingsPage *getSettingsPage();

View file

@ -36,4 +36,4 @@ void SignalLabel::mouseMoveEvent(QMouseEvent *event)
event->ignore(); event->ignore();
} }
} } // namespace chatterino

View file

@ -29,4 +29,4 @@ protected:
void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;
}; };
} } // namespace chatterino

View file

@ -1,12 +1,12 @@
#include "AccountsPage.hpp" #include "AccountsPage.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "providers/twitch/Const.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "controllers/accounts/AccountModel.hpp" #include "controllers/accounts/AccountModel.hpp"
#include "providers/twitch/Const.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/helper/EditableModelView.hpp"
#include "widgets/dialogs/LoginDialog.hpp" #include "widgets/dialogs/LoginDialog.hpp"
#include "widgets/helper/EditableModelView.hpp"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QHeaderView> #include <QHeaderView>

View file

@ -40,8 +40,7 @@ CommandPage::CommandPage()
view->setTitles({"Trigger", "Command"}); view->setTitles({"Trigger", "Command"});
view->getTableView()->horizontalHeader()->setStretchLastSection(true); view->getTableView()->horizontalHeader()->setStretchLastSection(true);
view->addButtonPressed.connect([] { view->addButtonPressed.connect([] {
getApp()->commands->items.appendItem( getApp()->commands->items.appendItem(Command{"/command", "I made a new command HeyGuys"});
Command{"/command", "I made a new command HeyGuys"});
}); });
layout.append(this->createCheckBox("Also match the trigger at the end of the message", layout.append(this->createCheckBox("Also match the trigger at the end of the message",

View file

@ -44,8 +44,7 @@ HighlightingPage::HighlightingPage()
auto highlights = tabs.appendTab(new QVBoxLayout, "Highlights"); auto highlights = tabs.appendTab(new QVBoxLayout, "Highlights");
{ {
EditableModelView *view = EditableModelView *view =
highlights highlights.emplace<EditableModelView>(app->highlights->createModel(nullptr))
.emplace<EditableModelView>(app->highlights->createModel(nullptr))
.getElement(); .getElement();
view->setTitles({"Pattern", "Flash taskbar", "Play sound", "Regex"}); view->setTitles({"Pattern", "Flash taskbar", "Play sound", "Regex"});

View file

@ -64,8 +64,7 @@ IgnoreUsersPage::IgnoreUsersPage()
auto messages = tabs.appendTab(new QVBoxLayout, "Messages"); auto messages = tabs.appendTab(new QVBoxLayout, "Messages");
{ {
EditableModelView *view = EditableModelView *view =
messages.emplace<EditableModelView>(app->ignores->createModel(nullptr)) messages.emplace<EditableModelView>(app->ignores->createModel(nullptr)).getElement();
.getElement();
view->setTitles({"Pattern", "Regex"}); view->setTitles({"Pattern", "Regex"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
@ -77,8 +76,7 @@ IgnoreUsersPage::IgnoreUsersPage()
}); });
view->addButtonPressed.connect([] { view->addButtonPressed.connect([] {
getApp()->ignores->phrases.appendItem( getApp()->ignores->phrases.appendItem(IgnorePhrase{"my phrase", false});
IgnorePhrase{"my phrase", false});
}); });
} }

View file

@ -2,6 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/UrlFetch.hpp"
#include "providers/twitch/EmoteValue.hpp" #include "providers/twitch/EmoteValue.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp" #include "providers/twitch/TwitchMessageBuilder.hpp"
@ -10,17 +11,16 @@
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/StreamLink.hpp" #include "util/StreamLink.hpp"
#include "common/UrlFetch.hpp" #include "widgets/Window.hpp"
#include "widgets/dialogs/QualityPopup.hpp"
#include "widgets/dialogs/SelectChannelDialog.hpp"
#include "widgets/dialogs/TextInputDialog.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/helper/DebugPopup.hpp" #include "widgets/helper/DebugPopup.hpp"
#include "widgets/helper/SearchPopup.hpp" #include "widgets/helper/SearchPopup.hpp"
#include "widgets/helper/Shortcut.hpp" #include "widgets/helper/Shortcut.hpp"
#include "widgets/splits/SplitOverlay.hpp"
#include "widgets/dialogs/QualityPopup.hpp"
#include "widgets/dialogs/SelectChannelDialog.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include "widgets/dialogs/TextInputDialog.hpp" #include "widgets/splits/SplitOverlay.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/Window.hpp"
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
@ -449,18 +449,18 @@ void Split::doOpenViewerList()
} }
auto loadingLabel = new QLabel("Loading..."); auto loadingLabel = new QLabel("Loading...");
twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this,
this, [=](QJsonObject obj) { [=](QJsonObject obj) {
QJsonObject chattersObj = obj.value("chatters").toObject(); QJsonObject chattersObj = obj.value("chatters").toObject();
loadingLabel->hide(); loadingLabel->hide();
for (int i = 0; i < jsonLabels.size(); i++) { for (int i = 0; i < jsonLabels.size(); i++) {
chattersList->addItem(labelList.at(i)); chattersList->addItem(labelList.at(i));
foreach (const QJsonValue &v, foreach (const QJsonValue &v,
chattersObj.value(jsonLabels.at(i)).toArray()) chattersObj.value(jsonLabels.at(i)).toArray())
chattersList->addItem(v.toString()); chattersList->addItem(v.toString());
} }
}); });
searchBar->setPlaceholderText("Search User..."); searchBar->setPlaceholderText("Search User...");
QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() { QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() {

View file

@ -1,12 +1,12 @@
#pragma once #pragma once
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "messages/layouts/MessageLayoutElement.hpp"
#include "messages/LimitedQueueSnapshot.hpp"
#include "messages/MessageElement.hpp"
#include "common/NullablePtr.hpp" #include "common/NullablePtr.hpp"
#include "common/SerializeCustom.hpp" #include "common/SerializeCustom.hpp"
#include "messages/LimitedQueueSnapshot.hpp"
#include "messages/MessageElement.hpp"
#include "messages/layouts/MessageLayout.hpp"
#include "messages/layouts/MessageLayoutElement.hpp"
#include "widgets/BaseWidget.hpp" #include "widgets/BaseWidget.hpp"
#include "widgets/helper/ChannelView.hpp" #include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/RippleEffectLabel.hpp" #include "widgets/helper/RippleEffectLabel.hpp"

View file

@ -1,13 +1,13 @@
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "util/Helpers.hpp" #include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/helper/NotebookTab.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
#include "widgets/helper/NotebookTab.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"
#include <QApplication> #include <QApplication>

View file

@ -1,16 +1,16 @@
#include "widgets/splits/SplitHeader.hpp" #include "widgets/splits/SplitHeader.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/UrlFetch.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/ResourceManager.hpp" #include "singletons/ResourceManager.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "common/UrlFetch.hpp"
#include "widgets/Label.hpp" #include "widgets/Label.hpp"
#include "widgets/TooltipWidget.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include "widgets/TooltipWidget.hpp"
#include <QByteArray> #include <QByteArray>
#include <QDrag> #include <QDrag>

View file

@ -1,6 +1,7 @@
#include "widgets/splits/SplitInput.hpp" #include "widgets/splits/SplitInput.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/UrlFetch.hpp"
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
@ -8,7 +9,6 @@
#include "singletons/SettingsManager.hpp" #include "singletons/SettingsManager.hpp"
#include "singletons/ThemeManager.hpp" #include "singletons/ThemeManager.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "common/UrlFetch.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "widgets/helper/ResizingTextEdit.hpp"
#include "widgets/BaseWidget.hpp" #include "widgets/BaseWidget.hpp"
#include "widgets/dialogs/EmotePopup.hpp" #include "widgets/dialogs/EmotePopup.hpp"
#include "widgets/helper/ResizingTextEdit.hpp"
#include "widgets/helper/RippleEffectLabel.hpp" #include "widgets/helper/RippleEffectLabel.hpp"
#include <QHBoxLayout> #include <QHBoxLayout>