Chatterino
NotificationController.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "common/Singleton.hpp"
6 
7 #include <QTimer>
8 
9 namespace chatterino {
10 
11 class Settings;
12 class Paths;
13 
14 class NotificationModel;
15 
16 enum class Platform : uint8_t {
17  Twitch, // 0
18 };
19 
20 class NotificationController final : public Singleton, private QObject
21 {
22 public:
23  virtual void initialize(Settings &settings, Paths &paths) override;
24 
25  bool isChannelNotified(const QString &channelName, Platform p);
26  void updateChannelNotification(const QString &channelName, Platform p);
27  void addChannelNotification(const QString &channelName, Platform p);
28  void removeChannelNotification(const QString &channelName, Platform p);
29 
30  void playSound();
31 
32  SignalVector<QString> getVector(Platform p);
33 
34  std::map<Platform, SignalVector<QString>> channelMap;
35 
36  NotificationModel *createModel(QObject *parent, Platform p);
37 
38 private:
39  bool initialized_ = false;
40 
41  void fetchFakeChannels();
42  void removeFakeChannel(const QString channelName);
43  void checkStream(bool live, QString channelName);
44 
45  // fakeTwitchChannels is a list of streams who are live that we have already sent out a notification for
46  std::vector<QString> fakeTwitchChannels;
47  QTimer *liveStatusTimer_;
48 
49  ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
50  "/notifications/twitch"};
51 };
52 
53 } // namespace chatterino
Definition: ChatterinoSetting.hpp:11
std::map< Platform, SignalVector< QString > > channelMap
Definition: NotificationController.hpp:34
Definition: Singleton.hpp:10
Definition: Application.cpp:48
Platform
Definition: NotificationController.hpp:16
Definition: NotificationModel.hpp:12
Settings which are availlable for reading and writing on the gui thread.
Definition: Settings.hpp:78
Definition: Paths.hpp:8
Definition: NotificationController.hpp:20