From 5555c41d7e3385da8407649c085ae33d108e3855 Mon Sep 17 00:00:00 2001 From: apa420 Date: Wed, 29 Aug 2018 23:39:02 +0200 Subject: [PATCH] fixed toasts for all platforms --- src/common/DownloadManager.cpp | 9 +++++---- src/singletons/Paths.cpp | 2 ++ src/singletons/Paths.hpp | 3 +++ src/singletons/Toasts.cpp | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/common/DownloadManager.cpp b/src/common/DownloadManager.cpp index 38a98706..d19a6fd6 100644 --- a/src/common/DownloadManager.cpp +++ b/src/common/DownloadManager.cpp @@ -1,6 +1,9 @@ #include "DownloadManager.hpp" +#include "singletons/Paths.hpp" + #include +#include namespace chatterino { @@ -20,10 +23,8 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName) QString filePath = fileURL; QString saveFilePath; QStringList filePathList = filePath.split('/'); - saveFilePath = QString( - QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + - "2/cache/profileAvatars/twitch/" + channelName + ".png"); - + saveFilePath = + getPaths()->twitchProfileAvatars + "/twitch/" + channelName + ".png"; QNetworkRequest request; request.setUrl(QUrl(fileURL)); reply = manager->get(request); diff --git a/src/singletons/Paths.cpp b/src/singletons/Paths.cpp index 90a094e7..2fd8cef8 100644 --- a/src/singletons/Paths.cpp +++ b/src/singletons/Paths.cpp @@ -130,6 +130,8 @@ void Paths::initSubDirectories() this->cacheDirectory_ = makePath("Cache"); this->messageLogDirectory = makePath("Logs"); this->miscDirectory = makePath("Misc"); + this->twitchProfileAvatars = makePath("ProfileAvatars"); + QDir().mkdir(this->twitchProfileAvatars + "/twitch"); } Paths *getPaths() diff --git a/src/singletons/Paths.hpp b/src/singletons/Paths.hpp index de67e806..1df1fc77 100644 --- a/src/singletons/Paths.hpp +++ b/src/singletons/Paths.hpp @@ -28,6 +28,9 @@ public: // Hash of QCoreApplication::applicationFilePath() QString applicationFilePathHash; + // Profile avatars for twitch /cache/twitch + QString twitchProfileAvatars; + bool createFolder(const QString &folderPath); bool isPortable(); diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index 6fdd65e6..0e840c26 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -105,7 +105,7 @@ public: void Toasts::sendWindowsNotification(const QString &channelName, Platform p) { WinToastLib::WinToastTemplate templ = WinToastLib::WinToastTemplate( - WinToastLib::WinToastTemplate::ImageAndText02); + WinToastLib::WinToastTemplate::ImageAndText03); QString str = channelName + " is live!"; std::string utf8_text = str.toUtf8().constData(); std::wstring widestr = std::wstring(utf8_text.begin(), utf8_text.end()); @@ -115,8 +115,8 @@ void Toasts::sendWindowsNotification(const QString &channelName, Platform p) WinToastLib::WinToastTemplate::SecondLine); QString Path; if (p == Platform::Twitch) { - Path = Path = getPaths()->cacheDirectory() + "/" + - "profileAvatars/twitch/" + channelName + ".png"; + Path = getPaths()->twitchProfileAvatars + "/twitch/" + channelName + + ".png"; } std::string temp_Utf8 = Path.toUtf8().constData(); std::wstring imagePath = std::wstring(temp_Utf8.begin(), temp_Utf8.end());