fixed toasts for all platforms

This commit is contained in:
apa420 2018-08-29 23:39:02 +02:00
parent 01ca055763
commit 5555c41d7e
4 changed files with 13 additions and 7 deletions

View file

@ -1,6 +1,9 @@
#include "DownloadManager.hpp"
#include "singletons/Paths.hpp"
#include <QDesktopServices>
#include <QDir>
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);

View file

@ -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()

View file

@ -28,6 +28,9 @@ public:
// Hash of QCoreApplication::applicationFilePath()
QString applicationFilePathHash;
// Profile avatars for twitch <appDataDirectory>/cache/twitch
QString twitchProfileAvatars;
bool createFolder(const QString &folderPath);
bool isPortable();

View file

@ -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());