mirror-chatterino2/src/channelmanager.hpp

48 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
2017-04-12 17:46:44 +02:00
2017-06-11 09:31:45 +02:00
#include "channel.hpp"
2017-06-15 23:13:01 +02:00
#include "channeldata.hpp"
#include "twitch/twitchchannel.hpp"
2017-06-15 23:13:01 +02:00
#include <map>
2017-04-12 17:46:44 +02:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
2017-04-12 17:46:44 +02:00
class WindowManager;
class IrcManager;
2017-04-12 17:46:44 +02:00
class ChannelManager
{
public:
2017-12-17 02:18:13 +01:00
explicit ChannelManager(WindowManager &_windowManager, IrcManager &_ircManager);
2017-04-12 17:46:44 +02:00
static ChannelManager *instance;
WindowManager &windowManager;
IrcManager &ircManager;
const std::vector<std::shared_ptr<Channel>> getItems();
2017-04-12 17:46:44 +02:00
std::shared_ptr<twitch::TwitchChannel> addTwitchChannel(const QString &channel);
std::shared_ptr<twitch::TwitchChannel> getTwitchChannel(const QString &channel);
void removeTwitchChannel(const QString &channel);
2017-04-12 17:46:44 +02:00
2017-06-15 23:13:01 +02:00
const std::string &getUserID(const std::string &username);
void doOnAll(std::function<void(std::shared_ptr<twitch::TwitchChannel>)> func);
2017-07-23 09:53:50 +02:00
// Special channels
const std::shared_ptr<twitch::TwitchChannel> whispersChannel;
const std::shared_ptr<twitch::TwitchChannel> mentionsChannel;
const std::shared_ptr<twitch::TwitchChannel> emptyChannel;
2017-04-12 17:46:44 +02:00
2017-07-23 09:53:50 +02:00
private:
2017-06-15 23:13:01 +02:00
std::map<std::string, std::string> usernameToID;
std::map<std::string, ChannelData> channelDatas;
2017-07-23 09:53:50 +02:00
QMutex channelsMutex;
QMap<QString, std::tuple<std::shared_ptr<twitch::TwitchChannel>, int>> twitchChannels;
2017-04-12 17:46:44 +02:00
};
2017-04-14 17:52:22 +02:00
} // namespace chatterino