feat: add settings to toggle BTTV/FFZ global/channel emotes (#3935)
* feat: add settings to disable BTTV/FFZ global/channel emotes * docs: add changelog entry * fix: capitalize `BTTV` and `FFZ` * fix: rename and move settings
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
- Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828)
|
- Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828)
|
||||||
- Minor: Warn when parsing an environment variable fails. (#3904)
|
- Minor: Warn when parsing an environment variable fails. (#3904)
|
||||||
- Minor: Load missing messages from Recent Messages API upon reconnecting (#3878, #3932)
|
- Minor: Load missing messages from Recent Messages API upon reconnecting (#3878, #3932)
|
||||||
|
- Minor: Add settings to toggle BTTV/FFZ global/channel emotes (#3935)
|
||||||
- Bugfix: Fix crash that can occur when closing and quickly reopening a split, then running a command. (#3852)
|
- Bugfix: Fix crash that can occur when closing and quickly reopening a split, then running a command. (#3852)
|
||||||
- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
|
- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
|
||||||
- Bugfix: Fix crash that can occur when changing channels. (#3799)
|
- Bugfix: Fix crash that can occur when changing channels. (#3799)
|
||||||
|
|||||||
@@ -179,6 +179,19 @@ int Application::run(QApplication &qtApp)
|
|||||||
this->windows->forceLayoutChannelViews();
|
this->windows->forceLayoutChannelViews();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getSettings()->enableBTTVGlobalEmotes.connect([this] {
|
||||||
|
this->twitch->reloadBTTVGlobalEmotes();
|
||||||
|
});
|
||||||
|
getSettings()->enableBTTVChannelEmotes.connect([this] {
|
||||||
|
this->twitch->reloadAllBTTVChannelEmotes();
|
||||||
|
});
|
||||||
|
getSettings()->enableFFZGlobalEmotes.connect([this] {
|
||||||
|
this->twitch->reloadFFZGlobalEmotes();
|
||||||
|
});
|
||||||
|
getSettings()->enableFFZChannelEmotes.connect([this] {
|
||||||
|
this->twitch->reloadAllFFZChannelEmotes();
|
||||||
|
});
|
||||||
|
|
||||||
return qtApp.exec();
|
return qtApp.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ using EmoteIdMap = std::unordered_map<EmoteId, EmotePtr>;
|
|||||||
using WeakEmoteMap = std::unordered_map<EmoteName, std::weak_ptr<const Emote>>;
|
using WeakEmoteMap = std::unordered_map<EmoteName, std::weak_ptr<const Emote>>;
|
||||||
using WeakEmoteIdMap = std::unordered_map<EmoteId, std::weak_ptr<const Emote>>;
|
using WeakEmoteIdMap = std::unordered_map<EmoteId, std::weak_ptr<const Emote>>;
|
||||||
|
|
||||||
|
static const std::shared_ptr<const EmoteMap> EMPTY_EMOTE_MAP = std::make_shared<
|
||||||
|
const EmoteMap>(); // NOLINT(cert-err58-cpp) -- assume this doesn't throw an exception
|
||||||
|
|
||||||
EmotePtr cachedOrMakeEmotePtr(Emote &&emote, const EmoteMap &cache);
|
EmotePtr cachedOrMakeEmotePtr(Emote &&emote, const EmoteMap &cache);
|
||||||
EmotePtr cachedOrMakeEmotePtr(
|
EmotePtr cachedOrMakeEmotePtr(
|
||||||
Emote &&emote,
|
Emote &&emote,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "messages/ImageSet.hpp"
|
#include "messages/ImageSet.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
|
#include "singletons/Settings.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -141,6 +142,12 @@ boost::optional<EmotePtr> BttvEmotes::emote(const EmoteName &name) const
|
|||||||
|
|
||||||
void BttvEmotes::loadEmotes()
|
void BttvEmotes::loadEmotes()
|
||||||
{
|
{
|
||||||
|
if (!Settings::instance().enableBTTVGlobalEmotes)
|
||||||
|
{
|
||||||
|
this->global_.set(EMPTY_EMOTE_MAP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NetworkRequest(QString(globalEmoteApiUrl))
|
NetworkRequest(QString(globalEmoteApiUrl))
|
||||||
.timeout(30000)
|
.timeout(30000)
|
||||||
.onSuccess([this](auto result) -> Outcome {
|
.onSuccess([this](auto result) -> Outcome {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
|
#include "singletons/Settings.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -181,6 +182,12 @@ boost::optional<EmotePtr> FfzEmotes::emote(const EmoteName &name) const
|
|||||||
|
|
||||||
void FfzEmotes::loadEmotes()
|
void FfzEmotes::loadEmotes()
|
||||||
{
|
{
|
||||||
|
if (!Settings::instance().enableFFZGlobalEmotes)
|
||||||
|
{
|
||||||
|
this->global_.set(EMPTY_EMOTE_MAP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString url("https://api.frankerfacez.com/v1/set/global");
|
QString url("https://api.frankerfacez.com/v1/set/global");
|
||||||
|
|
||||||
NetworkRequest(url)
|
NetworkRequest(url)
|
||||||
|
|||||||
@@ -197,6 +197,12 @@ void TwitchChannel::setLocalizedName(const QString &name)
|
|||||||
|
|
||||||
void TwitchChannel::refreshBTTVChannelEmotes(bool manualRefresh)
|
void TwitchChannel::refreshBTTVChannelEmotes(bool manualRefresh)
|
||||||
{
|
{
|
||||||
|
if (!Settings::instance().enableBTTVChannelEmotes)
|
||||||
|
{
|
||||||
|
this->bttvEmotes_.set(EMPTY_EMOTE_MAP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BttvEmotes::loadChannel(
|
BttvEmotes::loadChannel(
|
||||||
weakOf<Channel>(this), this->roomId(), this->getLocalizedName(),
|
weakOf<Channel>(this), this->roomId(), this->getLocalizedName(),
|
||||||
[this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
|
[this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
|
||||||
@@ -209,6 +215,12 @@ void TwitchChannel::refreshBTTVChannelEmotes(bool manualRefresh)
|
|||||||
|
|
||||||
void TwitchChannel::refreshFFZChannelEmotes(bool manualRefresh)
|
void TwitchChannel::refreshFFZChannelEmotes(bool manualRefresh)
|
||||||
{
|
{
|
||||||
|
if (!Settings::instance().enableFFZChannelEmotes)
|
||||||
|
{
|
||||||
|
this->ffzEmotes_.set(EMPTY_EMOTE_MAP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FfzEmotes::loadChannel(
|
FfzEmotes::loadChannel(
|
||||||
weakOf<Channel>(this), this->roomId(),
|
weakOf<Channel>(this), this->roomId(),
|
||||||
[this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
|
[this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ void TwitchIrcServer::initialize(Settings &settings, Paths &paths)
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->bttv.loadEmotes();
|
this->reloadBTTVGlobalEmotes();
|
||||||
this->ffz.loadEmotes();
|
this->reloadFFZGlobalEmotes();
|
||||||
|
|
||||||
/* Refresh all twitch channel's live status in bulk every 30 seconds after starting chatterino */
|
/* Refresh all twitch channel's live status in bulk every 30 seconds after starting chatterino */
|
||||||
QObject::connect(&this->bulkLiveStatusTimer_, &QTimer::timeout, [=] {
|
QObject::connect(&this->bulkLiveStatusTimer_, &QTimer::timeout, [=] {
|
||||||
@@ -468,4 +468,33 @@ const FfzEmotes &TwitchIrcServer::getFfzEmotes() const
|
|||||||
return this->ffz;
|
return this->ffz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TwitchIrcServer::reloadBTTVGlobalEmotes()
|
||||||
|
{
|
||||||
|
this->bttv.loadEmotes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwitchIrcServer::reloadAllBTTVChannelEmotes()
|
||||||
|
{
|
||||||
|
this->forEachChannel([](const auto &chan) {
|
||||||
|
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||||
|
{
|
||||||
|
channel->refreshBTTVChannelEmotes(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwitchIrcServer::reloadFFZGlobalEmotes()
|
||||||
|
{
|
||||||
|
this->ffz.loadEmotes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwitchIrcServer::reloadAllFFZChannelEmotes()
|
||||||
|
{
|
||||||
|
this->forEachChannel([](const auto &chan) {
|
||||||
|
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||||
|
{
|
||||||
|
channel->refreshFFZChannelEmotes(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ public:
|
|||||||
|
|
||||||
void bulkRefreshLiveStatus();
|
void bulkRefreshLiveStatus();
|
||||||
|
|
||||||
|
void reloadBTTVGlobalEmotes();
|
||||||
|
void reloadAllBTTVChannelEmotes();
|
||||||
|
void reloadFFZGlobalEmotes();
|
||||||
|
void reloadAllFFZChannelEmotes();
|
||||||
|
|
||||||
Atomic<QString> lastUserThatWhisperedMe;
|
Atomic<QString> lastUserThatWhisperedMe;
|
||||||
|
|
||||||
const ChannelPtr whispersChannel;
|
const ChannelPtr whispersChannel;
|
||||||
|
|||||||
@@ -201,6 +201,11 @@ public:
|
|||||||
BoolSetting removeSpacesBetweenEmotes = {
|
BoolSetting removeSpacesBetweenEmotes = {
|
||||||
"/emotes/removeSpacesBetweenEmotes", false};
|
"/emotes/removeSpacesBetweenEmotes", false};
|
||||||
|
|
||||||
|
BoolSetting enableBTTVGlobalEmotes = {"/emotes/bttv/global", true};
|
||||||
|
BoolSetting enableBTTVChannelEmotes = {"/emotes/bttv/channel", true};
|
||||||
|
BoolSetting enableFFZGlobalEmotes = {"/emotes/ffz/global", true};
|
||||||
|
BoolSetting enableFFZChannelEmotes = {"/emotes/ffz/channel", true};
|
||||||
|
|
||||||
/// Links
|
/// Links
|
||||||
BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false};
|
BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false};
|
||||||
BoolSetting linkInfoTooltip = {"/links/linkInfoTooltip", false};
|
BoolSetting linkInfoTooltip = {"/links/linkInfoTooltip", false};
|
||||||
|
|||||||
@@ -349,16 +349,28 @@ void EmotePopup::loadChannel(ChannelPtr channel)
|
|||||||
*globalChannel, *subChannel, this->channel_->getName());
|
*globalChannel, *subChannel, this->channel_->getName());
|
||||||
|
|
||||||
// global
|
// global
|
||||||
addEmotes(*globalChannel, *getApp()->twitch->getBttvEmotes().emotes(),
|
if (Settings::instance().enableBTTVGlobalEmotes)
|
||||||
"BetterTTV", MessageElementFlag::BttvEmote);
|
{
|
||||||
addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
|
addEmotes(*globalChannel, *getApp()->twitch->getBttvEmotes().emotes(),
|
||||||
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
"BetterTTV", MessageElementFlag::BttvEmote);
|
||||||
|
}
|
||||||
|
if (Settings::instance().enableFFZGlobalEmotes)
|
||||||
|
{
|
||||||
|
addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
|
||||||
|
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
||||||
|
}
|
||||||
|
|
||||||
// channel
|
// channel
|
||||||
addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(), "BetterTTV",
|
if (Settings::instance().enableBTTVChannelEmotes)
|
||||||
MessageElementFlag::BttvEmote);
|
{
|
||||||
addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(),
|
addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(),
|
||||||
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
"BetterTTV", MessageElementFlag::BttvEmote);
|
||||||
|
}
|
||||||
|
if (Settings::instance().enableFFZChannelEmotes)
|
||||||
|
{
|
||||||
|
addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(),
|
||||||
|
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
||||||
|
}
|
||||||
|
|
||||||
this->globalEmotesView_->setChannel(globalChannel);
|
this->globalEmotesView_->setChannel(globalChannel);
|
||||||
this->subEmotesView_->setChannel(subChannel);
|
this->subEmotesView_->setChannel(subChannel);
|
||||||
|
|||||||
@@ -346,6 +346,10 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||||||
"Google",
|
"Google",
|
||||||
},
|
},
|
||||||
s.emojiSet);
|
s.emojiSet);
|
||||||
|
layout.addCheckbox("Show BTTV global emotes", s.enableBTTVGlobalEmotes);
|
||||||
|
layout.addCheckbox("Show BTTV channel emotes", s.enableBTTVChannelEmotes);
|
||||||
|
layout.addCheckbox("Show FFZ global emotes", s.enableFFZGlobalEmotes);
|
||||||
|
layout.addCheckbox("Show FFZ channel emotes", s.enableFFZChannelEmotes);
|
||||||
|
|
||||||
layout.addTitle("Streamer Mode");
|
layout.addTitle("Streamer Mode");
|
||||||
layout.addDescription(
|
layout.addDescription(
|
||||||
|
|||||||
Reference in New Issue
Block a user