mirror-chatterino2/src/controllers/notifications/NotificationController.hpp

57 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include "common/SignalVector.hpp"
#include "singletons/Settings.hpp"
#include <QTimer>
namespace chatterino {
class Settings;
class Paths;
class NotificationModel;
2018-08-12 18:54:32 +02:00
enum class Platform : uint8_t {
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
{
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);
void addChannelNotification(const QString &channelName, Platform p);
void removeChannelNotification(const QString &channelName, Platform p);
void playSound();
2018-08-12 18:54:32 +02:00
UnsortedSignalVector<QString> getVector(Platform p);
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);
private:
bool initialized_ = false;
2018-08-26 13:19:09 +02:00
void fetchFakeChannels();
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 15:29:40 +02:00
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
"/notifications/mixer"};
*/
};
} // namespace chatterino