mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
refactor stuff
This commit is contained in:
parent
ae95528236
commit
ab814d1e63
12 changed files with 123 additions and 132 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include "channelmanager.hpp"
|
||||
#include "colorscheme.hpp"
|
||||
#include "completionmanager.hpp"
|
||||
#include "emotemanager.hpp"
|
||||
#include "ircmanager.hpp"
|
||||
#include "messagefactory.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "windowmanager.hpp"
|
||||
#include "completionmanager.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
|
|
@ -14,27 +14,25 @@
|
|||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace chatterino::messages;
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
Channel::Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
|
||||
IrcManager &_ircManager, const QString &channel, bool isSpecial)
|
||||
IrcManager &_ircManager, const QString &channelName, bool isSpecial)
|
||||
: windowManager(_windowManager)
|
||||
, emoteManager(_emoteManager)
|
||||
, ircManager(_ircManager)
|
||||
, _name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1) : channel)
|
||||
, bttvChannelEmotes(this->emoteManager.bttvChannels[channel])
|
||||
, ffzChannelEmotes(this->emoteManager.ffzChannels[channel])
|
||||
, _subLink("https://www.twitch.tv/" + _name + "/subscribe?ref=in_chat_subscriber_link")
|
||||
, _channelLink("https://twitch.tv/" + _name)
|
||||
, _popoutPlayerLink("https://player.twitch.tv/?channel=" + _name)
|
||||
, name(channelName)
|
||||
, bttvChannelEmotes(this->emoteManager.bttvChannels[channelName])
|
||||
, ffzChannelEmotes(this->emoteManager.ffzChannels[channelName])
|
||||
, _subLink("https://www.twitch.tv/" + name + "/subscribe?ref=in_chat_subscriber_link")
|
||||
, _channelLink("https://twitch.tv/" + name)
|
||||
, _popoutPlayerLink("https://player.twitch.tv/?channel=" + name)
|
||||
// , _loggingChannel(logging::get(_name))
|
||||
{
|
||||
qDebug() << "Open channel:" << channel << ". Name: " << _name;
|
||||
printf("Channel pointer: %p\n", this);
|
||||
qDebug() << "Open channel:" << this->name;
|
||||
|
||||
if (!isSpecial) {
|
||||
this->reloadChannelEmotes();
|
||||
}
|
||||
|
@ -43,24 +41,10 @@ Channel::Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
|
|||
//
|
||||
// properties
|
||||
//
|
||||
EmoteManager::EmoteMap &Channel::getBTTVChannelEmotes()
|
||||
{
|
||||
return this->bttvChannelEmotes;
|
||||
}
|
||||
|
||||
EmoteManager::EmoteMap &Channel::getFFZChannelEmotes()
|
||||
{
|
||||
return this->ffzChannelEmotes;
|
||||
}
|
||||
|
||||
bool Channel::isEmpty() const
|
||||
{
|
||||
return _name.isEmpty();
|
||||
}
|
||||
|
||||
const QString &Channel::getName() const
|
||||
{
|
||||
return _name;
|
||||
return name.isEmpty();
|
||||
}
|
||||
|
||||
const QString &Channel::getSubLink() const
|
||||
|
@ -126,15 +110,15 @@ void Channel::addMessage(std::shared_ptr<Message> message)
|
|||
// private methods
|
||||
void Channel::reloadChannelEmotes()
|
||||
{
|
||||
printf("[Channel:%s] Reloading channel emotes\n", qPrintable(this->_name));
|
||||
this->emoteManager.reloadBTTVChannelEmotes(this->_name);
|
||||
this->emoteManager.reloadFFZChannelEmotes(this->_name);
|
||||
printf("[Channel:%s] Reloading channel emotes\n", qPrintable(this->name));
|
||||
this->emoteManager.reloadBTTVChannelEmotes(this->name);
|
||||
this->emoteManager.reloadFFZChannelEmotes(this->name);
|
||||
}
|
||||
|
||||
void Channel::sendMessage(const QString &message)
|
||||
{
|
||||
qDebug() << "Channel send message: " << message;
|
||||
this->ircManager.sendMessage(_name, message);
|
||||
this->ircManager.sendMessage(name, message);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -26,17 +26,12 @@ class Channel
|
|||
{
|
||||
public:
|
||||
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 &)> messageAppended;
|
||||
|
||||
// properties
|
||||
EmoteManager::EmoteMap &getBTTVChannelEmotes();
|
||||
EmoteManager::EmoteMap &getFFZChannelEmotes();
|
||||
|
||||
bool isEmpty() const;
|
||||
const QString &getName() const;
|
||||
const QString &getSubLink() const;
|
||||
const QString &getChannelLink() const;
|
||||
const QString &getPopoutPlayerLink() const;
|
||||
|
@ -53,20 +48,21 @@ public:
|
|||
void sendMessage(const QString &message);
|
||||
|
||||
std::string roomID;
|
||||
const QString name;
|
||||
|
||||
private:
|
||||
WindowManager &windowManager;
|
||||
EmoteManager &emoteManager;
|
||||
IrcManager &ircManager;
|
||||
|
||||
// variabeles
|
||||
// variables
|
||||
messages::LimitedQueue<messages::SharedMessage> _messages;
|
||||
|
||||
QString _name;
|
||||
|
||||
EmoteManager::EmoteMap &bttvChannelEmotes;
|
||||
EmoteManager::EmoteMap &ffzChannelEmotes;
|
||||
public:
|
||||
const EmoteManager::EmoteMap &bttvChannelEmotes;
|
||||
const EmoteManager::EmoteMap &ffzChannelEmotes;
|
||||
|
||||
private:
|
||||
QString _subLink;
|
||||
QString _channelLink;
|
||||
QString _popoutPlayerLink;
|
||||
|
|
|
@ -8,56 +8,45 @@ ChannelManager::ChannelManager(WindowManager &_windowManager, EmoteManager &_emo
|
|||
: windowManager(_windowManager)
|
||||
, emoteManager(_emoteManager)
|
||||
, ircManager(_ircManager)
|
||||
, _whispers(new Channel(_windowManager, _emoteManager, _ircManager, "/whispers", true))
|
||||
, _mentions(new Channel(_windowManager, _emoteManager, _ircManager, "/mentions", true))
|
||||
, _empty(new Channel(_windowManager, _emoteManager, _ircManager, QString(), true))
|
||||
, whispersChannel(new Channel(_windowManager, _emoteManager, _ircManager, "/whispers", true))
|
||||
, mentionsChannel(new Channel(_windowManager, _emoteManager, _ircManager, "/mentions", 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()
|
||||
{
|
||||
QMutexLocker locker(&_channelsMutex);
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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 (channel.length() > 1 && channel.at(0) == '/') {
|
||||
return getChannel(channel);
|
||||
if (channelName.length() > 1 && channelName.at(0) == '/') {
|
||||
return this->getChannel(channelName);
|
||||
}
|
||||
|
||||
auto it = _channels.find(channelName);
|
||||
if (channelName.length() > 0 && channelName.at(0) == '#') {
|
||||
channelName = channelName.mid(1);
|
||||
}
|
||||
|
||||
if (it == _channels.end()) {
|
||||
auto channel = std::shared_ptr<Channel>(
|
||||
new Channel(this->windowManager, this->emoteManager, this->ircManager, channelName));
|
||||
_channels.insert(channelName, std::make_tuple(channel, 1));
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
auto it = this->channels.find(channelName);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -71,26 +60,26 @@ std::shared_ptr<Channel> ChannelManager::addChannel(const QString &channel)
|
|||
|
||||
std::shared_ptr<Channel> ChannelManager::getChannel(const QString &channel)
|
||||
{
|
||||
QMutexLocker locker(&_channelsMutex);
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
QString c = channel.toLower();
|
||||
|
||||
if (channel.length() > 1 && channel.at(0) == '/') {
|
||||
if (c == "/whispers") {
|
||||
return _whispers;
|
||||
return whispersChannel;
|
||||
}
|
||||
|
||||
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()) {
|
||||
return _empty;
|
||||
if (a == this->channels.end()) {
|
||||
return emptyChannel;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QMutexLocker locker(&_channelsMutex);
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
if (channel.length() > 1 && channel.at(0) == '/') {
|
||||
return;
|
||||
|
@ -106,9 +95,9 @@ void ChannelManager::removeChannel(const QString &channel)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -116,7 +105,7 @@ void ChannelManager::removeChannel(const QString &channel)
|
|||
|
||||
if (std::get<1>(a.value()) == 0) {
|
||||
this->ircManager.partChannel(c);
|
||||
_channels.remove(c);
|
||||
this->channels.remove(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ class IrcManager;
|
|||
|
||||
class ChannelManager
|
||||
{
|
||||
WindowManager &windowManager;
|
||||
EmoteManager &emoteManager;
|
||||
IrcManager &ircManager;
|
||||
|
||||
public:
|
||||
explicit ChannelManager(WindowManager &_windowManager, EmoteManager &_emoteManager,
|
||||
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();
|
||||
|
||||
std::shared_ptr<Channel> addChannel(const QString &channel);
|
||||
|
@ -29,20 +29,17 @@ public:
|
|||
|
||||
const std::string &getUserID(const std::string &username);
|
||||
|
||||
private:
|
||||
WindowManager &windowManager;
|
||||
EmoteManager &emoteManager;
|
||||
IrcManager &ircManager;
|
||||
// Special channels
|
||||
const std::shared_ptr<Channel> whispersChannel;
|
||||
const std::shared_ptr<Channel> mentionsChannel;
|
||||
const std::shared_ptr<Channel> emptyChannel;
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> usernameToID;
|
||||
std::map<std::string, ChannelData> channelDatas;
|
||||
|
||||
QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> _channels;
|
||||
QMutex _channelsMutex;
|
||||
|
||||
std::shared_ptr<Channel> _whispers;
|
||||
std::shared_ptr<Channel> _mentions;
|
||||
std::shared_ptr<Channel> _empty;
|
||||
QMutex channelsMutex;
|
||||
QMap<QString, std::tuple<std::shared_ptr<Channel>, int>> channels;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -115,14 +115,9 @@ ConcurrentMap<QString, twitch::EmoteValue *> &EmoteManager::getTwitchEmotes()
|
|||
return _twitchEmotes;
|
||||
}
|
||||
|
||||
EmoteManager::EmoteMap &EmoteManager::getBTTVEmotes()
|
||||
{
|
||||
return _bttvEmotes;
|
||||
}
|
||||
|
||||
EmoteManager::EmoteMap &EmoteManager::getFFZEmotes()
|
||||
{
|
||||
return _ffzEmotes;
|
||||
return ffzGlobalEmotes;
|
||||
}
|
||||
|
||||
EmoteManager::EmoteMap &EmoteManager::getChatterinoEmotes()
|
||||
|
@ -313,7 +308,7 @@ void EmoteManager::loadBTTVEmotes()
|
|||
tmp.detach();
|
||||
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 + "\nGlobal BTTV Emote"));
|
||||
}
|
||||
|
@ -356,7 +351,7 @@ void EmoteManager::loadFFZEmotes()
|
|||
QJsonObject urls = object.value("urls").toObject();
|
||||
QString url1 = "http:" + urls.value("1").toString();
|
||||
|
||||
EmoteManager::getBTTVEmotes().insert(
|
||||
this->ffzGlobalEmotes.insert(
|
||||
code, new LazyLoadedImage(*this, this->windowManager, url1, 1, code,
|
||||
code + "\nGlobal FFZ Emote"));
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
void reloadFFZChannelEmotes(const QString &channelName);
|
||||
|
||||
ConcurrentMap<QString, twitch::EmoteValue *> &getTwitchEmotes();
|
||||
EmoteMap &getBTTVEmotes();
|
||||
EmoteMap &getFFZEmotes();
|
||||
EmoteMap &getChatterinoEmotes();
|
||||
EmoteMap &getBTTVChannelEmoteFromCaches();
|
||||
|
@ -91,7 +90,13 @@ public:
|
|||
|
||||
private:
|
||||
/// Twitch emotes
|
||||
// username emote code
|
||||
ConcurrentStdMap<QString, std::vector<QString>> twitchAccountEmotes;
|
||||
|
||||
// emote code
|
||||
ConcurrentMap<QString, twitch::EmoteValue *> _twitchEmotes;
|
||||
|
||||
// emote id
|
||||
ConcurrentMap<long, EmoteData> _twitchEmoteFromCache;
|
||||
|
||||
/// BTTV emotes
|
||||
|
@ -99,11 +104,10 @@ private:
|
|||
|
||||
public:
|
||||
ConcurrentMap<QString, EmoteMap> bttvChannels;
|
||||
|
||||
private:
|
||||
EmoteMap _bttvEmotes;
|
||||
EmoteMap bttvGlobalEmotes;
|
||||
EmoteMap _bttvChannelEmoteFromCaches;
|
||||
|
||||
private:
|
||||
void loadBTTVEmotes();
|
||||
|
||||
/// FFZ emotes
|
||||
|
@ -111,9 +115,9 @@ private:
|
|||
|
||||
public:
|
||||
ConcurrentMap<QString, EmoteMap> ffzChannels;
|
||||
EmoteMap ffzGlobalEmotes;
|
||||
|
||||
private:
|
||||
EmoteMap _ffzEmotes;
|
||||
ConcurrentMap<int, EmoteData> _ffzChannelEmoteFromCaches;
|
||||
|
||||
void loadFFZEmotes();
|
||||
|
|
|
@ -175,8 +175,8 @@ void IrcManager::beginConnecting()
|
|||
this->readConnection->moveToThread(QCoreApplication::instance()->thread());
|
||||
|
||||
for (auto &channel : this->channelManager.getItems()) {
|
||||
this->writeConnection->sendRaw("JOIN #" + channel->getName());
|
||||
this->readConnection->sendRaw("JOIN #" + channel->getName());
|
||||
this->writeConnection->sendRaw("JOIN #" + channel->name);
|
||||
this->readConnection->sendRaw("JOIN #" + channel->name);
|
||||
}
|
||||
|
||||
this->writeConnection->open();
|
||||
|
|
|
@ -184,27 +184,17 @@ SharedMessage TwitchMessageBuilder::parse()
|
|||
continue;
|
||||
}
|
||||
|
||||
// bttv / ffz emotes
|
||||
EmoteData emoteData;
|
||||
|
||||
// TODO: Implement ignored emotes
|
||||
// Format of ignored emotes:
|
||||
// Emote name: "forsenPuke" - if string in ignoredEmotes
|
||||
// Will match emote regardless of source (i.e. bttv, ffz)
|
||||
// Emote source + name: "bttv:nyanPls"
|
||||
if (emoteManager.getBTTVEmotes().tryGet(string, emoteData) ||
|
||||
this->channel->getBTTVChannelEmotes().tryGet(string, emoteData) ||
|
||||
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())));
|
||||
|
||||
if (this->tryAppendEmote(string)) {
|
||||
// Successfully appended an emote
|
||||
continue;
|
||||
}
|
||||
|
||||
// actually just a word
|
||||
// Actually just text
|
||||
QString link = this->matchLink(string);
|
||||
|
||||
this->appendWord(Word(string, Word::Text, textColor, string, QString(),
|
||||
|
@ -255,10 +245,10 @@ void TwitchMessageBuilder::parseRoomID()
|
|||
|
||||
void TwitchMessageBuilder::parseChannelName()
|
||||
{
|
||||
QString channelName("#" + this->channel->getName());
|
||||
QString channelName("#" + this->channel->name);
|
||||
this->appendWord(Word(channelName, Word::Misc, this->colorScheme.SystemMessageColor,
|
||||
QString(channelName), QString(),
|
||||
Link(Link::Url, this->channel->getName() + "\n" + this->messageID)));
|
||||
Link(Link::Url, this->channel->name + "\n" + this->messageID)));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
const auto &channelResources = this->resources.channels[this->roomID];
|
||||
|
|
|
@ -57,6 +57,8 @@ private:
|
|||
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
|
||||
std::vector<std::pair<long, EmoteData>> &vec,
|
||||
EmoteManager &emoteManager);
|
||||
bool tryAppendEmote(QString &emoteString);
|
||||
bool appendEmote(EmoteData &emoteData);
|
||||
|
||||
void parseTwitchBadges();
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr<Channel> &channel)
|
|||
});
|
||||
|
||||
connect(_ui->btnPurge, &QPushButton::clicked, [=]() {
|
||||
qDebug() << "xD: " << _channel->getName();
|
||||
qDebug() << "xD: " << _channel->name;
|
||||
printf("Channel pointer in dialog: %p\n", _channel.get());
|
||||
|
||||
//_channel->sendMessage(QString(".timeout %1 0").arg(_ui->lblUsername->text()));
|
||||
|
|
|
@ -37,7 +37,7 @@ static int index = 0;
|
|||
ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
|
||||
: BaseWidget(parent)
|
||||
, channelManager(_channelManager)
|
||||
, channel(_channelManager.getEmpty())
|
||||
, channel(_channelManager.emptyChannel)
|
||||
, vbox(this)
|
||||
, header(this)
|
||||
, view(this)
|
||||
|
@ -130,7 +130,7 @@ void ChatWidget::channelNameUpdated(const std::string &newChannelName)
|
|||
{
|
||||
// remove current channel
|
||||
if (!this->channel->isEmpty()) {
|
||||
this->channelManager.removeChannel(this->channel->getName());
|
||||
this->channelManager.removeChannel(this->channel->name);
|
||||
|
||||
this->detachChannel();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void ChatWidget::channelNameUpdated(const std::string &newChannelName)
|
|||
this->messages.clear();
|
||||
|
||||
if (newChannelName.empty()) {
|
||||
this->channel = this->channelManager.getEmpty();
|
||||
this->channel = this->channelManager.emptyChannel;
|
||||
} else {
|
||||
this->setChannel(this->channelManager.addChannel(QString::fromStdString(newChannelName)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue