made channels shared_pointers

This commit is contained in:
fourtf
2017-01-30 19:14:25 +01:00
parent 23c2bf03d6
commit 1d1c98ecdb
9 changed files with 90 additions and 42 deletions
+19 -10
View File
@@ -8,20 +8,28 @@ namespace chatterino {
class Channels
{
public:
static Channel *
static std::shared_ptr<Channel>
getWhispers()
{
return &whispers;
return whispers;
}
static Channel *
static std::shared_ptr<Channel>
getMentions()
{
return &mentions;
return mentions;
}
static Channel *addChannel(const QString &channel);
static Channel *getChannel(const QString &channel);
static std::shared_ptr<Channel>
getEmpty()
{
return empty;
}
const static std::vector<std::shared_ptr<Channel>> getItems();
static std::shared_ptr<Channel> addChannel(const QString &channel);
static std::shared_ptr<Channel> getChannel(const QString &channel);
static void removeChannel(const QString &channel);
private:
@@ -29,11 +37,12 @@ private:
{
}
static Channel whispers;
static Channel mentions;
static Channel empty;
static std::shared_ptr<Channel> whispers;
static std::shared_ptr<Channel> mentions;
static std::shared_ptr<Channel> empty;
static QMap<QString, std::tuple<Channel *, int>> channels;
static QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> channels;
static QMutex channelsMutex;
};
}
#endif // CHANNELS_H