mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Merge branch 'master' of https://github.com/fourtf/chatterino2
This commit is contained in:
commit
266ad36de3
35 changed files with 150 additions and 251 deletions
|
@ -10,13 +10,10 @@ namespace chatterino {
|
||||||
// It will create the instances of the major classes, and connect their signals to each other
|
// It will create the instances of the major classes, and connect their signals to each other
|
||||||
|
|
||||||
Application::Application()
|
Application::Application()
|
||||||
: completionManager(this->emoteManager)
|
: windowManager(this->channelManager, this->colorScheme)
|
||||||
, windowManager(this->channelManager, this->colorScheme, this->completionManager)
|
|
||||||
, colorScheme(this->windowManager)
|
, colorScheme(this->windowManager)
|
||||||
, emoteManager(this->windowManager)
|
, channelManager(this->windowManager, this->ircManager)
|
||||||
, resources(this->emoteManager, this->windowManager)
|
, ircManager(this->channelManager, this->resources, this->windowManager)
|
||||||
, channelManager(this->windowManager, this->emoteManager, this->ircManager)
|
|
||||||
, ircManager(this->channelManager, this->resources, this->emoteManager, this->windowManager)
|
|
||||||
{
|
{
|
||||||
logging::init();
|
logging::init();
|
||||||
SettingsManager::getInstance().load();
|
SettingsManager::getInstance().load();
|
||||||
|
@ -24,7 +21,7 @@ Application::Application()
|
||||||
this->windowManager.initMainWindow();
|
this->windowManager.initMainWindow();
|
||||||
|
|
||||||
// Initialize everything we need
|
// Initialize everything we need
|
||||||
this->emoteManager.loadGlobalEmotes();
|
EmoteManager::getInstance().loadGlobalEmotes();
|
||||||
|
|
||||||
AccountManager::getInstance().load();
|
AccountManager::getInstance().load();
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,8 @@ public:
|
||||||
|
|
||||||
int run(QApplication &qtApp);
|
int run(QApplication &qtApp);
|
||||||
|
|
||||||
CompletionManager completionManager;
|
|
||||||
WindowManager windowManager;
|
WindowManager windowManager;
|
||||||
ColorScheme colorScheme;
|
ColorScheme colorScheme;
|
||||||
EmoteManager emoteManager;
|
|
||||||
Resources resources;
|
Resources resources;
|
||||||
ChannelManager channelManager;
|
ChannelManager channelManager;
|
||||||
IrcManager ircManager;
|
IrcManager ircManager;
|
||||||
|
|
|
@ -5,14 +5,12 @@ using namespace chatterino::twitch;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
ChannelManager::ChannelManager(WindowManager &_windowManager, EmoteManager &_emoteManager,
|
ChannelManager::ChannelManager(WindowManager &_windowManager, IrcManager &_ircManager)
|
||||||
IrcManager &_ircManager)
|
|
||||||
: windowManager(_windowManager)
|
: windowManager(_windowManager)
|
||||||
, emoteManager(_emoteManager)
|
|
||||||
, ircManager(_ircManager)
|
, ircManager(_ircManager)
|
||||||
, whispersChannel(new TwitchChannel(_emoteManager, _ircManager, "/whispers", true))
|
, whispersChannel(new TwitchChannel(_ircManager, "/whispers", true))
|
||||||
, mentionsChannel(new TwitchChannel(_emoteManager, _ircManager, "/mentions", true))
|
, mentionsChannel(new TwitchChannel(_ircManager, "/mentions", true))
|
||||||
, emptyChannel(new TwitchChannel(_emoteManager, _ircManager, "", true))
|
, emptyChannel(new TwitchChannel(_ircManager, "", true))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +44,7 @@ std::shared_ptr<TwitchChannel> ChannelManager::addTwitchChannel(const QString &r
|
||||||
auto it = this->twitchChannels.find(channelName);
|
auto it = this->twitchChannels.find(channelName);
|
||||||
|
|
||||||
if (it == this->twitchChannels.end()) {
|
if (it == this->twitchChannels.end()) {
|
||||||
auto channel =
|
auto channel = std::make_shared<TwitchChannel>(this->ircManager, channelName);
|
||||||
std::make_shared<TwitchChannel>(this->emoteManager, this->ircManager, channelName);
|
|
||||||
|
|
||||||
this->twitchChannels.insert(channelName, std::make_tuple(channel, 1));
|
this->twitchChannels.insert(channelName, std::make_tuple(channel, 1));
|
||||||
|
|
||||||
|
@ -126,16 +123,6 @@ const std::string &ChannelManager::getUserID(const std::string &username)
|
||||||
return temporary;
|
return temporary;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmoteManager &ChannelManager::getEmoteManager()
|
|
||||||
{
|
|
||||||
return this->emoteManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowManager &ChannelManager::getWindowManager()
|
|
||||||
{
|
|
||||||
return this->windowManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelManager::doOnAll(std::function<void(std::shared_ptr<TwitchChannel>)> func)
|
void ChannelManager::doOnAll(std::function<void(std::shared_ptr<TwitchChannel>)> func)
|
||||||
{
|
{
|
||||||
for (const auto &channel : this->twitchChannels) {
|
for (const auto &channel : this->twitchChannels) {
|
||||||
|
|
|
@ -9,17 +9,14 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
class EmoteManager;
|
|
||||||
class IrcManager;
|
class IrcManager;
|
||||||
|
|
||||||
class ChannelManager
|
class ChannelManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ChannelManager(WindowManager &_windowManager, EmoteManager &_emoteManager,
|
explicit ChannelManager(WindowManager &_windowManager, IrcManager &_ircManager);
|
||||||
IrcManager &_ircManager);
|
|
||||||
|
|
||||||
WindowManager &windowManager;
|
WindowManager &windowManager;
|
||||||
EmoteManager &emoteManager;
|
|
||||||
IrcManager &ircManager;
|
IrcManager &ircManager;
|
||||||
|
|
||||||
const std::vector<std::shared_ptr<Channel>> getItems();
|
const std::vector<std::shared_ptr<Channel>> getItems();
|
||||||
|
@ -29,8 +26,6 @@ public:
|
||||||
void removeTwitchChannel(const QString &channel);
|
void removeTwitchChannel(const QString &channel);
|
||||||
|
|
||||||
const std::string &getUserID(const std::string &username);
|
const std::string &getUserID(const std::string &username);
|
||||||
EmoteManager &getEmoteManager();
|
|
||||||
WindowManager &getWindowManager();
|
|
||||||
|
|
||||||
void doOnAll(std::function<void(std::shared_ptr<twitch::TwitchChannel>)> func);
|
void doOnAll(std::function<void(std::shared_ptr<twitch::TwitchChannel>)> func);
|
||||||
|
|
||||||
|
|
|
@ -10,30 +10,26 @@ void CompletionModel::addString(const std::string &str)
|
||||||
this->emotes.push_back(qS(str) + " ");
|
this->emotes.push_back(qS(str) + " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
CompletionManager::CompletionManager(EmoteManager &_emoteManager)
|
|
||||||
: emoteManager(_emoteManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CompletionModel *CompletionManager::createModel(const std::string &channelName)
|
CompletionModel *CompletionManager::createModel(const std::string &channelName)
|
||||||
{
|
{
|
||||||
CompletionModel *ret = new CompletionModel();
|
CompletionModel *ret = new CompletionModel();
|
||||||
|
auto &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
this->updateModel(ret, channelName);
|
this->updateModel(ret, channelName);
|
||||||
|
|
||||||
this->emoteManager.bttvGlobalEmoteCodes.updated.connect([=]() {
|
emoteManager.bttvGlobalEmoteCodes.updated.connect([=]() {
|
||||||
this->updateModel(ret, channelName); //
|
this->updateModel(ret, channelName); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->emoteManager.ffzGlobalEmoteCodes.updated.connect([=]() {
|
emoteManager.ffzGlobalEmoteCodes.updated.connect([=]() {
|
||||||
this->updateModel(ret, channelName); //
|
this->updateModel(ret, channelName); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->emoteManager.bttvChannelEmoteCodes[channelName].updated.connect([=]() {
|
emoteManager.bttvChannelEmoteCodes[channelName].updated.connect([=]() {
|
||||||
this->updateModel(ret, channelName); //
|
this->updateModel(ret, channelName); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->emoteManager.ffzChannelEmoteCodes[channelName].updated.connect([=]() {
|
emoteManager.ffzChannelEmoteCodes[channelName].updated.connect([=]() {
|
||||||
this->updateModel(ret, channelName); //
|
this->updateModel(ret, channelName); //
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,37 +38,38 @@ CompletionModel *CompletionManager::createModel(const std::string &channelName)
|
||||||
|
|
||||||
void CompletionManager::updateModel(CompletionModel *model, const std::string &channelName)
|
void CompletionManager::updateModel(CompletionModel *model, const std::string &channelName)
|
||||||
{
|
{
|
||||||
|
auto &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
model->emotes.clear();
|
model->emotes.clear();
|
||||||
|
|
||||||
for (const auto &m : this->emoteManager.twitchAccountEmotes) {
|
for (const auto &m : emoteManager.twitchAccountEmotes) {
|
||||||
for (const auto &emoteName : m.second.emoteCodes) {
|
for (const auto &emoteName : m.second.emoteCodes) {
|
||||||
model->addString(emoteName);
|
model->addString(emoteName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> &bttvGlobalEmoteCodes = this->emoteManager.bttvGlobalEmoteCodes;
|
std::vector<std::string> &bttvGlobalEmoteCodes = emoteManager.bttvGlobalEmoteCodes;
|
||||||
for (const auto &m : bttvGlobalEmoteCodes) {
|
for (const auto &m : bttvGlobalEmoteCodes) {
|
||||||
model->addString(m);
|
model->addString(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> &ffzGlobalEmoteCodes = this->emoteManager.ffzGlobalEmoteCodes;
|
std::vector<std::string> &ffzGlobalEmoteCodes = emoteManager.ffzGlobalEmoteCodes;
|
||||||
for (const auto &m : ffzGlobalEmoteCodes) {
|
for (const auto &m : ffzGlobalEmoteCodes) {
|
||||||
model->addString(m);
|
model->addString(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> &bttvChannelEmoteCodes =
|
std::vector<std::string> &bttvChannelEmoteCodes =
|
||||||
this->emoteManager.bttvChannelEmoteCodes[channelName];
|
emoteManager.bttvChannelEmoteCodes[channelName];
|
||||||
for (const auto &m : bttvChannelEmoteCodes) {
|
for (const auto &m : bttvChannelEmoteCodes) {
|
||||||
model->addString(m);
|
model->addString(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> &ffzChannelEmoteCodes =
|
std::vector<std::string> &ffzChannelEmoteCodes = emoteManager.ffzChannelEmoteCodes[channelName];
|
||||||
this->emoteManager.ffzChannelEmoteCodes[channelName];
|
|
||||||
for (const auto &m : ffzChannelEmoteCodes) {
|
for (const auto &m : ffzChannelEmoteCodes) {
|
||||||
model->addString(m);
|
model->addString(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &emojiShortCodes = this->emoteManager.emojiShortCodes;
|
const auto &emojiShortCodes = emoteManager.emojiShortCodes;
|
||||||
for (const auto &m : emojiShortCodes) {
|
for (const auto &m : emojiShortCodes) {
|
||||||
model->addString(":" + m + ":");
|
model->addString(":" + m + ":");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,15 +35,17 @@ public:
|
||||||
|
|
||||||
class CompletionManager
|
class CompletionManager
|
||||||
{
|
{
|
||||||
CompletionManager(EmoteManager &_emoteManager);
|
CompletionManager() = default;
|
||||||
|
|
||||||
EmoteManager &emoteManager;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static CompletionManager &getInstance()
|
||||||
|
{
|
||||||
|
static CompletionManager instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
CompletionModel *createModel(const std::string &channelName);
|
CompletionModel *createModel(const std::string &channelName);
|
||||||
void updateModel(CompletionModel *model, const std::string &channelName = std::string());
|
void updateModel(CompletionModel *model, const std::string &channelName = std::string());
|
||||||
|
|
||||||
friend class Application;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -20,14 +20,9 @@ using namespace chatterino::messages;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
EmoteManager *EmoteManager::instance = nullptr;
|
EmoteManager::EmoteManager()
|
||||||
|
: findShortCodesRegex(":([-+\\w]+):")
|
||||||
EmoteManager::EmoteManager(WindowManager &_windowManager)
|
|
||||||
: windowManager(_windowManager)
|
|
||||||
, findShortCodesRegex(":([-+\\w]+):")
|
|
||||||
{
|
{
|
||||||
this->instance = this;
|
|
||||||
|
|
||||||
pajlada::Settings::Setting<std::string> roomID(
|
pajlada::Settings::Setting<std::string> roomID(
|
||||||
"/accounts/current/roomID", "", pajlada::Settings::SettingOption::DoNotWriteToJSON);
|
"/accounts/current/roomID", "", pajlada::Settings::SettingOption::DoNotWriteToJSON);
|
||||||
|
|
||||||
|
@ -82,8 +77,7 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName, std::weak
|
||||||
link = link.replace("{{id}}", id).replace("{{image}}", "1x");
|
link = link.replace("{{id}}", id).replace("{{image}}", "1x");
|
||||||
|
|
||||||
auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [this, &code, &link] {
|
auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [this, &code, &link] {
|
||||||
return EmoteData(new LazyLoadedImage(*this, this->windowManager, link, 1, code,
|
return EmoteData(new LazyLoadedImage(link, 1, code, code + "\nChannel BTTV Emote"));
|
||||||
code + "\nChannel BTTV Emote"));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this->bttvChannelEmotes.insert(code, emote);
|
this->bttvChannelEmotes.insert(code, emote);
|
||||||
|
@ -131,8 +125,8 @@ void EmoteManager::reloadFFZChannelEmotes(const QString &channelName, std::weak_
|
||||||
|
|
||||||
auto emote =
|
auto emote =
|
||||||
this->getFFZChannelEmoteFromCaches().getOrAdd(id, [this, &code, &url1] {
|
this->getFFZChannelEmoteFromCaches().getOrAdd(id, [this, &code, &url1] {
|
||||||
return EmoteData(new LazyLoadedImage(*this, this->windowManager, url1, 1,
|
return EmoteData(
|
||||||
code, code + "\nGlobal FFZ Emote"));
|
new LazyLoadedImage(url1, 1, code, code + "\nGlobal FFZ Emote"));
|
||||||
});
|
});
|
||||||
|
|
||||||
this->ffzChannelEmotes.insert(code, emote);
|
this->ffzChannelEmotes.insert(code, emote);
|
||||||
|
@ -231,8 +225,7 @@ void EmoteManager::loadEmojis()
|
||||||
"emojione/2.2.6/assets/png/" +
|
"emojione/2.2.6/assets/png/" +
|
||||||
code + ".png";
|
code + ".png";
|
||||||
|
|
||||||
this->emojis.insert(code,
|
this->emojis.insert(code, EmoteData(new LazyLoadedImage(url, 0.35)));
|
||||||
EmoteData(new LazyLoadedImage(*this, this->windowManager, url, 0.35)));
|
|
||||||
|
|
||||||
// TODO(pajlada): The vectors in emojiFirstByte need to be sorted by
|
// TODO(pajlada): The vectors in emojiFirstByte need to be sorted by
|
||||||
// emojiData.code.length()
|
// emojiData.code.length()
|
||||||
|
@ -310,7 +303,7 @@ void EmoteManager::parseEmojis(std::vector<std::tuple<EmoteData, QString>> &pars
|
||||||
|
|
||||||
// Create or fetch cached emoji image
|
// Create or fetch cached emoji image
|
||||||
auto emojiImage = this->emojiCache.getOrAdd(url, [this, &url] {
|
auto emojiImage = this->emojiCache.getOrAdd(url, [this, &url] {
|
||||||
return EmoteData(new LazyLoadedImage(*this, this->windowManager, url, 0.35)); //
|
return EmoteData(new LazyLoadedImage(url, 0.35)); //
|
||||||
});
|
});
|
||||||
|
|
||||||
// Push the emoji as a word to parsedWords
|
// Push the emoji as a word to parsedWords
|
||||||
|
@ -440,8 +433,7 @@ void EmoteManager::loadBTTVEmotes()
|
||||||
QString url = tmp.replace("{{id}}", id).replace("{{image}}", "1x");
|
QString url = tmp.replace("{{id}}", id).replace("{{image}}", "1x");
|
||||||
|
|
||||||
this->bttvGlobalEmotes.insert(
|
this->bttvGlobalEmotes.insert(
|
||||||
code, new LazyLoadedImage(*this, this->windowManager, url, 1, code,
|
code, new LazyLoadedImage(url, 1, code, code + "\nGlobal BTTV Emote"));
|
||||||
code + "\nGlobal BTTV Emote"));
|
|
||||||
codes.push_back(code.toStdString());
|
codes.push_back(code.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,8 +478,7 @@ void EmoteManager::loadFFZEmotes()
|
||||||
QString url1 = "http:" + urls.value("1").toString();
|
QString url1 = "http:" + urls.value("1").toString();
|
||||||
|
|
||||||
this->ffzGlobalEmotes.insert(
|
this->ffzGlobalEmotes.insert(
|
||||||
code, new LazyLoadedImage(*this, this->windowManager, url1, 1, code,
|
code, new LazyLoadedImage(url1, 1, code, code + "\nGlobal FFZ Emote"));
|
||||||
code + "\nGlobal FFZ Emote"));
|
|
||||||
codes.push_back(code.toStdString());
|
codes.push_back(code.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,8 +498,7 @@ EmoteData EmoteManager::getTwitchEmoteById(long id, const QString &emoteName)
|
||||||
return _twitchEmoteFromCache.getOrAdd(id, [this, &emoteName, &id] {
|
return _twitchEmoteFromCache.getOrAdd(id, [this, &emoteName, &id] {
|
||||||
qreal scale;
|
qreal scale;
|
||||||
QString url = getTwitchEmoteLink(id, scale);
|
QString url = getTwitchEmoteLink(id, scale);
|
||||||
return new LazyLoadedImage(*this, this->windowManager, url, scale, emoteName,
|
return new LazyLoadedImage(url, scale, emoteName, emoteName + "\nTwitch Emote");
|
||||||
emoteName + "\nTwitch Emote");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +529,7 @@ boost::signals2::signal<void()> &EmoteManager::getGifUpdateSignal()
|
||||||
|
|
||||||
QObject::connect(&_gifUpdateTimer, &QTimer::timeout, [this] {
|
QObject::connect(&_gifUpdateTimer, &QTimer::timeout, [this] {
|
||||||
_gifUpdateTimerSignal();
|
_gifUpdateTimerSignal();
|
||||||
this->windowManager.repaintGifEmotes();
|
WindowManager::instance->repaintGifEmotes();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class WindowManager;
|
|
||||||
|
|
||||||
struct EmoteData {
|
struct EmoteData {
|
||||||
EmoteData()
|
EmoteData()
|
||||||
{
|
{
|
||||||
|
@ -36,10 +34,14 @@ typedef ConcurrentMap<QString, EmoteData> EmoteMap;
|
||||||
|
|
||||||
class EmoteManager
|
class EmoteManager
|
||||||
{
|
{
|
||||||
public:
|
EmoteManager();
|
||||||
explicit EmoteManager(WindowManager &_windowManager);
|
|
||||||
|
|
||||||
static EmoteManager *instance;
|
public:
|
||||||
|
static EmoteManager &getInstance()
|
||||||
|
{
|
||||||
|
static EmoteManager instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
void loadGlobalEmotes();
|
void loadGlobalEmotes();
|
||||||
|
|
||||||
|
@ -76,8 +78,6 @@ public:
|
||||||
ConcurrentMap<QString, messages::LazyLoadedImage *> miscImageCache;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> miscImageCache;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowManager &windowManager;
|
|
||||||
|
|
||||||
/// Emojis
|
/// Emojis
|
||||||
QRegularExpression findShortCodesRegex;
|
QRegularExpression findShortCodesRegex;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,9 @@ using namespace chatterino::messages;
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
IrcManager::IrcManager(ChannelManager &_channelManager, Resources &_resources,
|
IrcManager::IrcManager(ChannelManager &_channelManager, Resources &_resources,
|
||||||
EmoteManager &_emoteManager, WindowManager &_windowManager)
|
WindowManager &_windowManager)
|
||||||
: channelManager(_channelManager)
|
: channelManager(_channelManager)
|
||||||
, resources(_resources)
|
, resources(_resources)
|
||||||
, emoteManager(_emoteManager)
|
|
||||||
, windowManager(_windowManager)
|
, windowManager(_windowManager)
|
||||||
{
|
{
|
||||||
AccountManager::getInstance().Twitch.userChanged.connect([this]() {
|
AccountManager::getInstance().Twitch.userChanged.connect([this]() {
|
||||||
|
@ -224,8 +223,8 @@ void IrcManager::privateMessageReceived(Communi::IrcPrivateMessage *message)
|
||||||
|
|
||||||
messages::MessageParseArgs args;
|
messages::MessageParseArgs args;
|
||||||
|
|
||||||
twitch::TwitchMessageBuilder builder(c.get(), this->resources, this->emoteManager,
|
twitch::TwitchMessageBuilder builder(c.get(), this->resources, this->windowManager, message,
|
||||||
this->windowManager, message, args);
|
args);
|
||||||
|
|
||||||
c->addMessage(builder.parse());
|
c->addMessage(builder.parse());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace chatterino {
|
||||||
|
|
||||||
class ChannelManager;
|
class ChannelManager;
|
||||||
class Resources;
|
class Resources;
|
||||||
class EmoteManager;
|
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
|
||||||
class IrcManager : public QObject
|
class IrcManager : public QObject
|
||||||
|
@ -28,8 +27,7 @@ class IrcManager : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IrcManager(ChannelManager &channelManager, Resources &resources, EmoteManager &emoteManager,
|
IrcManager(ChannelManager &channelManager, Resources &resources, WindowManager &windowManager);
|
||||||
WindowManager &windowManager);
|
|
||||||
|
|
||||||
void connect();
|
void connect();
|
||||||
void disconnect();
|
void disconnect();
|
||||||
|
@ -51,7 +49,6 @@ public:
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
Resources &resources;
|
Resources &resources;
|
||||||
EmoteManager &emoteManager;
|
|
||||||
WindowManager &windowManager;
|
WindowManager &windowManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -19,12 +19,9 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace messages {
|
namespace messages {
|
||||||
|
|
||||||
LazyLoadedImage::LazyLoadedImage(EmoteManager &_emoteManager, WindowManager &_windowManager,
|
LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale, const QString &name,
|
||||||
const QString &url, qreal scale, const QString &name,
|
|
||||||
const QString &tooltip, const QMargins &margin, bool isHat)
|
const QString &tooltip, const QMargins &margin, bool isHat)
|
||||||
: emoteManager(_emoteManager)
|
: currentPixmap(nullptr)
|
||||||
, windowManager(_windowManager)
|
|
||||||
, currentPixmap(nullptr)
|
|
||||||
, url(url)
|
, url(url)
|
||||||
, name(name)
|
, name(name)
|
||||||
, tooltip(tooltip)
|
, tooltip(tooltip)
|
||||||
|
@ -35,12 +32,9 @@ LazyLoadedImage::LazyLoadedImage(EmoteManager &_emoteManager, WindowManager &_wi
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage::LazyLoadedImage(EmoteManager &_emoteManager, WindowManager &_windowManager,
|
LazyLoadedImage::LazyLoadedImage(QPixmap *image, qreal scale, const QString &name,
|
||||||
QPixmap *image, qreal scale, const QString &name,
|
|
||||||
const QString &tooltip, const QMargins &margin, bool isHat)
|
const QString &tooltip, const QMargins &margin, bool isHat)
|
||||||
: emoteManager(_emoteManager)
|
: currentPixmap(image)
|
||||||
, windowManager(_windowManager)
|
|
||||||
, currentPixmap(image)
|
|
||||||
, name(name)
|
, name(name)
|
||||||
, tooltip(tooltip)
|
, tooltip(tooltip)
|
||||||
, margin(margin)
|
, margin(margin)
|
||||||
|
@ -85,12 +79,12 @@ void LazyLoadedImage::loadImage()
|
||||||
lli->animated = true;
|
lli->animated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lli->emoteManager.incGeneration();
|
EmoteManager::getInstance().incGeneration();
|
||||||
|
|
||||||
lli->windowManager.layoutVisibleChatWidgets();
|
WindowManager::instance->layoutVisibleChatWidgets();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->emoteManager.getGifUpdateSignal().connect([=]() {
|
EmoteManager::getInstance().getGifUpdateSignal().connect([=]() {
|
||||||
this->gifUpdateTimout();
|
this->gifUpdateTimout();
|
||||||
}); // For some reason when Boost signal is in thread scope and thread deletes the signal
|
}); // For some reason when Boost signal is in thread scope and thread deletes the signal
|
||||||
// doesn't work, so this is the fix.
|
// doesn't work, so this is the fix.
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class EmoteManager;
|
|
||||||
class WindowManager;
|
|
||||||
|
|
||||||
namespace messages {
|
namespace messages {
|
||||||
|
|
||||||
class LazyLoadedImage : public QObject
|
class LazyLoadedImage : public QObject
|
||||||
|
@ -15,13 +11,11 @@ class LazyLoadedImage : public QObject
|
||||||
public:
|
public:
|
||||||
LazyLoadedImage() = delete;
|
LazyLoadedImage() = delete;
|
||||||
|
|
||||||
explicit LazyLoadedImage(EmoteManager &_emoteManager, WindowManager &_windowManager,
|
explicit LazyLoadedImage(const QString &_url, qreal _scale = 1, const QString &_name = "",
|
||||||
const QString &_url, qreal _scale = 1, const QString &_name = "",
|
|
||||||
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
||||||
bool isHat = false);
|
bool isHat = false);
|
||||||
|
|
||||||
explicit LazyLoadedImage(EmoteManager &_emoteManager, WindowManager &_windowManager,
|
explicit LazyLoadedImage(QPixmap *_currentPixmap, qreal _scale = 1, const QString &_name = "",
|
||||||
QPixmap *_currentPixmap, qreal _scale = 1, const QString &_name = "",
|
|
||||||
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
||||||
bool isHat = false);
|
bool isHat = false);
|
||||||
|
|
||||||
|
@ -39,9 +33,6 @@ public:
|
||||||
int getScaledHeight() const;
|
int getScaledHeight() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EmoteManager &emoteManager;
|
|
||||||
WindowManager &windowManager;
|
|
||||||
|
|
||||||
struct FrameData {
|
struct FrameData {
|
||||||
QPixmap *image;
|
QPixmap *image;
|
||||||
int duration;
|
int duration;
|
||||||
|
|
|
@ -33,6 +33,8 @@ int MessageRef::getHeight() const
|
||||||
// return true if redraw is required
|
// return true if redraw is required
|
||||||
bool MessageRef::layout(int width, float dpiMultiplyer)
|
bool MessageRef::layout(int width, float dpiMultiplyer)
|
||||||
{
|
{
|
||||||
|
auto &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
bool layoutRequired = false;
|
bool layoutRequired = false;
|
||||||
|
|
||||||
// check if width changed
|
// check if width changed
|
||||||
|
@ -41,9 +43,9 @@ bool MessageRef::layout(int width, float dpiMultiplyer)
|
||||||
this->currentLayoutWidth = width;
|
this->currentLayoutWidth = width;
|
||||||
|
|
||||||
// check if emotes changed
|
// check if emotes changed
|
||||||
bool imagesChanged = this->emoteGeneration != EmoteManager::instance->getGeneration();
|
bool imagesChanged = this->emoteGeneration != emoteManager.getGeneration();
|
||||||
layoutRequired |= imagesChanged;
|
layoutRequired |= imagesChanged;
|
||||||
this->emoteGeneration = EmoteManager::instance->getGeneration();
|
this->emoteGeneration = emoteManager.getGeneration();
|
||||||
|
|
||||||
// check if text changed
|
// check if text changed
|
||||||
bool textChanged = this->fontGeneration != FontManager::getInstance().getGeneration();
|
bool textChanged = this->fontGeneration != FontManager::getInstance().getGeneration();
|
||||||
|
|
|
@ -9,49 +9,41 @@ namespace chatterino {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline messages::LazyLoadedImage *lli(EmoteManager &emoteManager, WindowManager &windowManager,
|
inline messages::LazyLoadedImage *lli(const char *pixmapPath, qreal scale = 1)
|
||||||
const char *pixmapPath, qreal scale = 1)
|
|
||||||
{
|
{
|
||||||
return new messages::LazyLoadedImage(emoteManager, windowManager, new QPixmap(pixmapPath),
|
return new messages::LazyLoadedImage(new QPixmap(pixmapPath), scale);
|
||||||
scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Resources::Resources(EmoteManager &em, WindowManager &wm)
|
Resources::Resources()
|
||||||
: emoteManager(em)
|
: badgeStaff(lli(":/images/staff_bg.png"))
|
||||||
, windowManager(wm)
|
, badgeAdmin(lli(":/images/admin_bg.png"))
|
||||||
, badgeStaff(lli(em, wm, ":/images/staff_bg.png"))
|
, badgeGlobalModerator(lli(":/images/globalmod_bg.png"))
|
||||||
, badgeAdmin(lli(em, wm, ":/images/admin_bg.png"))
|
, badgeModerator(lli(":/images/moderator_bg.png"))
|
||||||
, badgeGlobalModerator(lli(em, wm, ":/images/globalmod_bg.png"))
|
, badgeTurbo(lli(":/images/turbo_bg.png"))
|
||||||
, badgeModerator(lli(em, wm, ":/images/moderator_bg.png"))
|
, badgeBroadcaster(lli(":/images/broadcaster_bg.png"))
|
||||||
, badgeTurbo(lli(em, wm, ":/images/turbo_bg.png"))
|
, badgePremium(lli(":/images/twitchprime_bg.png"))
|
||||||
, badgeBroadcaster(lli(em, wm, ":/images/broadcaster_bg.png"))
|
, badgeVerified(lli(":/images/verified.png", 0.25))
|
||||||
, badgePremium(lli(em, wm, ":/images/twitchprime_bg.png"))
|
, badgeSubscriber(lli(":/images/subscriber.png", 0.25))
|
||||||
, badgeVerified(lli(em, wm, ":/images/verified.png", 0.25))
|
, cheerBadge100000(lli(":/images/cheer100000"))
|
||||||
, badgeSubscriber(lli(em, wm, ":/images/subscriber.png", 0.25))
|
, cheerBadge10000(lli(":/images/cheer10000"))
|
||||||
, cheerBadge100000(lli(em, wm, ":/images/cheer100000"))
|
, cheerBadge5000(lli(":/images/cheer5000"))
|
||||||
, cheerBadge10000(lli(em, wm, ":/images/cheer10000"))
|
, cheerBadge1000(lli(":/images/cheer1000"))
|
||||||
, cheerBadge5000(lli(em, wm, ":/images/cheer5000"))
|
, cheerBadge100(lli(":/images/cheer100"))
|
||||||
, cheerBadge1000(lli(em, wm, ":/images/cheer1000"))
|
, cheerBadge1(lli(":/images/cheer1"))
|
||||||
, cheerBadge100(lli(em, wm, ":/images/cheer100"))
|
, buttonBan(lli(":/images/button_ban.png", 0.25))
|
||||||
, cheerBadge1(lli(em, wm, ":/images/cheer1"))
|
, buttonTimeout(lli(":/images/button_timeout.png", 0.25))
|
||||||
, buttonBan(lli(em, wm, ":/images/button_ban.png", 0.25))
|
|
||||||
, buttonTimeout(lli(em, wm, ":/images/button_timeout.png", 0.25))
|
|
||||||
{
|
{
|
||||||
this->loadDynamicTwitchBadges();
|
this->loadDynamicTwitchBadges();
|
||||||
|
|
||||||
this->loadChatterinoBadges();
|
this->loadChatterinoBadges();
|
||||||
}
|
}
|
||||||
|
|
||||||
Resources::BadgeVersion::BadgeVersion(QJsonObject &&root, EmoteManager &emoteManager,
|
Resources::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
||||||
WindowManager &windowManager)
|
: badgeImage1x(new messages::LazyLoadedImage(root.value("image_url_1x").toString()))
|
||||||
: badgeImage1x(new messages::LazyLoadedImage(emoteManager, windowManager,
|
, badgeImage2x(new messages::LazyLoadedImage(root.value("image_url_2x").toString()))
|
||||||
root.value("image_url_1x").toString()))
|
, badgeImage4x(new messages::LazyLoadedImage(root.value("image_url_4x").toString()))
|
||||||
, badgeImage2x(new messages::LazyLoadedImage(emoteManager, windowManager,
|
|
||||||
root.value("image_url_2x").toString()))
|
|
||||||
, badgeImage4x(new messages::LazyLoadedImage(emoteManager, windowManager,
|
|
||||||
root.value("image_url_4x").toString()))
|
|
||||||
, description(root.value("description").toString().toStdString())
|
, description(root.value("description").toString().toStdString())
|
||||||
, title(root.value("title").toString().toStdString())
|
, title(root.value("title").toString().toStdString())
|
||||||
, clickAction(root.value("clickAction").toString().toStdString())
|
, clickAction(root.value("clickAction").toString().toStdString())
|
||||||
|
@ -83,7 +75,7 @@ void Resources::loadChannelData(const QString &roomID, bool bypassCache)
|
||||||
++versionIt) {
|
++versionIt) {
|
||||||
std::string kkey = versionIt.key().toStdString();
|
std::string kkey = versionIt.key().toStdString();
|
||||||
QJsonObject versionObj = versionIt.value().toObject();
|
QJsonObject versionObj = versionIt.value().toObject();
|
||||||
BadgeVersion v(std::move(versionObj), this->emoteManager, this->windowManager);
|
BadgeVersion v(std::move(versionObj));
|
||||||
versionsMap.emplace(kkey, v);
|
versionsMap.emplace(kkey, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +103,7 @@ void Resources::loadDynamicTwitchBadges()
|
||||||
++versionIt) {
|
++versionIt) {
|
||||||
std::string kkey = versionIt.key().toStdString();
|
std::string kkey = versionIt.key().toStdString();
|
||||||
QJsonObject versionObj = versionIt.value().toObject();
|
QJsonObject versionObj = versionIt.value().toObject();
|
||||||
BadgeVersion v(std::move(versionObj), this->emoteManager, this->windowManager);
|
BadgeVersion v(std::move(versionObj));
|
||||||
versionsMap.emplace(kkey, v);
|
versionsMap.emplace(kkey, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,9 +131,7 @@ void Resources::loadChatterinoBadges()
|
||||||
const QString &badgeVariantImageURL = badgeVariant.value("image").toString();
|
const QString &badgeVariantImageURL = badgeVariant.value("image").toString();
|
||||||
|
|
||||||
auto badgeVariantPtr = std::make_shared<ChatterinoBadge>(
|
auto badgeVariantPtr = std::make_shared<ChatterinoBadge>(
|
||||||
badgeVariantTooltip,
|
badgeVariantTooltip, new messages::LazyLoadedImage(badgeVariantImageURL));
|
||||||
new messages::LazyLoadedImage(this->emoteManager, this->windowManager,
|
|
||||||
badgeVariantImageURL));
|
|
||||||
|
|
||||||
QJsonArray badgeVariantUsers = badgeVariant.value("users").toArray();
|
QJsonArray badgeVariantUsers = badgeVariant.value("users").toArray();
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,10 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class EmoteManager;
|
|
||||||
class WindowManager;
|
|
||||||
|
|
||||||
class Resources
|
class Resources
|
||||||
{
|
{
|
||||||
EmoteManager &emoteManager;
|
|
||||||
WindowManager &windowManager;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Resources(EmoteManager &emoteManager, WindowManager &windowManager);
|
explicit Resources();
|
||||||
|
|
||||||
messages::LazyLoadedImage *badgeStaff;
|
messages::LazyLoadedImage *badgeStaff;
|
||||||
messages::LazyLoadedImage *badgeAdmin;
|
messages::LazyLoadedImage *badgeAdmin;
|
||||||
|
@ -41,8 +35,7 @@ public:
|
||||||
struct BadgeVersion {
|
struct BadgeVersion {
|
||||||
BadgeVersion() = delete;
|
BadgeVersion() = delete;
|
||||||
|
|
||||||
explicit BadgeVersion(QJsonObject &&root, EmoteManager &emoteManager,
|
explicit BadgeVersion(QJsonObject &&root);
|
||||||
WindowManager &windowManager);
|
|
||||||
|
|
||||||
messages::LazyLoadedImage *badgeImage1x;
|
messages::LazyLoadedImage *badgeImage1x;
|
||||||
messages::LazyLoadedImage *badgeImage2x;
|
messages::LazyLoadedImage *badgeImage2x;
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace twitch {
|
namespace twitch {
|
||||||
|
|
||||||
TwitchChannel::TwitchChannel(EmoteManager &emoteManager, IrcManager &ircManager,
|
TwitchChannel::TwitchChannel(IrcManager &ircManager, const QString &channelName, bool _isSpecial)
|
||||||
const QString &channelName, bool _isSpecial)
|
|
||||||
: Channel(channelName)
|
: Channel(channelName)
|
||||||
, emoteManager(emoteManager)
|
|
||||||
, ircManager(ircManager)
|
, ircManager(ircManager)
|
||||||
, bttvChannelEmotes(new EmoteMap)
|
, bttvChannelEmotes(new EmoteMap)
|
||||||
, ffzChannelEmotes(new EmoteMap)
|
, ffzChannelEmotes(new EmoteMap)
|
||||||
|
@ -63,18 +61,22 @@ void TwitchChannel::setRoomID(const QString &_roomID)
|
||||||
|
|
||||||
void TwitchChannel::reloadChannelEmotes()
|
void TwitchChannel::reloadChannelEmotes()
|
||||||
{
|
{
|
||||||
|
auto &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
debug::Log("[TwitchChannel:{}] Reloading channel emotes", this->name);
|
debug::Log("[TwitchChannel:{}] Reloading channel emotes", this->name);
|
||||||
|
|
||||||
this->emoteManager.reloadBTTVChannelEmotes(this->name, this->bttvChannelEmotes);
|
emoteManager.reloadBTTVChannelEmotes(this->name, this->bttvChannelEmotes);
|
||||||
this->emoteManager.reloadFFZChannelEmotes(this->name, this->ffzChannelEmotes);
|
emoteManager.reloadFFZChannelEmotes(this->name, this->ffzChannelEmotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchChannel::sendMessage(const QString &message)
|
void TwitchChannel::sendMessage(const QString &message)
|
||||||
{
|
{
|
||||||
|
auto &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
debug::Log("[TwitchChannel:{}] Send message: {}", this->name, message);
|
debug::Log("[TwitchChannel:{}] Send message: {}", this->name, message);
|
||||||
|
|
||||||
// Do last message processing
|
// Do last message processing
|
||||||
QString parsedMessage = this->emoteManager.replaceShortCodes(message);
|
QString parsedMessage = emoteManager.replaceShortCodes(message);
|
||||||
|
|
||||||
this->ircManager.sendMessage(this->name, parsedMessage);
|
this->ircManager.sendMessage(this->name, parsedMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ class TwitchChannel : public Channel
|
||||||
QTimer *liveStatusTimer;
|
QTimer *liveStatusTimer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TwitchChannel(EmoteManager &emoteManager, IrcManager &ircManager,
|
explicit TwitchChannel(IrcManager &ircManager, const QString &channelName,
|
||||||
const QString &channelName, bool _isSpecial = false);
|
bool _isSpecial = false);
|
||||||
~TwitchChannel();
|
~TwitchChannel();
|
||||||
|
|
||||||
void reloadChannelEmotes();
|
void reloadChannelEmotes();
|
||||||
|
@ -44,7 +44,6 @@ private:
|
||||||
void setLive(bool newLiveStatus);
|
void setLive(bool newLiveStatus);
|
||||||
void refreshLiveStatus();
|
void refreshLiveStatus();
|
||||||
|
|
||||||
EmoteManager &emoteManager;
|
|
||||||
IrcManager &ircManager;
|
IrcManager &ircManager;
|
||||||
|
|
||||||
bool isSpecial;
|
bool isSpecial;
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace chatterino {
|
||||||
namespace twitch {
|
namespace twitch {
|
||||||
|
|
||||||
TwitchMessageBuilder::TwitchMessageBuilder(TwitchChannel *_channel, Resources &_resources,
|
TwitchMessageBuilder::TwitchMessageBuilder(TwitchChannel *_channel, Resources &_resources,
|
||||||
EmoteManager &_emoteManager,
|
|
||||||
WindowManager &_windowManager,
|
WindowManager &_windowManager,
|
||||||
const Communi::IrcPrivateMessage *_ircMessage,
|
const Communi::IrcPrivateMessage *_ircMessage,
|
||||||
const messages::MessageParseArgs &_args)
|
const messages::MessageParseArgs &_args)
|
||||||
|
@ -26,7 +25,6 @@ TwitchMessageBuilder::TwitchMessageBuilder(TwitchChannel *_channel, Resources &_
|
||||||
, resources(_resources)
|
, resources(_resources)
|
||||||
, windowManager(_windowManager)
|
, windowManager(_windowManager)
|
||||||
, colorScheme(this->windowManager.colorScheme)
|
, colorScheme(this->windowManager.colorScheme)
|
||||||
, emoteManager(_emoteManager)
|
|
||||||
, ircMessage(_ircMessage)
|
, ircMessage(_ircMessage)
|
||||||
, args(_args)
|
, args(_args)
|
||||||
, tags(this->ircMessage->tags())
|
, tags(this->ircMessage->tags())
|
||||||
|
@ -37,6 +35,7 @@ TwitchMessageBuilder::TwitchMessageBuilder(TwitchChannel *_channel, Resources &_
|
||||||
SharedMessage TwitchMessageBuilder::parse()
|
SharedMessage TwitchMessageBuilder::parse()
|
||||||
{
|
{
|
||||||
SettingsManager &settings = SettingsManager::getInstance();
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
EmoteManager &emoteManager = EmoteManager::getInstance();
|
||||||
|
|
||||||
this->originalMessage = this->ircMessage->content();
|
this->originalMessage = this->ircMessage->content();
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ SharedMessage TwitchMessageBuilder::parse()
|
||||||
QStringList emoteString = iterator.value().toString().split('/');
|
QStringList emoteString = iterator.value().toString().split('/');
|
||||||
|
|
||||||
for (QString emote : emoteString) {
|
for (QString emote : emoteString) {
|
||||||
this->appendTwitchEmote(ircMessage, emote, twitchEmotes, emoteManager);
|
this->appendTwitchEmote(ircMessage, emote, twitchEmotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -172,14 +171,10 @@ SharedMessage TwitchMessageBuilder::parse()
|
||||||
|
|
||||||
LazyLoadedImage *imageAnimated = emoteManager.miscImageCache.getOrAdd(
|
LazyLoadedImage *imageAnimated = emoteManager.miscImageCache.getOrAdd(
|
||||||
bitsLinkAnimated, [this, &bitsLinkAnimated] {
|
bitsLinkAnimated, [this, &bitsLinkAnimated] {
|
||||||
return new LazyLoadedImage(this->emoteManager, this->windowManager,
|
return new LazyLoadedImage(bitsLinkAnimated);
|
||||||
bitsLinkAnimated);
|
|
||||||
});
|
|
||||||
LazyLoadedImage *image =
|
|
||||||
emoteManager.miscImageCache.getOrAdd(bitsLink, [this, &bitsLink] {
|
|
||||||
return new LazyLoadedImage(this->emoteManager, this->windowManager,
|
|
||||||
bitsLink);
|
|
||||||
});
|
});
|
||||||
|
LazyLoadedImage *image = emoteManager.miscImageCache.getOrAdd(
|
||||||
|
bitsLink, [this, &bitsLink] { return new LazyLoadedImage(bitsLink); });
|
||||||
|
|
||||||
this->appendWord(Word(imageAnimated, Word::BitsAnimated, QString("cheer"),
|
this->appendWord(Word(imageAnimated, Word::BitsAnimated, QString("cheer"),
|
||||||
QString("Twitch Cheer"),
|
QString("Twitch Cheer"),
|
||||||
|
@ -464,9 +459,9 @@ void TwitchMessageBuilder::appendModerationButtons()
|
||||||
|
|
||||||
void TwitchMessageBuilder::appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage,
|
void TwitchMessageBuilder::appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage,
|
||||||
const QString &emote,
|
const QString &emote,
|
||||||
std::vector<std::pair<long int, EmoteData>> &vec,
|
std::vector<std::pair<long int, EmoteData>> &vec)
|
||||||
EmoteManager &emoteManager)
|
|
||||||
{
|
{
|
||||||
|
EmoteManager &emoteManager = EmoteManager::getInstance();
|
||||||
if (!emote.contains(':')) {
|
if (!emote.contains(':')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -504,6 +499,7 @@ void TwitchMessageBuilder::appendTwitchEmote(const Communi::IrcPrivateMessage *i
|
||||||
|
|
||||||
bool TwitchMessageBuilder::tryAppendEmote(QString &emoteString)
|
bool TwitchMessageBuilder::tryAppendEmote(QString &emoteString)
|
||||||
{
|
{
|
||||||
|
EmoteManager &emoteManager = EmoteManager::getInstance();
|
||||||
EmoteData emoteData;
|
EmoteData emoteData;
|
||||||
|
|
||||||
if (emoteManager.bttvGlobalEmotes.tryGet(emoteString, emoteData)) {
|
if (emoteManager.bttvGlobalEmotes.tryGet(emoteString, emoteData)) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "emotemanager.hpp"
|
|
||||||
#include "messages/messagebuilder.hpp"
|
#include "messages/messagebuilder.hpp"
|
||||||
#include "messages/messageparseargs.hpp"
|
#include "messages/messageparseargs.hpp"
|
||||||
#include "resources.hpp"
|
#include "resources.hpp"
|
||||||
|
@ -29,7 +28,7 @@ public:
|
||||||
TwitchMessageBuilder() = delete;
|
TwitchMessageBuilder() = delete;
|
||||||
|
|
||||||
explicit TwitchMessageBuilder(TwitchChannel *_channel, Resources &_resources,
|
explicit TwitchMessageBuilder(TwitchChannel *_channel, Resources &_resources,
|
||||||
EmoteManager &_emoteManager, WindowManager &_windowManager,
|
WindowManager &_windowManager,
|
||||||
const Communi::IrcPrivateMessage *_ircMessage,
|
const Communi::IrcPrivateMessage *_ircMessage,
|
||||||
const messages::MessageParseArgs &_args);
|
const messages::MessageParseArgs &_args);
|
||||||
|
|
||||||
|
@ -38,7 +37,6 @@ public:
|
||||||
Resources &resources;
|
Resources &resources;
|
||||||
WindowManager &windowManager;
|
WindowManager &windowManager;
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
EmoteManager &emoteManager;
|
|
||||||
const Communi::IrcPrivateMessage *ircMessage;
|
const Communi::IrcPrivateMessage *ircMessage;
|
||||||
messages::MessageParseArgs args;
|
messages::MessageParseArgs args;
|
||||||
const QVariantMap tags;
|
const QVariantMap tags;
|
||||||
|
@ -66,8 +64,7 @@ private:
|
||||||
|
|
||||||
void appendModerationButtons();
|
void appendModerationButtons();
|
||||||
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);
|
|
||||||
bool tryAppendEmote(QString &emoteString);
|
bool tryAppendEmote(QString &emoteString);
|
||||||
bool appendEmote(EmoteData &emoteData);
|
bool appendEmote(EmoteData &emoteData);
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,8 @@ using namespace chatterino::messages;
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
EmotePopup::EmotePopup(ColorScheme &colorScheme, EmoteManager &emoteManager,
|
EmotePopup::EmotePopup(ColorScheme &colorScheme)
|
||||||
WindowManager &windowManager)
|
|
||||||
: BaseWidget(colorScheme, 0)
|
: BaseWidget(colorScheme, 0)
|
||||||
, emoteManager(emoteManager)
|
|
||||||
{
|
{
|
||||||
this->initAsWindow();
|
this->initAsWindow();
|
||||||
|
|
||||||
|
@ -22,8 +20,8 @@ EmotePopup::EmotePopup(ColorScheme &colorScheme, EmoteManager &emoteManager,
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
view = new ChannelView(windowManager, this);
|
this->view = new ChannelView(this);
|
||||||
layout->addWidget(view);
|
layout->addWidget(this->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmotePopup::loadChannel(std::shared_ptr<Channel> _channel)
|
void EmotePopup::loadChannel(std::shared_ptr<Channel> _channel)
|
||||||
|
@ -58,18 +56,20 @@ void EmotePopup::loadChannel(std::shared_ptr<Channel> _channel)
|
||||||
emoteChannel->addMessage(builder2.getMessage());
|
emoteChannel->addMessage(builder2.getMessage());
|
||||||
};
|
};
|
||||||
|
|
||||||
addEmotes(this->emoteManager.bttvGlobalEmotes, "BetterTTV Global Emotes",
|
EmoteManager &emoteManager = EmoteManager::getInstance();
|
||||||
"BetterTTV Global Emote");
|
|
||||||
|
addEmotes(emoteManager.bttvGlobalEmotes, "BetterTTV Global Emotes", "BetterTTV Global Emote");
|
||||||
addEmotes(*channel->bttvChannelEmotes.get(), "BetterTTV Channel Emotes",
|
addEmotes(*channel->bttvChannelEmotes.get(), "BetterTTV Channel Emotes",
|
||||||
"BetterTTV Channel Emote");
|
"BetterTTV Channel Emote");
|
||||||
addEmotes(this->emoteManager.ffzGlobalEmotes, "FrankerFaceZ Global Emotes",
|
addEmotes(emoteManager.ffzGlobalEmotes, "FrankerFaceZ Global Emotes",
|
||||||
"FrankerFaceZ Global Emote");
|
"FrankerFaceZ Global Emote");
|
||||||
addEmotes(*channel->ffzChannelEmotes.get(), "FrankerFaceZ Channel Emotes",
|
addEmotes(*channel->ffzChannelEmotes.get(), "FrankerFaceZ Channel Emotes",
|
||||||
"FrankerFaceZ Channel Emote");
|
"FrankerFaceZ Channel Emote");
|
||||||
|
|
||||||
// addEmotes(this->emoteManager.getEmojis(), "Emojis", "Emoji");
|
// addEmotes(emoteManager.getEmojis(), "Emojis", "Emoji");
|
||||||
|
|
||||||
this->view->setChannel(emoteChannel);
|
this->view->setChannel(emoteChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "channel.hpp"
|
#include "channel.hpp"
|
||||||
#include "emotemanager.hpp"
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/helper/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
|
|
||||||
|
@ -11,13 +10,13 @@ namespace widgets {
|
||||||
class EmotePopup : public BaseWidget
|
class EmotePopup : public BaseWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit EmotePopup(ColorScheme &, EmoteManager &, WindowManager &);
|
explicit EmotePopup(ColorScheme &);
|
||||||
|
|
||||||
void loadChannel(std::shared_ptr<Channel> channel);
|
void loadChannel(std::shared_ptr<Channel> channel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChannelView *view;
|
ChannelView *view;
|
||||||
EmoteManager &emoteManager;
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
|
|
|
@ -28,9 +28,8 @@ using namespace chatterino::messages;
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
ChannelView::ChannelView(WindowManager &windowManager, BaseWidget *parent)
|
ChannelView::ChannelView(BaseWidget *parent)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, windowManager(windowManager)
|
|
||||||
, scrollBar(this)
|
, scrollBar(this)
|
||||||
, userPopupWidget(std::shared_ptr<twitch::TwitchChannel>())
|
, userPopupWidget(std::shared_ptr<twitch::TwitchChannel>())
|
||||||
{
|
{
|
||||||
|
@ -51,6 +50,8 @@ ChannelView::ChannelView(WindowManager &windowManager, BaseWidget *parent)
|
||||||
this->queueUpdate();
|
this->queueUpdate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
WindowManager &windowManager = *WindowManager::instance;
|
||||||
|
|
||||||
this->repaintGifsConnection =
|
this->repaintGifsConnection =
|
||||||
windowManager.repaintGifs.connect([&] { this->updateGifEmotes(); });
|
windowManager.repaintGifs.connect([&] { this->updateGifEmotes(); });
|
||||||
this->layoutConnection = windowManager.layout.connect([&] { this->layoutMessages(); });
|
this->layoutConnection = windowManager.layout.connect([&] { this->layoutMessages(); });
|
||||||
|
@ -240,9 +241,8 @@ QString ChannelView::getSelectedText()
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
bool isSingleWord =
|
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
||||||
isSingleMessage &&
|
part.getCharacterLength();
|
||||||
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
|
||||||
|
|
||||||
if (isSingleWord) {
|
if (isSingleWord) {
|
||||||
// return single word
|
// return single word
|
||||||
|
@ -519,10 +519,9 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(),
|
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||||
(messageRef->getMessage()->getCanHighlightTab())
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
: this->colorScheme.ChatBackground);
|
||||||
: this->colorScheme.ChatBackground);
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// draw selection
|
// draw selection
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ChannelView : public BaseWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ChannelView(WindowManager &windowManager, BaseWidget *parent = 0);
|
explicit ChannelView(BaseWidget *parent = 0);
|
||||||
~ChannelView();
|
~ChannelView();
|
||||||
|
|
||||||
void updateGifEmotes();
|
void updateGifEmotes();
|
||||||
|
@ -123,7 +123,6 @@ private:
|
||||||
QRect rect;
|
QRect rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
WindowManager &windowManager;
|
|
||||||
QTimer updateTimer;
|
QTimer updateTimer;
|
||||||
bool updateQueued = false;
|
bool updateQueued = false;
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,9 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowManager &windowManager)
|
SplitInput::SplitInput(Split *_chatWidget)
|
||||||
: BaseWidget(_chatWidget)
|
: BaseWidget(_chatWidget)
|
||||||
, chatWidget(_chatWidget)
|
, chatWidget(_chatWidget)
|
||||||
, emoteManager(emoteManager)
|
|
||||||
, windowManager(windowManager)
|
|
||||||
, emotesLabel(this)
|
, emotesLabel(this)
|
||||||
{
|
{
|
||||||
this->setMaximumHeight(150);
|
this->setMaximumHeight(150);
|
||||||
|
@ -55,8 +53,7 @@ SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowMan
|
||||||
|
|
||||||
connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] {
|
connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] {
|
||||||
if (this->emotePopup == nullptr) {
|
if (this->emotePopup == nullptr) {
|
||||||
this->emotePopup =
|
this->emotePopup = new EmotePopup(this->colorScheme);
|
||||||
new EmotePopup(this->colorScheme, this->emoteManager, this->windowManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->emotePopup->resize(300, 500);
|
this->emotePopup->resize(300, 500);
|
||||||
|
@ -69,8 +66,8 @@ SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowMan
|
||||||
this->refreshTheme();
|
this->refreshTheme();
|
||||||
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength);
|
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength);
|
||||||
|
|
||||||
auto completer = new QCompleter(
|
auto completer =
|
||||||
this->chatWidget->completionManager.createModel(this->chatWidget->channelName));
|
new QCompleter(CompletionManager::getInstance().createModel(this->chatWidget->channelName));
|
||||||
|
|
||||||
this->textInput.setCompleter(completer);
|
this->textInput.setCompleter(completer);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "emotemanager.hpp"
|
|
||||||
#include "resizingtextedit.hpp"
|
#include "resizingtextedit.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/emotepopup.hpp"
|
#include "widgets/emotepopup.hpp"
|
||||||
|
@ -26,7 +25,7 @@ class SplitInput : public BaseWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SplitInput(Split *_chatWidget, EmoteManager &, WindowManager &);
|
SplitInput(Split *_chatWidget);
|
||||||
~SplitInput();
|
~SplitInput();
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
|
@ -40,8 +39,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
Split *const chatWidget;
|
Split *const chatWidget;
|
||||||
EmotePopup *emotePopup = nullptr;
|
EmotePopup *emotePopup = nullptr;
|
||||||
EmoteManager &emoteManager;
|
|
||||||
WindowManager &windowManager;
|
|
||||||
|
|
||||||
pajlada::Signals::Signal<const bool &>::Connection textLengthVisibleChangedConnection;
|
pajlada::Signals::Signal<const bool &>::Connection textLengthVisibleChangedConnection;
|
||||||
QHBoxLayout hbox;
|
QHBoxLayout hbox;
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace widgets {
|
||||||
Notebook::Notebook(ChannelManager &_channelManager, Window *parent, bool _showButtons)
|
Notebook::Notebook(ChannelManager &_channelManager, Window *parent, bool _showButtons)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
|
||||||
, addButton(this)
|
, addButton(this)
|
||||||
, settingsButton(this)
|
, settingsButton(this)
|
||||||
, userButton(this)
|
, userButton(this)
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class ChannelManager;
|
class ChannelManager;
|
||||||
class CompletionManager;
|
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -58,7 +57,6 @@ public slots:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
CompletionManager &completionManager;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<SplitContainer *> pages;
|
QList<SplitContainer *> pages;
|
||||||
|
|
|
@ -52,12 +52,11 @@ Split::Split(ChannelManager &_channelManager, SplitContainer *parent)
|
||||||
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
|
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
|
||||||
, parentPage(*parent)
|
, parentPage(*parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
|
||||||
, channel(_channelManager.emptyChannel)
|
, channel(_channelManager.emptyChannel)
|
||||||
, vbox(this)
|
, vbox(this)
|
||||||
, header(this)
|
, header(this)
|
||||||
, view(_channelManager.getWindowManager(), this)
|
, view(this)
|
||||||
, input(this, _channelManager.getEmoteManager(), _channelManager.getWindowManager())
|
, input(this)
|
||||||
, flexSizeX(1)
|
, flexSizeX(1)
|
||||||
, flexSizeY(1)
|
, flexSizeY(1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace chatterino {
|
||||||
|
|
||||||
class ChannelManager;
|
class ChannelManager;
|
||||||
class ColorScheme;
|
class ColorScheme;
|
||||||
class CompletionManager;
|
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -49,7 +48,6 @@ public:
|
||||||
~Split();
|
~Split();
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
CompletionManager &completionManager;
|
|
||||||
pajlada::Settings::Setting<std::string> channelName;
|
pajlada::Settings::Setting<std::string> channelName;
|
||||||
boost::signals2::signal<void()> channelChanged;
|
boost::signals2::signal<void()> channelChanged;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ std::pair<int, int> SplitContainer::dropPosition = std::pair<int, int>(-1, -1);
|
||||||
SplitContainer::SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab)
|
SplitContainer::SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab)
|
||||||
: BaseWidget(parent->colorScheme, parent)
|
: BaseWidget(parent->colorScheme, parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
|
||||||
, tab(_tab)
|
, tab(_tab)
|
||||||
, dropPreview(this)
|
, dropPreview(this)
|
||||||
, chatWidgets()
|
, chatWidgets()
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class ChannelManager;
|
class ChannelManager;
|
||||||
class CompletionManager;
|
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -29,7 +28,6 @@ public:
|
||||||
SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab);
|
SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab);
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
CompletionManager &completionManager;
|
|
||||||
|
|
||||||
std::pair<int, int> removeFromLayout(Split *widget);
|
std::pair<int, int> removeFromLayout(Split *widget);
|
||||||
void addToLayout(Split *widget, std::pair<int, int> position = std::pair<int, int>(-1, -1));
|
void addToLayout(Split *widget, std::pair<int, int> position = std::pair<int, int>(-1, -1));
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
#include "channelmanager.hpp"
|
#include "channelmanager.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
#include "widgets/split.hpp"
|
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
|
#include "widgets/split.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
|
@ -16,12 +16,10 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
Window::Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
Window::Window(ChannelManager &_channelManager, ColorScheme &_colorScheme, bool _isMainWindow)
|
||||||
CompletionManager &_completionManager, bool _isMainWindow)
|
|
||||||
: BaseWidget(_colorScheme, nullptr)
|
: BaseWidget(_colorScheme, nullptr)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, colorScheme(_colorScheme)
|
, colorScheme(_colorScheme)
|
||||||
, completionManager(_completionManager)
|
|
||||||
, notebook(this->channelManager, this, _isMainWindow)
|
, notebook(this->channelManager, this, _isMainWindow)
|
||||||
, dpi(this->getDpiMultiplier())
|
, dpi(this->getDpiMultiplier())
|
||||||
// , windowGeometry("/windows/0/geometry")
|
// , windowGeometry("/windows/0/geometry")
|
||||||
|
|
|
@ -26,8 +26,7 @@ class Window : public BaseWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
explicit Window(ChannelManager &_channelManager, ColorScheme &_colorScheme, bool isMainWindow);
|
||||||
CompletionManager &_completionManager, bool isMainWindow);
|
|
||||||
|
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
|
|
||||||
|
@ -51,7 +50,6 @@ private:
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
CompletionManager &completionManager;
|
|
||||||
|
|
||||||
Notebook notebook;
|
Notebook notebook;
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
WindowManager *WindowManager::instance = nullptr;
|
WindowManager *WindowManager::instance = nullptr;
|
||||||
|
|
||||||
WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme)
|
||||||
CompletionManager &_completionManager)
|
|
||||||
: channelManager(_channelManager)
|
: channelManager(_channelManager)
|
||||||
, colorScheme(_colorScheme)
|
, colorScheme(_colorScheme)
|
||||||
, completionManager(_completionManager)
|
|
||||||
{
|
{
|
||||||
WindowManager::instance = this;
|
WindowManager::instance = this;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +21,7 @@ WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colo
|
||||||
void WindowManager::initMainWindow()
|
void WindowManager::initMainWindow()
|
||||||
{
|
{
|
||||||
this->selectedWindow = this->mainWindow =
|
this->selectedWindow = this->mainWindow =
|
||||||
new widgets::Window(this->channelManager, this->colorScheme, this->completionManager, true);
|
new widgets::Window(this->channelManager, this->colorScheme, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string &getSettingsPath()
|
static const std::string &getSettingsPath()
|
||||||
|
@ -69,8 +67,7 @@ widgets::Window &WindowManager::getSelectedWindow()
|
||||||
|
|
||||||
widgets::Window &WindowManager::createWindow()
|
widgets::Window &WindowManager::createWindow()
|
||||||
{
|
{
|
||||||
auto *window = new widgets::Window(this->channelManager, this->colorScheme,
|
auto *window = new widgets::Window(this->channelManager, this->colorScheme, false);
|
||||||
this->completionManager, false);
|
|
||||||
|
|
||||||
window->loadDefaults();
|
window->loadDefaults();
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,12 @@ class CompletionManager;
|
||||||
class WindowManager
|
class WindowManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
explicit WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme);
|
||||||
CompletionManager &_completionManager);
|
|
||||||
|
|
||||||
static WindowManager *instance;
|
static WindowManager *instance;
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
CompletionManager &completionManager;
|
|
||||||
|
|
||||||
void layoutVisibleChatWidgets(Channel *channel = nullptr);
|
void layoutVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
|
|
Loading…
Reference in a new issue