This commit is contained in:
fourtf 2018-07-15 20:41:57 +02:00
commit e51c5c692a
25 changed files with 47 additions and 83 deletions

View file

@ -256,7 +256,6 @@ HEADERS += \
src/common/ProviderId.hpp \ src/common/ProviderId.hpp \
src/common/SerializeCustom.hpp \ src/common/SerializeCustom.hpp \
src/common/SignalVectorModel.hpp \ src/common/SignalVectorModel.hpp \
src/common/UrlFetch.hpp \
src/common/Version.hpp \ src/common/Version.hpp \
src/controllers/accounts/Account.hpp \ src/controllers/accounts/Account.hpp \
src/controllers/accounts/AccountController.hpp \ src/controllers/accounts/AccountController.hpp \
@ -414,8 +413,7 @@ HEADERS += \
src/widgets/dialogs/UpdateDialog.hpp \ src/widgets/dialogs/UpdateDialog.hpp \
src/widgets/settingspages/IgnoresPage.hpp \ src/widgets/settingspages/IgnoresPage.hpp \
src/providers/twitch/PubsubClient.hpp \ src/providers/twitch/PubsubClient.hpp \
src/providers/twitch/TwitchApi.hpp \ src/providers/twitch/TwitchApi.hpp
src/common/UniqueAccess.hpp
RESOURCES += \ RESOURCES += \
resources/resources.qrc \ resources/resources.qrc \
@ -453,7 +451,6 @@ win32-msvc* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations
QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field
# Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future # Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future
QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing
@ -462,6 +459,7 @@ win32-msvc* {
equals(QMAKE_CXX, "clang++") { equals(QMAKE_CXX, "clang++") {
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field
} else { } else {
QMAKE_CXXFLAGS_WARN_ON += -Wno-class-memaccess QMAKE_CXXFLAGS_WARN_ON += -Wno-class-memaccess
} }

@ -1 +1 @@
Subproject commit 29accdf9dea05947d687112594ad06bf6001ee0a Subproject commit 7f0db95f245fb726e756ecde15a800c0928b054b

@ -1 +1 @@
Subproject commit 3f6645c615ff7bf412c05fe322e589cbdd34ff9b Subproject commit e03c868ec922027a0e672b64388808beb1297816

View file

@ -41,7 +41,7 @@ public:
using pajlada::Settings::Setting<Type>::operator==; using pajlada::Settings::Setting<Type>::operator==;
using pajlada::Settings::Setting<Type>::operator!=; using pajlada::Settings::Setting<Type>::operator!=;
using pajlada::Settings::Setting<Type>::operator const Type; using pajlada::Settings::Setting<Type>::operator Type;
}; };
using BoolSetting = ChatterinoSetting<bool>; using BoolSetting = ChatterinoSetting<bool>;

View file

@ -1,36 +0,0 @@
#pragma once
#include "common/NetworkRequest.hpp"
#include <QObject>
#include <QString>
namespace chatterino {
// Not sure if I like these, but I'm trying them out
static NetworkRequest makeGetChannelRequest(const QString &channelId,
const QObject *caller = nullptr)
{
QString url("https://api.twitch.tv/kraken/channels/" + channelId);
auto request = NetworkRequest::twitchRequest(url);
request.setCaller(caller);
return request;
}
static NetworkRequest makeGetStreamRequest(const QString &channelId,
const QObject *caller = nullptr)
{
QString url("https://api.twitch.tv/kraken/streams/" + channelId);
auto request = NetworkRequest::twitchRequest(url);
request.setCaller(caller);
return request;
}
} // namespace chatterino

View file

@ -128,7 +128,7 @@ int runGui(QApplication &a, int argc, char *argv[])
QFile::remove(runningPath); QFile::remove(runningPath);
// Save settings // Save settings
pajlada::Settings::SettingManager::save(); pajlada::Settings::SettingManager::gSave();
// Deinitialize NetworkManager (stop thread and wait for finish, should be instant) // Deinitialize NetworkManager (stop thread and wait for finish, should be instant)
chatterino::NetworkManager::deinit(); chatterino::NetworkManager::deinit();

View file

@ -1,8 +1,7 @@
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/NetworkManager.hpp" #include "common/NetworkRequest.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"

View file

@ -1,6 +1,6 @@
#include "providers/bttv/BttvEmotes.hpp" #include "providers/bttv/BttvEmotes.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"

View file

@ -1,6 +1,6 @@
#include "providers/ffz/FfzEmotes.hpp" #include "providers/ffz/FfzEmotes.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"

View file

@ -1,7 +1,6 @@
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "common/NetworkRequest.hpp" #include "common/NetworkRequest.hpp"
#include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "providers/twitch/PartialTwitchUser.hpp" #include "providers/twitch/PartialTwitchUser.hpp"
#include "providers/twitch/TwitchCommon.hpp" #include "providers/twitch/TwitchCommon.hpp"

View file

