more stuff done, does compile, changed vector for map

This commit is contained in:
apa420
2018-08-12 20:21:21 +02:00
parent 05d5709bb9
commit 320558ee63
6 changed files with 96 additions and 214 deletions
+4 -56
View File
@@ -18,62 +18,6 @@
namespace chatterino {
/*
Toasts::Toasts()
{
}
*/
/*
void Toasts::initialize(Settings &settings, Paths &paths)
{
getApp()->twitch2->forEachChannel([this](ChannelPtr chn) {
auto twchn = dynamic_cast<TwitchChannel *>(chn.get());
twchn->liveStatusChanged.connect([twchn, this]() {
const auto streamStatus = twchn->accessStreamStatus();
if (streamStatus->live) {
// is live
if (getApp()->notifications->isChannelNotified(
twchn->getName()) &&
!wasChannelLive(twchn->getName())) {
sendChannelNotification(twchn->getName());
}
updateLiveChannels(twchn->getName());
} else {
// is Offline
removeFromLiveChannels(twchn->getName());
}
});
});
}
void Toasts::updateLiveChannels(const QString &channelName)
{
if (!wasChannelLive(channelName)) {
std::lock_guard<std::mutex> lock(mutex_);
liveChannels.push_back(channelName);
}
}
void Toasts::removeFromLiveChannels(const QString &channelName)
{
if (wasChannelLive(channelName)) {
std::lock_guard<std::mutex> lock(mutex_);
liveChannels.erase(
std::find(liveChannels.begin(), liveChannels.end(), channelName));
}
}
bool Toasts::wasChannelLive(const QString &channelName)
{
std::lock_guard<std::mutex> lock(mutex_);
for (const auto &str : liveChannels) {
if (str == channelName) {
return true;
}
}
return false;
}
*/
bool Toasts::isEnabled()
{
return WinToastLib::WinToast::isCompatible() &&
@@ -149,6 +93,10 @@ void Toasts::sendWindowsNotification(const QString &channelName, Platform p)
templ.setTextField(widestr, WinToastLib::WinToastTemplate::FirstLine);
templ.setTextField(L"Click here to open in browser",
WinToastLib::WinToastTemplate::SecondLine);
if (getApp()->settings->notificationPlaySound) {
templ.setAudioOption(
WinToastLib::WinToastTemplate::AudioOption::Silent);
}
WinToastLib::WinToast::instance()->setAppName(L"Chatterino2");
int mbstowcs(wchar_t * aumi_version, const char *CHATTERINO_VERSION,
size_t size);