diff --git a/chatterino.pro b/chatterino.pro index 9f82a557f..4c101e78e 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -151,7 +151,6 @@ SOURCES += \ src/singletons/helper/GifTimer.cpp \ src/singletons/helper/LoggingChannel.cpp \ src/controllers/moderationactions/ModerationAction.cpp \ - src/singletons/IrcManager.cpp \ src/singletons/WindowManager.cpp \ src/util/DebugCount.cpp \ src/util/RapidjsonHelpers.cpp \ @@ -305,7 +304,6 @@ HEADERS += \ src/singletons/helper/GifTimer.hpp \ src/singletons/helper/LoggingChannel.hpp \ src/controllers/moderationactions/ModerationAction.hpp \ - src/singletons/IrcManager.hpp \ src/singletons/WindowManager.hpp \ src/util/Clamp.hpp \ src/util/CombinePath.hpp \ diff --git a/src/Application.hpp b/src/Application.hpp index e3eaa2fd6..d1d8cfe46 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -1,6 +1,6 @@ #pragma once -#include "singletons/IrcManager.hpp" +" #include "singletons/Resources.hpp" #include diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 4ab2c8bd8..74a40de02 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -4,7 +4,7 @@ #include "debug/Log.hpp" #include "messages/Message.hpp" #include "singletons/Emotes.hpp" -#include "singletons/IrcManager.hpp" +" #include "singletons/Logging.hpp" #include "singletons/WindowManager.hpp" diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index efeefc7b5..2d20ef6d2 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -5,7 +5,6 @@ #include "common/UrlFetch.hpp" #include "debug/Log.hpp" #include "singletons/Emotes.hpp" -#include "singletons/IrcManager.hpp" #include "singletons/WindowManager.hpp" #include "util/PostToThread.hpp" diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index b9df15b27..579a8a8f8 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -7,7 +7,6 @@ #include "providers/twitch/Pubsub.hpp" #include "providers/twitch/TwitchMessageBuilder.hpp" #include "singletons/Emotes.hpp" -#include "singletons/IrcManager.hpp" #include "singletons/Settings.hpp" #include "util/PostToThread.hpp" @@ -145,7 +144,7 @@ void TwitchChannel::sendMessage(const QString &message) // manager" dialog this->addMessage( 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; } @@ -233,8 +232,8 @@ void TwitchChannel::addJoinedUser(const QString &user) QTimer::singleShot(500, &this->object, [this] { std::lock_guard guard(this->joinedUserMutex); - auto message = Message::createSystemMessage("Users joined: " + - this->joinedUsers.join(", ")); + auto message = + Message::createSystemMessage("Users joined: " + this->joinedUsers.join(", ")); message->flags |= Message::Collapsed; this->addMessage(message); this->joinedUsers.clear(); @@ -262,8 +261,8 @@ void TwitchChannel::addPartedUser(const QString &user) QTimer::singleShot(500, &this->object, [this] { std::lock_guard guard(this->partedUserMutex); - auto message = Message::createSystemMessage("Users parted: " + - this->partedUsers.join(", ")); + auto message = + Message::createSystemMessage("Users parted: " + this->partedUsers.join(", ")); message->flags |= Message::Collapsed; this->addMessage(message); this->partedUsers.clear(); diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 083e947f7..a4be63188 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -6,7 +6,6 @@ #include "common/Common.hpp" #include "common/MutexValue.hpp" #include "singletons/Emotes.hpp" -#include "singletons/IrcManager.hpp" #include "util/ConcurrentMap.hpp" #include diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 2dc601571..2ece87e1f 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -7,7 +7,6 @@ #include "debug/Log.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "singletons/Emotes.hpp" -#include "singletons/IrcManager.hpp" #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/Themes.hpp" @@ -37,8 +36,8 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage, - const MessageParseArgs &_args, - QString content, bool isAction) + const MessageParseArgs &_args, QString content, + bool isAction) : channel(_channel) , twitchChannel(dynamic_cast(_channel)) , ircMessage(_ircMessage) diff --git a/src/singletons/IrcManager.cpp b/src/singletons/IrcManager.cpp deleted file mode 100644 index 8e2ffd635..000000000 --- a/src/singletons/IrcManager.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//#include "singletons/IrcManager.hpp" -//#include "common/Channel.hpp" -//#include "debug/Log.hpp" -//#include "messages/MessageParseArgs.hpp" -//#include "providers/twitch/TwitchAccount.hpp" -//#include "providers/twitch/TwitchMessageBuilder.hpp" -//#include "singletons/accountmanager.hpp" -//#include "singletons/channelmanager.hpp" -//#include "singletons/EmoteManager.hpp" -//#include "singletons/ResourceManager.hpp" -//#include "singletons/SettingsManager.hpp" -//#include "singletons/WindowManager.hpp" -//#include "util/PostToThread.hpp" -//#include "common/UrlFetch.hpp" - -//#include -//#include -//#include -//#include -//#include -//#include - -//#include - -// using namespace messages; - -// void IrcManager::refreshIgnoredUsers(const QString &username, const QString &oauthClient, -// const QString &oauthToken) -//{ -// QString nextLink = "https://api.twitch.tv/kraken/users/" + username + "/blocks?limit=" + 100 + -// "&client_id=" + oauthClient; -// -// QNetworkAccessManager *manager = new QNetworkAccessManager(); -// QNetworkRequest req(QUrl(nextLink + "&oauth_token=" + oauthToken)); -// QNetworkReply *reply = manager->get(req); -// -// QObject::connect(reply, &QNetworkReply::finished, [=] { -// this->twitchBlockedUsersMutex.lock(); -// this->twitchBlockedUsers.clear(); -// this->twitchBlockedUsersMutex.unlock(); -// -// QByteArray data = reply->readAll(); -// QJsonDocument jsonDoc(QJsonDocument::fromJson(data)); -// QJsonObject root = jsonDoc.object(); -// -// // nextLink = -// // root.value("this->links").toObject().value("next").toString(); -// -// auto blocks = root.value("blocks").toArray(); -// -// this->twitchBlockedUsersMutex.lock(); -// for (QJsonValue block : blocks) { -// QJsonObject user = block.toObject().value("user").toObject(); -// // displaythis->name -// this->twitchBlockedUsers.insert(user.value("name").toString().toLower(), true); -// } -// this->twitchBlockedUsersMutex.unlock(); -// -// manager->deleteLater(); -// }); -//} -// -//// XXX: This does not fit in IrcManager -// bool IrcManager::isTwitchUserBlocked(QString const &username) -//{ -// QMutexLocker locker(&this->twitchBlockedUsersMutex); -// -// auto iterator = this->twitchBlockedUsers.find(username); -// -// return iterator != this->twitchBlockedUsers.end(); -//} -// -//// XXX: This does not fit in IrcManager -// bool IrcManager::tryAddIgnoredUser(QString const &username, QString &errorMessage) -//{ -// assert(this->account); -// -// QUrl url("https://api.twitch.tv/kraken/users/" + this->account->getUserName() + "/blocks/" + -// username + "?oauth_token=" + this->account->getOAuthToken() + -// "&client_id=" + this->account->getOAuthClient()); -// -// QNetworkRequest request(url); -// auto reply = this->networkAccessManager.put(request, QByteArray()); -// reply->waitForReadyRead(10000); -// -// if (reply->error() == QNetworkReply::NoError) { -// this->twitchBlockedUsersMutex.lock(); -// this->twitchBlockedUsers.insert(username, true); -// this->twitchBlockedUsersMutex.unlock(); -// -// return true; -// } -// -// reply->deleteLater(); -// -// errorMessage = "Error while ignoring user \"" + username + "\": " + reply->errorString(); -// -// return false; -//} -// -//// XXX: This does not fit in IrcManager -// void IrcManager::addIgnoredUser(QString const &username) -//{ -// QString errorMessage; -// if (!tryAddIgnoredUser(username, errorMessage)) { -// // TODO: Implement IrcManager::addIgnoredUser -// } -//} -// -//// XXX: This does not fit in IrcManager -// bool IrcManager::tryRemoveIgnoredUser(QString const &username, QString &errorMessage) -//{ -// assert(this->account); -// -// QUrl url("https://api.twitch.tv/kraken/users/" + this->account->getUserName() + "/blocks/" + -// username + "?oauth_token=" + this->account->getOAuthToken() + -// "&client_id=" + this->account->getOAuthClient()); -// -// QNetworkRequest request(url); -// auto reply = this->networkAccessManager.deleteResource(request); -// reply->waitForReadyRead(10000); -// -// if (reply->error() == QNetworkReply::NoError) { -// this->twitchBlockedUsersMutex.lock(); -// this->twitchBlockedUsers.remove(username); -// this->twitchBlockedUsersMutex.unlock(); -// -// return true; -// } -// -// reply->deleteLater(); -// -// errorMessage = "Error while unignoring user \"" + username + "\": " + reply->errorString(); -// -// return false; -//} -// -//// XXX: This does not fit in IrcManager -// void IrcManager::removeIgnoredUser(QString const &username) -//{ -// QString errorMessage; -// if (!tryRemoveIgnoredUser(username, errorMessage)) { -// // TODO: Implement IrcManager::removeIgnoredUser -// } -//} diff --git a/src/singletons/IrcManager.hpp b/src/singletons/IrcManager.hpp deleted file mode 100644 index e148cc6ae..000000000 --- a/src/singletons/IrcManager.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// bool isTwitchUserBlocked(QString const &username); -// bool tryAddIgnoredUser(QString const &username, QString &errorMessage); -// void addIgnoredUser(QString const &username); -// bool tryRemoveIgnoredUser(QString const &username, QString &errorMessage); -// void removeIgnoredUser(QString const &username); - -// QMap twitchBlockedUsers; -// QMutex twitchBlockedUsersMutex; - -// QNetworkAccessManager networkAccessManager; - -// void refreshIgnoredUsers(const QString &username, const QString &oauthClient, -// const QString &oauthToken); diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index ae5da485b..030447cec 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -4,7 +4,6 @@ #include "common/Version.hpp" #include "controllers/accounts/AccountController.hpp" #include "providers/twitch/TwitchServer.hpp" -#include "singletons/IrcManager.hpp" #include "singletons/Settings.hpp" #include "singletons/Themes.hpp" #include "singletons/WindowManager.hpp" @@ -100,16 +99,16 @@ Window::Window(WindowType _type) auto s = new QShortcut(QKeySequence::ZoomIn, this); s->setContext(Qt::WindowShortcut); QObject::connect(s, &QShortcut::activated, this, [] { - getApp()->settings->uiScale.setValue(WindowManager::clampUiScale( - getApp()->settings->uiScale.getValue() + 1)); + getApp()->settings->uiScale.setValue( + WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() + 1)); }); } { auto s = new QShortcut(QKeySequence::ZoomOut, this); s->setContext(Qt::WindowShortcut); QObject::connect(s, &QShortcut::activated, this, [] { - getApp()->settings->uiScale.setValue(WindowManager::clampUiScale( - getApp()->settings->uiScale.getValue() - 1)); + getApp()->settings->uiScale.setValue( + WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() - 1)); }); } diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 29e909cd2..f78a0cb7b 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -5,7 +5,6 @@ #include "controllers/commands/CommandController.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchServer.hpp" -#include "singletons/IrcManager.hpp" #include "singletons/Settings.hpp" #include "singletons/Themes.hpp" #include "util/LayoutCreator.hpp" @@ -66,12 +65,10 @@ void SplitInput::initLayout() // ---- misc // set edit font - this->ui_.textEdit->setFont( - app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); + this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() { - this->ui_.textEdit->setFont( - app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); + this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); })); // open emote popup