clean up warnings

This commit is contained in:
Rasmus Karlsson 2018-09-30 17:15:17 +00:00
parent a2fb4ca104
commit cd571a7e25
7 changed files with 28 additions and 30 deletions

View file

@ -1,5 +1,6 @@
#include "DownloadManager.hpp" #include "DownloadManager.hpp"
#include "debug/Log.hpp"
#include "singletons/Paths.hpp" #include "singletons/Paths.hpp"
#include <QDesktopServices> #include <QDesktopServices>
@ -42,8 +43,7 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName)
void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal) void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal)
{ {
qDebug(QString::number(bytesRead).toLatin1() + " - " + log("Download progress: {}/{}", bytesRead, bytesTotal);
QString::number(bytesTotal).toLatin1());
} }
void DownloadManager::onFinished(QNetworkReply *reply) void DownloadManager::onFinished(QNetworkReply *reply)
@ -53,7 +53,7 @@ void DownloadManager::onFinished(QNetworkReply *reply)
qDebug("file is downloaded successfully."); qDebug("file is downloaded successfully.");
} break; } break;
default: { default: {
qDebug(reply->errorString().toLatin1()); qDebug() << reply->errorString().toLatin1();
}; };
} }

View file

@ -7,7 +7,8 @@
#include "common/NetworkWorker.hpp" #include "common/NetworkWorker.hpp"
namespace chatterino { namespace chatterino {
class NetworkData;
struct NetworkData;
class NetworkRequest class NetworkRequest
{ {

View file

@ -62,9 +62,10 @@ namespace detail {
while (true) { while (true) {
this->index_ %= this->items_.size(); this->index_ %= this->items_.size();
if (this->index_ >= this->items_.size()) { // TODO: Figure out what this was supposed to achieve
this->index_ = this->index_; // if (this->index_ >= this->items_.size()) {
} // this->index_ = this->index_;
// }
if (this->durationOffset_ > this->items_[this->index_].duration) { if (this->durationOffset_ > this->items_[this->index_].duration) {
this->durationOffset_ -= this->items_[this->index_].duration; this->durationOffset_ -= this->items_[this->index_].duration;
@ -310,7 +311,7 @@ void Image::load()
return Success; return Success;
}); });
req.onError([that = this, weak = weakOf(this)](auto result) -> bool { req.onError([weak = weakOf(this)](auto result) -> bool {
auto shared = weak.lock(); auto shared = weak.lock();
if (!shared) return false; if (!shared) return false;

View file

@ -35,37 +35,33 @@ bool Toasts::isEnabled()
void Toasts::sendChannelNotification(const QString &channelName, Platform p) 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 // Fetch user profile avatar
if (p == Platform::Twitch) { if (p == Platform::Twitch) {
QFileInfo check_file(getPaths()->twitchProfileAvatars + "/twitch/" + QFileInfo check_file(getPaths()->twitchProfileAvatars + "/twitch/" +
channelName + ".png"); channelName + ".png");
if (check_file.exists() && check_file.isFile()) { if (check_file.exists() && check_file.isFile()) {
#ifdef Q_OS_WIN sendChannelNotification();
this->sendWindowsNotification(channelName, p);
#endif
// OSX
// LINUX
} else { } else {
this->fetchChannelAvatar( this->fetchChannelAvatar(
channelName, [this, channelName, p](QString avatarLink) { channelName,
[channelName, sendChannelNotification](QString avatarLink) {
DownloadManager *manager = new DownloadManager(); DownloadManager *manager = new DownloadManager();
manager->setFile(avatarLink, channelName); manager->setFile(avatarLink, channelName);
manager->connect( manager->connect(manager,
manager, &DownloadManager::downloadComplete, &DownloadManager::downloadComplete,
[this, channelName, p]() { sendChannelNotification);
#ifdef Q_OS_WIN
this->sendWindowsNotification(channelName, p);
#endif
// OSX
// LINUX
});
}); });
} }
} }
return;
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

View file

@ -6,7 +6,7 @@
namespace chatterino { namespace chatterino {
class Link; struct Link;
class ChannelView; class ChannelView;
class Channel; class Channel;
using ChannelPtr = std::shared_ptr<Channel>; using ChannelPtr = std::shared_ptr<Channel>;

View file

@ -139,7 +139,7 @@ HighlightingPage::HighlightingPage()
auto selectFile = auto selectFile =
customSound.emplace<QPushButton>("Select custom sound file"); customSound.emplace<QPushButton>("Select custom sound file");
QObject::connect(selectFile.getElement(), &QPushButton::clicked, QObject::connect(selectFile.getElement(), &QPushButton::clicked,
this, [this, app] { this, [this] {
auto fileName = QFileDialog::getOpenFileName( auto fileName = QFileDialog::getOpenFileName(
this, tr("Open Sound"), "", this, tr("Open Sound"), "",
tr("Audio Files (*.mp3 *.wav)")); tr("Audio Files (*.mp3 *.wav)"));

View file

@ -90,7 +90,7 @@ ModerationPage::ModerationPage()
// Logs (copied from LoggingMananger) // Logs (copied from LoggingMananger)
getSettings()->logPath.connect( getSettings()->logPath.connect(
[app, logsPathLabel](const QString &logPath, auto) mutable { [logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal; QString pathOriginal;
if (logPath == "") { if (logPath == "") {