I BROKE EVERYTHING
refactored the rendering process
This commit is contained in:
@@ -19,11 +19,11 @@ ChannelManager::ChannelManager()
|
||||
{
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Channel>> ChannelManager::getItems()
|
||||
const std::vector<SharedChannel> ChannelManager::getItems()
|
||||
{
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
std::vector<std::shared_ptr<Channel>> items;
|
||||
std::vector<SharedChannel> items;
|
||||
|
||||
for (auto &item : this->twitchChannels.values()) {
|
||||
items.push_back(std::get<0>(item));
|
||||
@@ -32,7 +32,7 @@ const std::vector<std::shared_ptr<Channel>> ChannelManager::getItems()
|
||||
return items;
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> ChannelManager::addTwitchChannel(const QString &rawChannelName)
|
||||
SharedChannel ChannelManager::addTwitchChannel(const QString &rawChannelName)
|
||||
{
|
||||
QString channelName = rawChannelName.toLower();
|
||||
|
||||
@@ -63,7 +63,7 @@ std::shared_ptr<Channel> ChannelManager::addTwitchChannel(const QString &rawChan
|
||||
return std::get<0>(it.value());
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> ChannelManager::getTwitchChannel(const QString &channel)
|
||||
SharedChannel ChannelManager::getTwitchChannel(const QString &channel)
|
||||
{
|
||||
QMutexLocker locker(&this->channelsMutex);
|
||||
|
||||
@@ -128,7 +128,7 @@ const std::string &ChannelManager::getUserID(const std::string &username)
|
||||
return temporary;
|
||||
}
|
||||
|
||||
void ChannelManager::doOnAll(std::function<void(std::shared_ptr<Channel>)> func)
|
||||
void ChannelManager::doOnAll(std::function<void(SharedChannel)> func)
|
||||
{
|
||||
for (const auto &channel : this->twitchChannels) {
|
||||
func(std::get<0>(channel));
|
||||
|
||||
@@ -17,20 +17,20 @@ class ChannelManager
|
||||
public:
|
||||
static ChannelManager &getInstance();
|
||||
|
||||
const std::vector<std::shared_ptr<Channel>> getItems();
|
||||
const std::vector<SharedChannel> getItems();
|
||||
|
||||
std::shared_ptr<Channel> addTwitchChannel(const QString &channel);
|
||||
std::shared_ptr<Channel> getTwitchChannel(const QString &channel);
|
||||
SharedChannel addTwitchChannel(const QString &channel);
|
||||
SharedChannel getTwitchChannel(const QString &channel);
|
||||
void removeTwitchChannel(const QString &channel);
|
||||
|
||||
const std::string &getUserID(const std::string &username);
|
||||
|
||||
void doOnAll(std::function<void(std::shared_ptr<Channel>)> func);
|
||||
void doOnAll(std::function<void(SharedChannel)> func);
|
||||
|
||||
// Special channels
|
||||
const std::shared_ptr<Channel> whispersChannel;
|
||||
const std::shared_ptr<Channel> mentionsChannel;
|
||||
const std::shared_ptr<Channel> emptyChannel;
|
||||
const SharedChannel whispersChannel;
|
||||
const SharedChannel mentionsChannel;
|
||||
const SharedChannel emptyChannel;
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> usernameToID;
|
||||
|
||||
@@ -88,7 +88,7 @@ QStringList CommandManager::getCommands()
|
||||
return this->commandsStringList;
|
||||
}
|
||||
|
||||
QString CommandManager::execCommand(const QString &text, std::shared_ptr<Channel> channel,
|
||||
QString CommandManager::execCommand(const QString &text, SharedChannel channel,
|
||||
bool dryRun)
|
||||
{
|
||||
QStringList words = text.split(' ', QString::SkipEmptyParts);
|
||||
@@ -110,9 +110,8 @@ QString CommandManager::execCommand(const QString &text, std::shared_ptr<Channel
|
||||
if (commandName == "/uptime") {
|
||||
QString messageText =
|
||||
twitchChannel->isLive ? twitchChannel->streamUptime : "Channel is not live.";
|
||||
messages::SharedMessage message(
|
||||
messages::Message::createSystemMessage(messageText));
|
||||
channel->addMessage(message);
|
||||
|
||||
channel->addMessage(messages::Message::createSystemMessage(messageText));
|
||||
|
||||
return "";
|
||||
} else if (commandName == "/ignore" && words.size() >= 2) {
|
||||
@@ -122,9 +121,7 @@ QString CommandManager::execCommand(const QString &text, std::shared_ptr<Channel
|
||||
messageText = "Ignored user \"" + words.at(1) + "\".";
|
||||
}
|
||||
|
||||
messages::SharedMessage message(
|
||||
messages::Message::createSystemMessage(messageText));
|
||||
channel->addMessage(message);
|
||||
channel->addMessage(messages::Message::createSystemMessage(messageText));
|
||||
return "";
|
||||
} else if (commandName == "/unignore") {
|
||||
QString messageText;
|
||||
@@ -133,9 +130,7 @@ QString CommandManager::execCommand(const QString &text, std::shared_ptr<Channel
|
||||
messageText = "Ignored user \"" + words.at(1) + "\".";
|
||||
}
|
||||
|
||||
messages::SharedMessage message(
|
||||
messages::Message::createSystemMessage(messageText));
|
||||
channel->addMessage(message);
|
||||
channel->addMessage(messages::Message::createSystemMessage(messageText));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ static void FillInFFZEmoteData(const QJsonObject &urls, const QString &code,
|
||||
|
||||
assert(!url1x.isEmpty());
|
||||
|
||||
emoteData.image1x = new LazyLoadedImage(url1x, 1, code, code + "<br />Global FFZ Emote");
|
||||
emoteData.image1x = new Image(url1x, 1, code, code + "<br />Global FFZ Emote");
|
||||
|
||||
if (!url2x.isEmpty()) {
|
||||
emoteData.image2x = new LazyLoadedImage(url2x, 0.5, code, code + "<br />Global FFZ Emote");
|
||||
emoteData.image2x = new Image(url2x, 0.5, code, code + "<br />Global FFZ Emote");
|
||||
}
|
||||
|
||||
if (!url3x.isEmpty()) {
|
||||
emoteData.image3x = new LazyLoadedImage(url3x, 0.25, code, code + "<br />Global FFZ Emote");
|
||||
emoteData.image3x = new Image(url3x, 0.25, code, code + "<br />Global FFZ Emote");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName,
|
||||
|
||||
auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [this, &code, &link] {
|
||||
return util::EmoteData(
|
||||
new LazyLoadedImage(link, 1, code, code + "<br/>Channel BTTV Emote"));
|
||||
new Image(link, 1, code, code + "<br/>Channel BTTV Emote"));
|
||||
});
|
||||
|
||||
this->bttvChannelEmotes.insert(code, emote);
|
||||
@@ -294,7 +294,7 @@ void EmoteManager::loadEmojis()
|
||||
code + ".png";
|
||||
|
||||
this->emojis.insert(code,
|
||||
util::EmoteData(new LazyLoadedImage(url, 0.35, ":" + shortCode + ":",
|
||||
util::EmoteData(new Image(url, 0.35, ":" + shortCode + ":",
|
||||
":" + shortCode + ":<br/>Emoji")));
|
||||
|
||||
// TODO(pajlada): The vectors in emojiFirstByte need to be sorted by
|
||||
@@ -375,7 +375,7 @@ void EmoteManager::parseEmojis(std::vector<std::tuple<util::EmoteData, QString>>
|
||||
// Create or fetch cached emoji image
|
||||
auto emojiImage = this->emojis.getOrAdd(matchedEmoji.code, [this, &url] {
|
||||
return util::EmoteData(
|
||||
new LazyLoadedImage(url, 0.35, "?????????", "???????????????")); //
|
||||
new Image(url, 0.35, "?????????", "???????????????")); //
|
||||
});
|
||||
|
||||
// Push the emoji as a word to parsedWords
|
||||
@@ -489,11 +489,11 @@ void EmoteManager::loadBTTVEmotes()
|
||||
QString code = emote.toObject().value("code").toString();
|
||||
|
||||
util::EmoteData emoteData;
|
||||
emoteData.image1x = new LazyLoadedImage(GetBTTVEmoteLink(urlTemplate, id, "1x"), 1,
|
||||
emoteData.image1x = new Image(GetBTTVEmoteLink(urlTemplate, id, "1x"), 1,
|
||||
code, code + "<br />Global BTTV Emote");
|
||||
emoteData.image2x = new LazyLoadedImage(GetBTTVEmoteLink(urlTemplate, id, "2x"), 0.5,
|
||||
emoteData.image2x = new Image(GetBTTVEmoteLink(urlTemplate, id, "2x"), 0.5,
|
||||
code, code + "<br />Global BTTV Emote");
|
||||
emoteData.image3x = new LazyLoadedImage(GetBTTVEmoteLink(urlTemplate, id, "3x"), 0.25,
|
||||
emoteData.image3x = new Image(GetBTTVEmoteLink(urlTemplate, id, "3x"), 0.25,
|
||||
code, code + "<br />Global BTTV Emote");
|
||||
|
||||
this->bttvGlobalEmotes.insert(code, emoteData);
|
||||
@@ -547,11 +547,11 @@ util::EmoteData EmoteManager::getTwitchEmoteById(long id, const QString &emoteNa
|
||||
|
||||
return _twitchEmoteFromCache.getOrAdd(id, [this, &emoteName, &_emoteName, &id] {
|
||||
util::EmoteData newEmoteData;
|
||||
newEmoteData.image1x = new LazyLoadedImage(GetTwitchEmoteLink(id, "1.0"), 1, emoteName,
|
||||
newEmoteData.image1x = new Image(GetTwitchEmoteLink(id, "1.0"), 1, emoteName,
|
||||
_emoteName + "<br/>Twitch Emote 1x");
|
||||
newEmoteData.image2x = new LazyLoadedImage(GetTwitchEmoteLink(id, "2.0"), .5, emoteName,
|
||||
newEmoteData.image2x = new Image(GetTwitchEmoteLink(id, "2.0"), .5, emoteName,
|
||||
_emoteName + "<br/>Twitch Emote 2x");
|
||||
newEmoteData.image3x = new LazyLoadedImage(GetTwitchEmoteLink(id, "3.0"), .25, emoteName,
|
||||
newEmoteData.image3x = new Image(GetTwitchEmoteLink(id, "3.0"), .25, emoteName,
|
||||
_emoteName + "<br/>Twitch Emote 3x");
|
||||
|
||||
return newEmoteData;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define GIF_FRAME_LENGTH 33
|
||||
|
||||
#include "emojis.hpp"
|
||||
#include "messages/lazyloadedimage.hpp"
|
||||
#include "messages/image.hpp"
|
||||
#include "signalvector.hpp"
|
||||
#include "twitch/emotevalue.hpp"
|
||||
#include "twitch/twitchuser.hpp"
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
boost::signals2::signal<void()> &getGifUpdateSignal();
|
||||
|
||||
// Bit badge/emotes?
|
||||
util::ConcurrentMap<QString, messages::LazyLoadedImage *> miscImageCache;
|
||||
util::ConcurrentMap<QString, messages::Image *> miscImageCache;
|
||||
|
||||
private:
|
||||
SettingManager &settingsManager;
|
||||
|
||||
@@ -132,6 +132,7 @@ private:
|
||||
|
||||
int generation = 0;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
typedef singletons::FontManager::Type FontStyle;
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -71,9 +71,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
||||
|
||||
// check if the chat has been cleared by a moderator
|
||||
if (message->parameters().length() == 1) {
|
||||
SharedMessage msg(Message::createSystemMessage("Chat has been cleared by a moderator."));
|
||||
|
||||
c->addMessage(msg);
|
||||
c->addMessage(Message::createSystemMessage("Chat has been cleared by a moderator."));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -94,12 +92,13 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
||||
}
|
||||
|
||||
// add the notice that the user has been timed out
|
||||
LimitedQueueSnapshot<SharedMessage> snapshot = c->getMessageSnapshot();
|
||||
LimitedQueueSnapshot<MessagePtr> snapshot = c->getMessageSnapshot();
|
||||
bool addMessage = true;
|
||||
int snapshotLength = snapshot.getLength();
|
||||
|
||||
for (int i = std::max(0, (int)snapshot.getLength() - 20); i < snapshot.getLength(); i++) {
|
||||
if (snapshot[i]->getFlags() & Message::Timeout && snapshot[i]->timeoutUser == username) {
|
||||
SharedMessage replacement(
|
||||
for (int i = std::max(0, snapshotLength - 20); i < snapshotLength; i++) {
|
||||
if (snapshot[i]->hasFlags(Message::Timeout) && snapshot[i]->loginName == username) {
|
||||
MessagePtr replacement(
|
||||
Message::createTimeoutMessage(username, durationInSeconds, reason, true));
|
||||
c->replaceMessage(snapshot[i], replacement);
|
||||
addMessage = false;
|
||||
@@ -108,16 +107,13 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
||||
}
|
||||
|
||||
if (addMessage) {
|
||||
SharedMessage msg(
|
||||
Message::createTimeoutMessage(username, durationInSeconds, reason, false));
|
||||
c->addMessage(msg);
|
||||
c->addMessage(Message::createTimeoutMessage(username, durationInSeconds, reason, false));
|
||||
}
|
||||
|
||||
// disable the messages from the user
|
||||
for (int i = 0; i < snapshot.getLength(); i++) {
|
||||
if (!(snapshot[i]->getFlags() & Message::Timeout) &&
|
||||
snapshot[i]->getTimeoutUser() == username) {
|
||||
snapshot[i]->setDisabled(true);
|
||||
for (int i = 0; i < snapshotLength; i++) {
|
||||
if (!snapshot[i]->hasFlags(Message::Timeout) && snapshot[i]->loginName == username) {
|
||||
snapshot[i]->setFlags(Message::Disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +151,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
||||
auto rawChannelName = message->target();
|
||||
|
||||
bool broadcast = rawChannelName.length() < 2;
|
||||
std::shared_ptr<Message> msg(Message::createSystemMessage(message->content()));
|
||||
MessagePtr msg = Message::createSystemMessage(message->content());
|
||||
|
||||
if (broadcast) {
|
||||
this->channelManager.doOnAll([msg](const auto &c) {
|
||||
|
||||
@@ -381,9 +381,9 @@ void IrcManager::removeIgnoredUser(QString const &username)
|
||||
|
||||
void IrcManager::onConnected()
|
||||
{
|
||||
std::shared_ptr<Message> msg(Message::createSystemMessage("connected to chat"));
|
||||
MessagePtr msg = Message::createSystemMessage("connected to chat");
|
||||
|
||||
this->channelManager.doOnAll([msg](std::shared_ptr<Channel> channel) {
|
||||
this->channelManager.doOnAll([msg](SharedChannel channel) {
|
||||
assert(channel);
|
||||
channel->addMessage(msg);
|
||||
});
|
||||
@@ -391,9 +391,9 @@ void IrcManager::onConnected()
|
||||
|
||||
void IrcManager::onDisconnected()
|
||||
{
|
||||
std::shared_ptr<Message> msg(Message::createSystemMessage("disconnected from chat"));
|
||||
MessagePtr msg = Message::createSystemMessage("disconnected from chat");
|
||||
|
||||
this->channelManager.doOnAll([msg](std::shared_ptr<Channel> channel) {
|
||||
this->channelManager.doOnAll([msg](SharedChannel channel) {
|
||||
assert(channel);
|
||||
channel->addMessage(msg);
|
||||
});
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace singletons {
|
||||
|
||||
namespace {
|
||||
|
||||
inline messages::LazyLoadedImage *lli(const char *pixmapPath, qreal scale = 1)
|
||||
inline messages::Image *lli(const char *pixmapPath, qreal scale = 1)
|
||||
{
|
||||
return new messages::LazyLoadedImage(new QPixmap(pixmapPath), scale);
|
||||
return new messages::Image(new QPixmap(pixmapPath), scale);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -49,9 +49,9 @@ ResourceManager &ResourceManager::getInstance()
|
||||
}
|
||||
|
||||
ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
||||
: badgeImage1x(new messages::LazyLoadedImage(root.value("image_url_1x").toString()))
|
||||
, badgeImage2x(new messages::LazyLoadedImage(root.value("image_url_2x").toString()))
|
||||
, badgeImage4x(new messages::LazyLoadedImage(root.value("image_url_4x").toString()))
|
||||
: badgeImage1x(new messages::Image(root.value("image_url_1x").toString()))
|
||||
, badgeImage2x(new messages::Image(root.value("image_url_2x").toString()))
|
||||
, badgeImage4x(new messages::Image(root.value("image_url_4x").toString()))
|
||||
, description(root.value("description").toString().toStdString())
|
||||
, title(root.value("title").toString().toStdString())
|
||||
, clickAction(root.value("clickAction").toString().toStdString())
|
||||
@@ -139,7 +139,7 @@ void ResourceManager::loadChatterinoBadges()
|
||||
const QString &badgeVariantImageURL = badgeVariant.value("image").toString();
|
||||
|
||||
auto badgeVariantPtr = std::make_shared<ChatterinoBadge>(
|
||||
badgeVariantTooltip, new messages::LazyLoadedImage(badgeVariantImageURL));
|
||||
badgeVariantTooltip, new messages::Image(badgeVariantImageURL));
|
||||
|
||||
QJsonArray badgeVariantUsers = badgeVariant.value("users").toArray();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "messages/lazyloadedimage.hpp"
|
||||
#include "messages/image.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -16,34 +16,34 @@ class ResourceManager
|
||||
public:
|
||||
static ResourceManager &getInstance();
|
||||
|
||||
messages::LazyLoadedImage *badgeStaff;
|
||||
messages::LazyLoadedImage *badgeAdmin;
|
||||
messages::LazyLoadedImage *badgeGlobalModerator;
|
||||
messages::LazyLoadedImage *badgeModerator;
|
||||
messages::LazyLoadedImage *badgeTurbo;
|
||||
messages::LazyLoadedImage *badgeBroadcaster;
|
||||
messages::LazyLoadedImage *badgePremium;
|
||||
messages::LazyLoadedImage *badgeVerified;
|
||||
messages::LazyLoadedImage *badgeSubscriber;
|
||||
messages::LazyLoadedImage *badgeCollapsed;
|
||||
messages::Image *badgeStaff;
|
||||
messages::Image *badgeAdmin;
|
||||
messages::Image *badgeGlobalModerator;
|
||||
messages::Image *badgeModerator;
|
||||
messages::Image *badgeTurbo;
|
||||
messages::Image *badgeBroadcaster;
|
||||
messages::Image *badgePremium;
|
||||
messages::Image *badgeVerified;
|
||||
messages::Image *badgeSubscriber;
|
||||
messages::Image *badgeCollapsed;
|
||||
|
||||
messages::LazyLoadedImage *cheerBadge100000;
|
||||
messages::LazyLoadedImage *cheerBadge10000;
|
||||
messages::LazyLoadedImage *cheerBadge5000;
|
||||
messages::LazyLoadedImage *cheerBadge1000;
|
||||
messages::LazyLoadedImage *cheerBadge100;
|
||||
messages::LazyLoadedImage *cheerBadge1;
|
||||
messages::Image *cheerBadge100000;
|
||||
messages::Image *cheerBadge10000;
|
||||
messages::Image *cheerBadge5000;
|
||||
messages::Image *cheerBadge1000;
|
||||
messages::Image *cheerBadge100;
|
||||
messages::Image *cheerBadge1;
|
||||
|
||||
std::map<std::string, messages::LazyLoadedImage *> cheerBadges;
|
||||
std::map<std::string, messages::Image *> cheerBadges;
|
||||
|
||||
struct BadgeVersion {
|
||||
BadgeVersion() = delete;
|
||||
|
||||
explicit BadgeVersion(QJsonObject &&root);
|
||||
|
||||
messages::LazyLoadedImage *badgeImage1x;
|
||||
messages::LazyLoadedImage *badgeImage2x;
|
||||
messages::LazyLoadedImage *badgeImage4x;
|
||||
messages::Image *badgeImage1x;
|
||||
messages::Image *badgeImage2x;
|
||||
messages::Image *badgeImage4x;
|
||||
std::string description;
|
||||
std::string title;
|
||||
std::string clickAction;
|
||||
@@ -58,8 +58,8 @@ public:
|
||||
|
||||
bool dynamicBadgesLoaded = false;
|
||||
|
||||
messages::LazyLoadedImage *buttonBan;
|
||||
messages::LazyLoadedImage *buttonTimeout;
|
||||
messages::Image *buttonBan;
|
||||
messages::Image *buttonTimeout;
|
||||
|
||||
struct Channel {
|
||||
std::map<std::string, BadgeSet> badgeSets;
|
||||
@@ -72,14 +72,14 @@ public:
|
||||
|
||||
// Chatterino badges
|
||||
struct ChatterinoBadge {
|
||||
ChatterinoBadge(const std::string &_tooltip, messages::LazyLoadedImage *_image)
|
||||
ChatterinoBadge(const std::string &_tooltip, messages::Image *_image)
|
||||
: tooltip(_tooltip)
|
||||
, image(_image)
|
||||
{
|
||||
}
|
||||
|
||||
std::string tooltip;
|
||||
messages::LazyLoadedImage *image;
|
||||
messages::Image *image;
|
||||
};
|
||||
|
||||
// username
|
||||
|
||||
@@ -18,7 +18,6 @@ SettingManager::SettingManager()
|
||||
: snapshot(nullptr)
|
||||
{
|
||||
this->wordMaskListener.addSetting(this->showTimestamps);
|
||||
this->wordMaskListener.addSetting(this->showTimestampSeconds);
|
||||
this->wordMaskListener.addSetting(this->showBadges);
|
||||
this->wordMaskListener.addSetting(this->enableBttvEmotes);
|
||||
this->wordMaskListener.addSetting(this->enableEmojis);
|
||||
@@ -29,7 +28,7 @@ SettingManager::SettingManager()
|
||||
};
|
||||
}
|
||||
|
||||
Word::Flags SettingManager::getWordTypeMask()
|
||||
MessageElement::Flags SettingManager::getWordTypeMask()
|
||||
{
|
||||
return this->wordTypeMask;
|
||||
}
|
||||
@@ -48,35 +47,31 @@ void SettingManager::init()
|
||||
|
||||
void SettingManager::updateWordTypeMask()
|
||||
{
|
||||
uint32_t newMaskUint = Word::Text;
|
||||
uint32_t newMaskUint = MessageElement::Text;
|
||||
|
||||
if (this->showTimestamps) {
|
||||
if (this->showTimestampSeconds) {
|
||||
newMaskUint |= Word::TimestampWithSeconds;
|
||||
} else {
|
||||
newMaskUint |= Word::TimestampNoSeconds;
|
||||
}
|
||||
newMaskUint |= MessageElement::Timestamp;
|
||||
}
|
||||
|
||||
newMaskUint |= enableTwitchEmotes ? Word::TwitchEmoteImage : Word::TwitchEmoteText;
|
||||
newMaskUint |= enableFfzEmotes ? Word::FfzEmoteImage : Word::FfzEmoteText;
|
||||
newMaskUint |= enableBttvEmotes ? Word::BttvEmoteImage : Word::BttvEmoteText;
|
||||
newMaskUint |=
|
||||
(enableBttvEmotes && enableGifAnimations) ? Word::BttvEmoteImage : Word::BttvEmoteText;
|
||||
newMaskUint |= enableEmojis ? Word::EmojiImage : Word::EmojiText;
|
||||
enableTwitchEmotes ? MessageElement::TwitchEmoteImage : MessageElement::TwitchEmoteText;
|
||||
newMaskUint |= enableFfzEmotes ? MessageElement::FfzEmoteImage : MessageElement::FfzEmoteText;
|
||||
newMaskUint |=
|
||||
enableBttvEmotes ? MessageElement::BttvEmoteImage : MessageElement::BttvEmoteText;
|
||||
newMaskUint |= enableEmojis ? MessageElement::EmojiImage : MessageElement::EmojiText;
|
||||
|
||||
newMaskUint |= Word::BitsAmount;
|
||||
newMaskUint |= enableGifAnimations ? Word::BitsAnimated : Word::BitsStatic;
|
||||
newMaskUint |= MessageElement::BitsAmount;
|
||||
newMaskUint |= enableGifAnimations ? MessageElement::BitsAnimated : MessageElement::BitsStatic;
|
||||
|
||||
if (this->showBadges) {
|
||||
newMaskUint |= Word::Badges;
|
||||
newMaskUint |= MessageElement::Badges;
|
||||
}
|
||||
|
||||
newMaskUint |= Word::Username;
|
||||
newMaskUint |= MessageElement::Username;
|
||||
|
||||
newMaskUint |= Word::AlwaysShow;
|
||||
newMaskUint |= MessageElement::AlwaysShow;
|
||||
|
||||
Word::Flags newMask = static_cast<Word::Flags>(newMaskUint);
|
||||
MessageElement::Flags newMask = static_cast<MessageElement::Flags>(newMaskUint);
|
||||
|
||||
if (newMask != this->wordTypeMask) {
|
||||
this->wordTypeMask = newMask;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "messages/highlightphrase.hpp"
|
||||
#include "messages/word.hpp"
|
||||
#include "messages/messageelement.hpp"
|
||||
#include "singletons/helper/chatterinosetting.hpp"
|
||||
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
@@ -23,14 +23,14 @@ class SettingManager : public QObject
|
||||
using QStringSetting = ChatterinoSetting<QString>;
|
||||
|
||||
public:
|
||||
messages::Word::Flags getWordTypeMask();
|
||||
messages::MessageElement::Flags getWordTypeMask();
|
||||
bool isIgnoredEmote(const QString &emote);
|
||||
|
||||
void init();
|
||||
|
||||
/// Appearance
|
||||
BoolSetting showTimestamps = {"/appearance/messages/showTimestamps", true};
|
||||
BoolSetting showTimestampSeconds = {"/appearance/messages/showTimestampSeconds", true};
|
||||
QStringSetting timestampFormat = {"/appearance/messages/timestampFormat", "h:mm"};
|
||||
BoolSetting showBadges = {"/appearance/messages/showBadges", true};
|
||||
BoolSetting showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false};
|
||||
BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false};
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
|
||||
SettingManager();
|
||||
|
||||
messages::Word::Flags wordTypeMask = messages::Word::Default;
|
||||
messages::MessageElement::Flags wordTypeMask = messages::MessageElement::Default;
|
||||
|
||||
pajlada::Settings::SettingListener wordMaskListener;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user