2018-08-09 15:41:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/SignalVector.hpp"
|
|
|
|
#include "singletons/Settings.hpp"
|
|
|
|
|
2018-08-25 14:13:26 +02:00
|
|
|
#include <QTimer>
|
|
|
|
|
2018-08-09 15:41:03 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Settings;
|
|
|
|
class Paths;
|
|
|
|
|
|
|
|
class NotificationModel;
|
|
|
|
|
2018-08-12 18:54:32 +02:00
|
|
|
enum class Platform : uint8_t {
|
2018-08-12 21:05:12 +02:00
|
|
|
Twitch, // 0
|
|
|
|
// Mixer, // 1
|
2018-08-12 18:54:32 +02:00
|
|
|
};
|
|
|
|
|
2018-08-26 13:19:09 +02:00
|
|
|
class NotificationController final : public Singleton, private QObject
|
2018-08-09 15:41:03 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void initialize(Settings &settings, Paths &paths) override;
|
|
|
|
|
2018-08-12 18:54:32 +02:00
|
|
|
bool isChannelNotified(const QString &channelName, Platform p);
|
|
|
|
void updateChannelNotification(const QString &channelName, Platform p);
|
2018-08-12 20:21:21 +02:00
|
|
|
void addChannelNotification(const QString &channelName, Platform p);
|
|
|
|
void removeChannelNotification(const QString &channelName, Platform p);
|
|
|
|
|
|
|
|
void playSound();
|
2018-08-09 15:41:03 +02:00
|
|
|
|
2018-08-12 18:54:32 +02:00
|
|
|
UnsortedSignalVector<QString> getVector(Platform p);
|
2018-08-09 15:41:03 +02:00
|
|
|
|
2018-08-12 20:21:21 +02:00
|
|
|
std::map<Platform, UnsortedSignalVector<QString>> channelMap;
|
2018-08-12 15:29:40 +02:00
|
|
|
|
2018-08-12 18:54:32 +02:00
|
|
|
NotificationModel *createModel(QObject *parent, Platform p);
|
2018-08-09 15:41:03 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool initialized_ = false;
|
2018-08-26 13:19:09 +02:00
|
|
|
|
|
|
|
void fetchFakeChannels();
|
2018-08-25 14:13:26 +02:00
|
|
|
void removeFakeChannel(const QString channelName);
|
|
|
|
void getFakeTwitchChannelLiveStatus(const QString &channelName);
|
|
|
|
|
2018-08-26 13:19:09 +02:00
|
|
|
std::vector<QString> fakeTwitchChannels;
|
|
|
|
QTimer *liveStatusTimer_;
|
|
|
|
|
2018-08-12 15:29:40 +02:00
|
|
|
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
|
|
|
|
"/notifications/twitch"};
|
2018-08-12 21:05:12 +02:00
|
|
|
/*
|
2018-08-12 15:29:40 +02:00
|
|
|
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
|
|
|
|
"/notifications/mixer"};
|
2018-08-12 21:05:12 +02:00
|
|
|
*/
|
2018-08-09 15:41:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|