@ -1,7 +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 "common/NetworkRequest.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
@ -299,16 +299,21 @@ void TwitchChannel::refreshLiveStatus()
QString url("https://api.twitch.tv/kraken/streams/" + roomID); QString url("https://api.twitch.tv/kraken/streams/" + roomID);
auto request = makeGetStreamRequest(roomID, QThread::currentThread()); //<<<<<<< HEAD
// auto request = makeGetStreamRequest(roomID, QThread::currentThread());
//=======
// auto request = NetworkRequest::twitchRequest(url);
// request.setCaller(QThread::currentThread());
//>>>>>>> 9bfbdefd2f0972a738230d5b95a009f73b1dd933
request.onSuccess([this, weak = this->weak_from_this()](auto result) { // request.onSuccess([this, weak = this->weak_from_this()](auto result) {
ChannelPtr shared = weak.lock(); // ChannelPtr shared = weak.lock();
if (!shared) return false; // if (!shared) return false;
return this->parseLiveStatus(result.parseRapidJson()); // return this->parseLiveStatus(result.parseRapidJson());
}); // });
request.execute(); // request.execute();
} }
bool TwitchChannel::parseLiveStatus(const rapidjson::Document &document) bool TwitchChannel::parseLiveStatus(const rapidjson::Document &document)

View file

@ -1,6 +1,6 @@
#include "providers/twitch/TwitchEmotes.hpp" #include "providers/twitch/TwitchEmotes.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.hpp"
#include "debug/Benchmark.hpp" #include "debug/Benchmark.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Image.hpp" #include "messages/Image.hpp"

View file

@ -216,11 +216,6 @@ MessagePtr TwitchMessageBuilder::build()
// Actually just text // Actually just text
QString linkString = this->matchLink(string); QString linkString = this->matchLink(string);
auto fontStyle = FontStyle::ChatMedium;
if (string.startsWith('@') && app->settings->enableUsernameBold) {
fontStyle = FontStyle::ChatMediumBold;
}
Link link; Link link;

View file

@ -1,12 +1,12 @@
#include "singletons/Fonts.hpp" #include "singletons/Fonts.hpp"
#include "Application.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "singletons/WindowManager.hpp"
#include <QDebug> #include <QDebug>
#include <QtGlobal> #include <QtGlobal>
#include "Application.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"
#define DEFAULT_FONT_SIZE 10 #define DEFAULT_FONT_SIZE 10

View file

@ -1,4 +1,4 @@
#include "NativeMessaging.hpp" #include "singletons/NativeMessaging.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"

View file

@ -1,8 +1,12 @@
#include "Resources.hpp" #include "singletons/Resources.hpp"
#include "common/UrlFetch.hpp"
#include "common/NetworkRequest.hpp"
#include <QDebug>
#include <QIcon> #include <QIcon>
#include <QJsonArray>
#include <QPixmap> #include <QPixmap>
#include <QThread>
namespace chatterino { namespace chatterino {

View file

@ -35,7 +35,7 @@ void Settings::load()
{ {
QString settingsPath = getPaths()->settingsDirectory + "/settings.json"; QString settingsPath = getPaths()->settingsDirectory + "/settings.json";
pajlada::Settings::SettingManager::load(qPrintable(settingsPath)); pajlada::Settings::SettingManager::gLoad(qPrintable(settingsPath));
} }
void Settings::saveSnapshot() void Settings::saveSnapshot()

View file

@ -1,6 +1,6 @@
#define LOOKUP_COLOR_COUNT 360 #define LOOKUP_COLOR_COUNT 360
#include "Theme.hpp" #include "singletons/Theme.hpp"
#include <QColor> #include <QColor>

View file

@ -1,4 +1,4 @@
#include "WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "debug/AssertInGuiThread.hpp" #include "debug/AssertInGuiThread.hpp"
@ -11,12 +11,11 @@
#include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/AccountSwitchPopupWidget.hpp"
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"
#include <QDebug>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QDebug>
#define SETTINGS_FILENAME "/window-layout.json" #define SETTINGS_FILENAME "/window-layout.json"
namespace chatterino { namespace chatterino {

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <common/Singleton.hpp> #include "common/Singleton.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"

View file

@ -1,7 +1,7 @@
#include "widgets/dialogs/LoginDialog.hpp" #include "widgets/dialogs/LoginDialog.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/PartialTwitchUser.hpp" #include "providers/twitch/PartialTwitchUser.hpp"

View file

@ -1,7 +1,7 @@
#include "UserInfoPopup.hpp" #include "UserInfoPopup.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/PartialTwitchUser.hpp" #include "providers/twitch/PartialTwitchUser.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
@ -250,7 +250,10 @@ void UserInfoPopup::updateUserData()
this->userId_ = id; this->userId_ = id;
auto request = makeGetChannelRequest(id, this); QString url("https://api.twitch.tv/kraken/channels/" + id);
auto request = NetworkRequest::twitchRequest(url);
request.setCaller(this);
request.onSuccess([this](auto result) { request.onSuccess([this](auto result) {
auto obj = result.parseJson(); auto obj = result.parseJson();

View file

@ -2,7 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/UrlFetch.hpp" #include "common/NetworkRequest.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"
@ -27,6 +27,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QDockWidget> #include <QDockWidget>
#include <QDrag> #include <QDrag>
#include <QJsonArray>
#include <QListWidget> #include <QListWidget>
#include <QMimeData> #include <QMimeData>
#include <QPainter> #include <QPainter>

View file

@ -1,7 +1,6 @@
#include "widgets/splits/SplitHeader.hpp" #include "widgets/splits/SplitHeader.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "common/UrlFetch.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"

View file

@ -1,7 +1,6 @@
#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"