From cd571a7e25b0210dd2801ff49c42af2128359c24 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 30 Sep 2018 17:15:17 +0000 Subject: [PATCH] clean up warnings --- src/common/DownloadManager.cpp | 6 ++-- src/common/NetworkRequest.hpp | 3 +- src/messages/Image.cpp | 9 ++--- src/singletons/Toasts.cpp | 34 ++++++++----------- src/widgets/dialogs/EmotePopup.hpp | 2 +- .../settingspages/HighlightingPage.cpp | 2 +- src/widgets/settingspages/ModerationPage.cpp | 2 +- 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/common/DownloadManager.cpp b/src/common/DownloadManager.cpp index f1f701fbc..d762b7f14 100644 --- a/src/common/DownloadManager.cpp +++ b/src/common/DownloadManager.cpp @@ -1,5 +1,6 @@ #include "DownloadManager.hpp" +#include "debug/Log.hpp" #include "singletons/Paths.hpp" #include @@ -42,8 +43,7 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName) void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal) { - qDebug(QString::number(bytesRead).toLatin1() + " - " + - QString::number(bytesTotal).toLatin1()); + log("Download progress: {}/{}", bytesRead, bytesTotal); } void DownloadManager::onFinished(QNetworkReply *reply) @@ -53,7 +53,7 @@ void DownloadManager::onFinished(QNetworkReply *reply) qDebug("file is downloaded successfully."); } break; default: { - qDebug(reply->errorString().toLatin1()); + qDebug() << reply->errorString().toLatin1(); }; } diff --git a/src/common/NetworkRequest.hpp b/src/common/NetworkRequest.hpp index e6f122bbd..f068448a5 100644 --- a/src/common/NetworkRequest.hpp +++ b/src/common/NetworkRequest.hpp @@ -7,7 +7,8 @@ #include "common/NetworkWorker.hpp" namespace chatterino { -class NetworkData; + +struct NetworkData; class NetworkRequest { diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index 20832c8f7..567765005 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -62,9 +62,10 @@ namespace detail { while (true) { this->index_ %= this->items_.size(); - if (this->index_ >= this->items_.size()) { - this->index_ = this->index_; - } + // TODO: Figure out what this was supposed to achieve + // if (this->index_ >= this->items_.size()) { + // this->index_ = this->index_; + // } if (this->durationOffset_ > this->items_[this->index_].duration) { this->durationOffset_ -= this->items_[this->index_].duration; @@ -310,7 +311,7 @@ void Image::load() return Success; }); - req.onError([that = this, weak = weakOf(this)](auto result) -> bool { + req.onError([weak = weakOf(this)](auto result) -> bool { auto shared = weak.lock(); if (!shared) return false; diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index 33df8e3b5..f331e3b01 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -35,37 +35,33 @@ bool Toasts::isEnabled() void Toasts::sendChannelNotification(const QString &channelName, Platform p) { +#ifdef Q_OS_WIN + auto sendChannelNotification = [this, channelName, p] { + this->sendWindowsNotification(channelName, p); + }; +#else + auto sendChannelNotification = [] { + // Unimplemented for OSX and Linux + }; +#endif // Fetch user profile avatar if (p == Platform::Twitch) { QFileInfo check_file(getPaths()->twitchProfileAvatars + "/twitch/" + channelName + ".png"); if (check_file.exists() && check_file.isFile()) { -#ifdef Q_OS_WIN - this->sendWindowsNotification(channelName, p); -#endif - // OSX - - // LINUX - + sendChannelNotification(); } else { this->fetchChannelAvatar( - channelName, [this, channelName, p](QString avatarLink) { + channelName, + [channelName, sendChannelNotification](QString avatarLink) { DownloadManager *manager = new DownloadManager(); manager->setFile(avatarLink, channelName); - manager->connect( - manager, &DownloadManager::downloadComplete, - [this, channelName, p]() { -#ifdef Q_OS_WIN - this->sendWindowsNotification(channelName, p); -#endif - // OSX - - // LINUX - }); + manager->connect(manager, + &DownloadManager::downloadComplete, + sendChannelNotification); }); } } - return; } #ifdef Q_OS_WIN diff --git a/src/widgets/dialogs/EmotePopup.hpp b/src/widgets/dialogs/EmotePopup.hpp index b8ea9ebf9..4e4d5f74a 100644 --- a/src/widgets/dialogs/EmotePopup.hpp +++ b/src/widgets/dialogs/EmotePopup.hpp @@ -6,7 +6,7 @@ namespace chatterino { -class Link; +struct Link; class ChannelView; class Channel; using ChannelPtr = std::shared_ptr; diff --git a/src/widgets/settingspages/HighlightingPage.cpp b/src/widgets/settingspages/HighlightingPage.cpp index be394b3c2..8d8ce400d 100644 --- a/src/widgets/settingspages/HighlightingPage.cpp +++ b/src/widgets/settingspages/HighlightingPage.cpp @@ -139,7 +139,7 @@ HighlightingPage::HighlightingPage() auto selectFile = customSound.emplace("Select custom sound file"); QObject::connect(selectFile.getElement(), &QPushButton::clicked, - this, [this, app] { + this, [this] { auto fileName = QFileDialog::getOpenFileName( this, tr("Open Sound"), "", tr("Audio Files (*.mp3 *.wav)")); diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index d50e59bc0..f60394b00 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -90,7 +90,7 @@ ModerationPage::ModerationPage() // Logs (copied from LoggingMananger) getSettings()->logPath.connect( - [app, logsPathLabel](const QString &logPath, auto) mutable { + [logsPathLabel](const QString &logPath, auto) mutable { QString pathOriginal; if (logPath == "") {