mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fixed toasts for all platforms
This commit is contained in:
parent
01ca055763
commit
5555c41d7e
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue