2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "channel.hpp"
|
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 ChannelManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static ChannelManager &getInstance()
|
|
|
|
{
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
std::shared_ptr<Channel> getWhispers();
|
|
|
|
std::shared_ptr<Channel> getMentions();
|
|
|
|
std::shared_ptr<Channel> getEmpty();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
const std::vector<std::shared_ptr<Channel>> getItems();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
std::shared_ptr<Channel> addChannel(const QString &channel);
|
|
|
|
std::shared_ptr<Channel> getChannel(const QString &channel);
|
2017-04-12 17:46:44 +02:00
|
|
|
void removeChannel(const QString &channel);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static ChannelManager instance;
|
|
|
|
|
|
|
|
ChannelManager();
|
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> _channels;
|
2017-04-12 17:46:44 +02:00
|
|
|
QMutex _channelsMutex;
|
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
std::shared_ptr<Channel> _whispers;
|
|
|
|
std::shared_ptr<Channel> _mentions;
|
|
|
|
std::shared_ptr<Channel> _empty;
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|