refactor stuff

This commit is contained in:
Rasmus Karlsson 2017-07-23 09:53:50 +02:00
parent ae95528236
commit ab814d1e63
12 changed files with 123 additions and 132 deletions

View file

@ -2,12 +2,12 @@
#include "channelmanager.hpp" #include "channelmanager.hpp"
#include "colorscheme.hpp" #include "colorscheme.hpp"
#include "completionmanager.hpp"
#include "emotemanager.hpp" #include "emotemanager.hpp"
#include "ircmanager.hpp" #include "ircmanager.hpp"
#include "messagefactory.hpp" #include "messagefactory.hpp"
#include "resources.hpp" #include "resources.hpp"
#include "windowmanager.hpp" #include "windowmanager.hpp"
#include "completionmanager.hpp"
#include <QApplication> #include <QApplication>

View file

@ -14,27 +14,25 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <memory>
using namespace chatterino::messages; using namespace chatterino::messages;
namespace chatterino { namespace chatterino {
Channel::Channel(WindowManager &_windowManager, EmoteManager &_emoteManager, Channel::Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
IrcManager &_ircManager, const QString &channel, bool isSpecial) IrcManager &_ircManager, const QString &channelName, bool isSpecial)
: windowManager(_windowManager) : windowManager(_windowManager)
, emoteManager(_emoteManager) , emoteManager(_emoteManager)
, ircManager(_ircManager) , ircManager(_ircManager)
, _name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1) : channel) , name(channelName)
, bttvChannelEmotes(this->emoteManager.bttvChannels[channel]) , bttvChannelEmotes(this->emoteManager.bttvChannels[channelName])
, ffzChannelEmotes(this->emoteManager.ffzChannels[channel]) , ffzChannelEmotes(this->emoteManager.ffzChannels[channelName])
, _subLink("https://www.twitch.tv/" + _name + "/subscribe?ref=in_chat_subscriber_link") , _subLink("https://www.twitch.tv/" + name + "/subscribe?ref=in_chat_subscriber_link")
, _channelLink("https://twitch.tv/" + _name) , _channelLink("https://twitch.tv/" + name)
, _popoutPlayerLink("https://player.twitch.tv/?channel=" + _name) , _popoutPlayerLink("https://player.twitch.tv/?channel=" + name)
// , _loggingChannel(logging::get(_name)) // , _loggingChannel(logging::get(_name))
{ {
qDebug() << "Open channel:" << channel << ". Name: " << _name; qDebug() << "Open channel:" << this->name;
printf("Channel pointer: %p\n", this);
if (!isSpecial) { if (!isSpecial) {
this->reloadChannelEmotes(); this->reloadChannelEmotes();
} }
@ -43,24 +41,10 @@ Channel::Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
// //
// properties // properties
// //
EmoteManager::EmoteMap &Channel::getBTTVChannelEmotes()
{
return this->bttvChannelEmotes;
}
EmoteManager::EmoteMap &Channel::getFFZChannelEmotes()
{
return this->ffzChannelEmotes;
}
bool Channel::isEmpty() const bool Channel::isEmpty() const
{ {
return _name.isEmpty(); return name.isEmpty();
}
const QString &Channel::getName() const
{
return _name;
} }
const QString &Channel::getSubLink() const const QString &Channel::getSubLink() const
@ -126,15 +110,15 @@ void Channel::addMessage(std::shared_ptr<Message> message)
// private methods // private methods
void Channel::reloadChannelEmotes() void Channel::reloadChannelEmotes()
{ {
printf("[Channel:%s] Reloading channel emotes\n", qPrintable(this->_name)); printf("[Channel:%s] Reloading channel emotes\n", qPrintable(this->name));
this->emoteManager.reloadBTTVChannelEmotes(this->_name); this->emoteManager.reloadBTTVChannelEmotes(this->name);
this->emoteManager.reloadFFZChannelEmotes(this->_name); this->emoteManager.reloadFFZChannelEmotes(this->name);
} }
void Channel::sendMessage(const QString &message) void Channel::sendMessage(const QString &message)
{ {
qDebug() << "Channel send message: " << message; qDebug() << "Channel send message: " << message;
this->ircManager.sendMessage(_name, message); this->ircManager.sendMessage(name, message);
} }
} // namespace chatterino } // namespace chatterino

View file

@ -26,17 +26,12 @@ class Channel
{ {
public: public:
explicit Channel(WindowManager &_windowManager, EmoteManager &_emoteManager, explicit Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
IrcManager &_ircManager, const QString &channel, bool isSpecial = false); IrcManager &_ircManager, const QString &channelName, bool isSpecial = false);
boost::signals2::signal<void(messages::SharedMessage &)> messageRemovedFromStart; boost::signals2::signal<void(messages::SharedMessage &)> messageRemovedFromStart;
boost::signals2::signal<void(messages::SharedMessage &)> messageAppended; boost::signals2::signal<void(messages::SharedMessage &)> messageAppended;
// properties
EmoteManager::EmoteMap &getBTTVChannelEmotes();
EmoteManager::EmoteMap &getFFZChannelEmotes();
bool isEmpty() const; bool isEmpty() const;
const QString &getName() const;
const QString &getSubLink() const; const QString &getSubLink() const;
const QString &getChannelLink() const; const QString &getChannelLink() const;
const QString &getPopoutPlayerLink() const; const QString &getPopoutPlayerLink() const;
@ -53,20 +48,21 @@ public:
void sendMessage(const QString &message); void sendMessage(const QString &message);
std::string roomID; std::string roomID;
const QString name;
private: private:
WindowManager &windowManager; WindowManager &windowManager;
EmoteManager &emoteManager; EmoteManager &emoteManager;
IrcManager &ircManager; IrcManager &ircManager;
// variabeles // variables
messages::LimitedQueue<messages::SharedMessage> _messages; messages::LimitedQueue<messages::SharedMessage> _messages;
QString _name; public:
const EmoteManager::EmoteMap &bttvChannelEmotes;
EmoteManager::EmoteMap &bttvChannelEmotes; const EmoteManager::EmoteMap &ffzChannelEmotes;
EmoteManager::EmoteMap &ffzChannelEmotes;
private:
QString _subLink; QString _subLink;
QString _channelLink; QString _channelLink;
QString _popoutPlayerLink; QString _popoutPlayerLink;

View file

@ -8,56 +8,45 @@ ChannelManager::ChannelManager(WindowManager &_windowManager, EmoteManager &_emo
: windowManager(_windowManager) : windowManager(_windowManager)
, emoteManager(_emoteManager) , emoteManager(_emoteManager)
, ircManager(_ircManager) , ircManager(_ircManager)
, _whispers(new Channel(_windowManager, _emoteManager, _ircManager, "/whispers", true)) , whispersChannel(new Channel(_windowManager, _emoteManager, _ircManager, "/whispers", true))
, _mentions(new Channel(_windowManager, _emoteManager, _ircManager, "/mentions", true)) , mentionsChannel(new Channel(_windowManager, _emoteManager, _ircManager, "/mentions", true))
, _empty(new Channel(_windowManager, _emoteManager, _ircManager, QString(), true)) , emptyChannel(new Channel(_windowManager, _emoteManager, _ircManager, "", true))
{ {
} }
std::shared_ptr<Channel> ChannelManager::getWhispers()
{
return _whispers;
}
std::shared_ptr<Channel> ChannelManager::getMentions()
{
return _mentions;
}
std::shared_ptr<Channel> ChannelManager::getEmpty()
{
return _empty;
}
const std::vector<std::shared_ptr<Channel>> ChannelManager::getItems() const std::vector<std::shared_ptr<Channel>> ChannelManager::getItems()
{ {
QMutexLocker locker(&_channelsMutex); QMutexLocker locker(&this->channelsMutex);
std::vector<std::shared_ptr<Channel>> items; std::vector<std::shared_ptr<Channel>> items;
for (auto &item : _channels.values()) { for (auto &item : this->channels.values()) {
items.push_back(std::get<0>(item)); items.push_back(std::get<0>(item));
} }
return items; return items;
} }
std::shared_ptr<Channel> ChannelManager::addChannel(const QString &channel) std::shared_ptr<Channel> ChannelManager::addChannel(const QString &rawChannelName)
{ {
QMutexLocker locker(&_channelsMutex); QString channelName = rawChannelName.toLower();
QString channelName = channel.toLower(); if (channelName.length() > 1 && channelName.at(0) == '/') {
return this->getChannel(channelName);
if (channel.length() > 1 && channel.at(0) == '/') {
return getChannel(channel);
} }
auto it = _channels.find(channelName); if (channelName.length() > 0 && channelName.at(0) == '#') {
channelName = channelName.mid(1);
}
if (it == _channels.end()) { QMutexLocker locker(&this->channelsMutex);
auto channel = std::shared_ptr<Channel>(
new Channel(this->windowManager, this->emoteManager, this->ircManager, channelName)); auto it = this->channels.find(channelName);
_channels.insert(channelName, std::make_tuple(channel, 1));
if (it == this->channels.end()) {
auto channel = std::make_shared<Channel>(this->windowManager, this->emoteManager,
this->ircManager, channelName);
this->channels.insert(channelName, std::make_tuple(channel, 1));
this->ircManager.joinChannel(channelName); this->ircManager.joinChannel(channelName);
@ -71,26 +60,26 @@ std::shared_ptr<Channel> ChannelManager::addChannel(const QString &channel)
std::shared_ptr<Channel> ChannelManager::getChannel(const QString &channel) std::shared_ptr<Channel> ChannelManager::getChannel(const QString &channel)
{ {
QMutexLocker locker(&_channelsMutex); QMutexLocker locker(&this->channelsMutex);
QString c = channel.toLower(); QString c = channel.toLower();
if (channel.length() > 1 && channel.at(0) == '/') { if (channel.length() > 1 && channel.at(0) == '/') {
if (c == "/whispers") { if (c == "/whispers") {
return _whispers; return whispersChannel;
} }
if (c == "/mentions") { if (c == "/mentions") {
return _mentions; return mentionsChannel;
} }
return _empty; return emptyChannel;
} }
auto a = _channels.find(c); auto a = this->channels.find(c);
if (a == _channels.end()) { if (a == this->channels.end()) {
return _empty; return emptyChannel;
} }
return std::get<0>(a.value()); return std::get<0>(a.value());
@ -98,7 +87,7 @@ std::shared_ptr<Channel> ChannelManager::getChannel(const QString &channel)
void ChannelManager::removeChannel(const QString &channel) void ChannelManager::removeChannel(const QString &channel)
{ {
QMutexLocker locker(&_channelsMutex); QMutexLocker locker(&this->channelsMutex);
if (channel.length() > 1 && channel.at(0) == '/') { if (channel.length() > 1 && channel.at(0) == '/') {
return; return;
@ -106,9 +95,9 @@ void ChannelManager::removeChannel(const QString &channel)
QString c = channel.toLower(); QString c = channel.toLower();
auto a = _channels.find(c); auto a = this->channels.find(c);
if (a == _channels.end()) { if (a == this->channels.end()) {
return; return;
} }
@ -116,7 +105,7 @@ void ChannelManager::removeChannel(const QString &channel)
if (std::get<1>(a.value()) == 0) { if (std::get<1>(a.value()) == 0) {
this->ircManager.partChannel(c); this->ircManager.partChannel(c);
_channels.remove(c); this->channels.remove(c);
} }
} }

View file

@ -13,14 +13,14 @@ class IrcManager;
class ChannelManager class ChannelManager
{ {
WindowManager &windowManager;
EmoteManager &emoteManager;
IrcManager &ircManager;
public: public:
explicit ChannelManager(WindowManager &_windowManager, EmoteManager &_emoteManager, explicit ChannelManager(WindowManager &_windowManager, EmoteManager &_emoteManager,
IrcManager &_ircManager); IrcManager &_ircManager);
std::shared_ptr<Channel> getWhispers();
std::shared_ptr<Channel> getMentions();
std::shared_ptr<Channel> getEmpty();
const std::vector<std::shared_ptr<Channel>> getItems(); const std::vector<std::shared_ptr<Channel>> getItems();
std::shared_ptr<Channel> addChannel(const QString &channel); std::shared_ptr<Channel> addChannel(const QString &channel);
@ -29,20 +29,17 @@ public:
const std::string &getUserID(const std::string &username); const std::string &getUserID(const std::string &username);
private: // Special channels
WindowManager &windowManager; const std::shared_ptr<Channel> whispersChannel;
EmoteManager &emoteManager; const std::shared_ptr<Channel> mentionsChannel;
IrcManager &ircManager; const std::shared_ptr<Channel> emptyChannel;
private:
std::map<std::string, std::string> usernameToID; std::map<std::string, std::string> usernameToID;
std::map<std::string, ChannelData> channelDatas; std::map<std::string, ChannelData> channelDatas;
QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> _channels; QMutex channelsMutex;
QMutex _channelsMutex; QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> channels;
std::shared_ptr<Channel> _whispers;
std::shared_ptr<Channel> _mentions;
std::shared_ptr<Channel> _empty;
}; };
} // namespace chatterino } // namespace chatterino

View file

@ -115,14 +115,9 @@ ConcurrentMap<QString, twitch::EmoteValue *> &EmoteManager::getTwitchEmotes()
return _twitchEmotes; return _twitchEmotes;
} }
EmoteManager::EmoteMap &EmoteManager::getBTTVEmotes()
{
return _bttvEmotes;
}
EmoteManager::EmoteMap &EmoteManager::getFFZEmotes() EmoteManager::EmoteMap &EmoteManager::getFFZEmotes()
{ {
return _ffzEmotes; return ffzGlobalEmotes;
} }
EmoteManager::EmoteMap &EmoteManager::getChatterinoEmotes() EmoteManager::EmoteMap &EmoteManager::getChatterinoEmotes()
@ -313,7 +308,7 @@ void EmoteManager::loadBTTVEmotes()
tmp.detach(); tmp.detach();
QString url = tmp.replace("{{id}}", id).replace("{{image}}", "1x"); QString url = tmp.replace("{{id}}", id).replace("{{image}}", "1x");
EmoteManager::getBTTVEmotes().insert( this->bttvGlobalEmotes.insert(
code, new LazyLoadedImage(*this, this->windowManager, url, 1, code, code, new LazyLoadedImage(*this, this->windowManager, url, 1, code,
code + "\nGlobal BTTV Emote")); code + "\nGlobal BTTV Emote"));
} }
@ -356,7 +351,7 @@ void EmoteManager::loadFFZEmotes()
QJsonObject urls = object.value("urls").toObject(); QJsonObject urls = object.value("urls").toObject();
QString url1 = "http:" + urls.value("1").toString(); QString url1 = "http:" + urls.value("1").toString();
EmoteManager::getBTTVEmotes().insert( this->ffzGlobalEmotes.insert(
code, new LazyLoadedImage(*this, this->windowManager, url1, 1, code, code, new LazyLoadedImage(*this, this->windowManager, url1, 1, code,
code + "\nGlobal FFZ Emote")); code + "\nGlobal FFZ Emote"));
} }

View file

@ -44,7 +44,6 @@ public:
void reloadFFZChannelEmotes(const QString &channelName); void reloadFFZChannelEmotes(const QString &channelName);
ConcurrentMap<QString, twitch::EmoteValue *> &getTwitchEmotes(); ConcurrentMap<QString, twitch::EmoteValue *> &getTwitchEmotes();
EmoteMap &getBTTVEmotes();
EmoteMap &getFFZEmotes(); EmoteMap &getFFZEmotes();
EmoteMap &getChatterinoEmotes(); EmoteMap &getChatterinoEmotes();
EmoteMap &getBTTVChannelEmoteFromCaches(); EmoteMap &getBTTVChannelEmoteFromCaches();
@ -91,7 +90,13 @@ public:
private: private:
/// Twitch emotes /// Twitch emotes
// username emote code
ConcurrentStdMap<QString, std::vector<QString>> twitchAccountEmotes;
// emote code
ConcurrentMap<QString, twitch::EmoteValue *> _twitchEmotes; ConcurrentMap<QString, twitch::EmoteValue *> _twitchEmotes;
// emote id
ConcurrentMap<long, EmoteData> _twitchEmoteFromCache; ConcurrentMap<long, EmoteData> _twitchEmoteFromCache;
/// BTTV emotes /// BTTV emotes
@ -99,11 +104,10 @@ private:
public: public:
ConcurrentMap<QString, EmoteMap> bttvChannels; ConcurrentMap<QString, EmoteMap> bttvChannels;
EmoteMap bttvGlobalEmotes;
private:
EmoteMap _bttvEmotes;
EmoteMap _bttvChannelEmoteFromCaches; EmoteMap _bttvChannelEmoteFromCaches;
private:
void loadBTTVEmotes(); void loadBTTVEmotes();
/// FFZ emotes /// FFZ emotes
@ -111,9 +115,9 @@ private:
public: public:
ConcurrentMap<QString, EmoteMap> ffzChannels; ConcurrentMap<QString, EmoteMap> ffzChannels;
EmoteMap ffzGlobalEmotes;
private: private:
EmoteMap _ffzEmotes;
ConcurrentMap<int, EmoteData> _ffzChannelEmoteFromCaches; ConcurrentMap<int, EmoteData> _ffzChannelEmoteFromCaches;
void loadFFZEmotes(); void loadFFZEmotes();

View file

@ -175,8 +175,8 @@ void IrcManager::beginConnecting()
this->readConnection->moveToThread(QCoreApplication::instance()->thread()); this->readConnection->moveToThread(QCoreApplication::instance()->thread());
for (auto &channel : this->channelManager.getItems()) { for (auto &channel : this->channelManager.getItems()) {
this->writeConnection->sendRaw("JOIN #" + channel->getName()); this->writeConnection->sendRaw("JOIN #" + channel->name);
this->readConnection->sendRaw("JOIN #" + channel->getName()); this->readConnection->sendRaw("JOIN #" + channel->name);
} }
this->writeConnection->open(); this->writeConnection->open();

View file

@ -184,27 +184,17 @@ SharedMessage TwitchMessageBuilder::parse()
continue; continue;
} }
// bttv / ffz emotes
EmoteData emoteData;
// TODO: Implement ignored emotes // TODO: Implement ignored emotes
// Format of ignored emotes: // Format of ignored emotes:
// Emote name: "forsenPuke" - if string in ignoredEmotes // Emote name: "forsenPuke" - if string in ignoredEmotes
// Will match emote regardless of source (i.e. bttv, ffz) // Will match emote regardless of source (i.e. bttv, ffz)
// Emote source + name: "bttv:nyanPls" // Emote source + name: "bttv:nyanPls"
if (emoteManager.getBTTVEmotes().tryGet(string, emoteData) || if (this->tryAppendEmote(string)) {
this->channel->getBTTVChannelEmotes().tryGet(string, emoteData) || // Successfully appended an emote
emoteManager.getFFZEmotes().tryGet(string, emoteData) ||
this->channel->getFFZChannelEmotes().tryGet(string, emoteData) ||
emoteManager.getChatterinoEmotes().tryGet(string, emoteData)) {
this->appendWord(Word(emoteData.image, Word::BttvEmoteImage,
emoteData.image->getName(), emoteData.image->getTooltip(),
Link(Link::Url, emoteData.image->getUrl())));
continue; continue;
} }
// actually just a word // Actually just text
QString link = this->matchLink(string); QString link = this->matchLink(string);
this->appendWord(Word(string, Word::Text, textColor, string, QString(), this->appendWord(Word(string, Word::Text, textColor, string, QString(),
@ -255,10 +245,10 @@ void TwitchMessageBuilder::parseRoomID()
void TwitchMessageBuilder::parseChannelName() void TwitchMessageBuilder::parseChannelName()
{ {
QString channelName("#" + this->channel->getName()); QString channelName("#" + this->channel->name);
this->appendWord(Word(channelName, Word::Misc, this->colorScheme.SystemMessageColor, this->appendWord(Word(channelName, Word::Misc, this->colorScheme.SystemMessageColor,
QString(channelName), QString(), QString(channelName), QString(),
Link(Link::Url, this->channel->getName() + "\n" + this->messageID))); Link(Link::Url, this->channel->name + "\n" + this->messageID)));
} }
void TwitchMessageBuilder::parseUsername() void TwitchMessageBuilder::parseUsername()
@ -358,6 +348,40 @@ void TwitchMessageBuilder::appendTwitchEmote(const Communi::IrcPrivateMessage *i
} }
} }
bool TwitchMessageBuilder::tryAppendEmote(QString &emoteString)
{
EmoteData emoteData;
if (emoteManager.bttvGlobalEmotes.tryGet(emoteString, emoteData)) {
// BTTV Global Emote
return this->appendEmote(emoteData);
} else if (this->channel->bttvChannelEmotes.tryGet(emoteString, emoteData)) {
// BTTV Channel Emote
return this->appendEmote(emoteData);
} else if (emoteManager.ffzGlobalEmotes.tryGet(emoteString, emoteData)) {
// FFZ Global Emote
return this->appendEmote(emoteData);
} else if (this->channel->ffzChannelEmotes.tryGet(emoteString, emoteData)) {
// FFZ Channel Emote
return this->appendEmote(emoteData);
} else if (emoteManager.getChatterinoEmotes().tryGet(emoteString, emoteData)) {
// Chatterino Emote
return this->appendEmote(emoteData);
}
return false;
}
bool TwitchMessageBuilder::appendEmote(EmoteData &emoteData)
{
this->appendWord(Word(emoteData.image, Word::BttvEmoteImage, emoteData.image->getName(),
emoteData.image->getTooltip(),
Link(Link::Url, emoteData.image->getUrl())));
// Perhaps check for ignored emotes here?
return true;
}
void TwitchMessageBuilder::parseTwitchBadges() void TwitchMessageBuilder::parseTwitchBadges()
{ {
const auto &channelResources = this->resources.channels[this->roomID]; const auto &channelResources = this->resources.channels[this->roomID];

View file

@ -57,6 +57,8 @@ private:
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote, void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
std::vector<std::pair<long, EmoteData>> &vec, std::vector<std::pair<long, EmoteData>> &vec,
EmoteManager &emoteManager); EmoteManager &emoteManager);
bool tryAppendEmote(QString &emoteString);
bool appendEmote(EmoteData &emoteData);
void parseTwitchBadges(); void parseTwitchBadges();
}; };

View file

@ -24,7 +24,7 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr<Channel> &channel)
}); });
connect(_ui->btnPurge, &QPushButton::clicked, [=]() { connect(_ui->btnPurge, &QPushButton::clicked, [=]() {
qDebug() << "xD: " << _channel->getName(); qDebug() << "xD: " << _channel->name;
printf("Channel pointer in dialog: %p\n", _channel.get()); printf("Channel pointer in dialog: %p\n", _channel.get());
//_channel->sendMessage(QString(".timeout %1 0").arg(_ui->lblUsername->text())); //_channel->sendMessage(QString(".timeout %1 0").arg(_ui->lblUsername->text()));

View file

@ -37,7 +37,7 @@ static int index = 0;
ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent) ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
: BaseWidget(parent) : BaseWidget(parent)
, channelManager(_channelManager) , channelManager(_channelManager)
, channel(_channelManager.getEmpty()) , channel(_channelManager.emptyChannel)
, vbox(this) , vbox(this)
, header(this) , header(this)
, view(this) , view(this)
@ -130,7 +130,7 @@ void ChatWidget::channelNameUpdated(const std::string &newChannelName)
{ {
// remove current channel // remove current channel
if (!this->channel->isEmpty()) { if (!this->channel->isEmpty()) {
this->channelManager.removeChannel(this->channel->getName()); this->channelManager.removeChannel(this->channel->name);
this->detachChannel(); this->detachChannel();
} }
@ -139,7 +139,7 @@ void ChatWidget::channelNameUpdated(const std::string &newChannelName)
this->messages.clear(); this->messages.clear();
if (newChannelName.empty()) { if (newChannelName.empty()) {
this->channel = this->channelManager.getEmpty(); this->channel = this->channelManager.emptyChannel;
} else { } else {
this->setChannel(this->channelManager.addChannel(QString::fromStdString(newChannelName))); this->setChannel(this->channelManager.addChannel(QString::fromStdString(newChannelName)));
} }