mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
feat(emote-popup): automatically reload Twitch emotes (#5580)
This commit is contained in:
parent
820aa12af6
commit
61b04dbe7b
|
@ -28,6 +28,7 @@
|
||||||
- Minor: Added support for scrolling in splits with touchscreen panning gestures. (#5524)
|
- Minor: Added support for scrolling in splits with touchscreen panning gestures. (#5524)
|
||||||
- Minor: Removed experimental IRC support. (#5547)
|
- Minor: Removed experimental IRC support. (#5547)
|
||||||
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
|
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
|
||||||
|
- Minor: The emote popup now reloads when Twitch emotes are reloaded. (#5580)
|
||||||
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426)
|
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426)
|
||||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||||
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504)
|
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504)
|
||||||
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
|
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
|
||||||
- Bugfix: Fixed janky selection for messages with RTL segments (selection is still wrong, but consistently wrong). (#5525)
|
- Bugfix: Fixed janky selection for messages with RTL segments (selection is still wrong, but consistently wrong). (#5525)
|
||||||
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239)
|
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580)
|
||||||
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
|
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
|
||||||
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
|
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
|
||||||
- Bugfix: Fixed some tooltips not being readable. (#5578)
|
- Bugfix: Fixed some tooltips not being readable. (#5578)
|
||||||
|
|
|
@ -275,6 +275,12 @@ void Channel::deleteMessage(QString messageID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Channel::clearMessages()
|
||||||
|
{
|
||||||
|
this->messages_.clear();
|
||||||
|
this->messagesCleared.invoke();
|
||||||
|
}
|
||||||
|
|
||||||
MessagePtr Channel::findMessage(QString messageID)
|
MessagePtr Channel::findMessage(QString messageID)
|
||||||
{
|
{
|
||||||
MessagePtr res;
|
MessagePtr res;
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
pajlada::Signals::Signal<const std::vector<MessagePtr> &> filledInMessages;
|
pajlada::Signals::Signal<const std::vector<MessagePtr> &> filledInMessages;
|
||||||
pajlada::Signals::NoArgSignal destroyed;
|
pajlada::Signals::NoArgSignal destroyed;
|
||||||
pajlada::Signals::NoArgSignal displayNameChanged;
|
pajlada::Signals::NoArgSignal displayNameChanged;
|
||||||
|
pajlada::Signals::NoArgSignal messagesCleared;
|
||||||
|
|
||||||
Type getType() const;
|
Type getType() const;
|
||||||
const QString &getName() const;
|
const QString &getName() const;
|
||||||
|
@ -99,6 +100,9 @@ public:
|
||||||
void replaceMessage(size_t index, MessagePtr replacement);
|
void replaceMessage(size_t index, MessagePtr replacement);
|
||||||
void deleteMessage(QString messageID);
|
void deleteMessage(QString messageID);
|
||||||
|
|
||||||
|
/// Removes all messages from this channel and invokes #messagesCleared
|
||||||
|
void clearMessages();
|
||||||
|
|
||||||
MessagePtr findMessage(QString messageID);
|
MessagePtr findMessage(QString messageID);
|
||||||
|
|
||||||
bool hasMessages() const;
|
bool hasMessages() const;
|
||||||
|
|
|
@ -240,6 +240,11 @@ void TwitchChannel::refreshTwitchChannelEmotes(bool manualRefresh)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (manualRefresh)
|
||||||
|
{
|
||||||
|
getApp()->getAccounts()->twitch.getCurrent()->reloadEmotes(this);
|
||||||
|
}
|
||||||
|
|
||||||
// Twitch's 'Get User Emotes' doesn't assigns a different set-ID to follower
|
// Twitch's 'Get User Emotes' doesn't assigns a different set-ID to follower
|
||||||
// emotes compared to subscriber emotes.
|
// emotes compared to subscriber emotes.
|
||||||
QString setID = TWITCH_SUB_EMOTE_SET_PREFIX % this->roomId();
|
QString setID = TWITCH_SUB_EMOTE_SET_PREFIX % this->roomId();
|
||||||
|
@ -302,11 +307,6 @@ void TwitchChannel::refreshTwitchChannelEmotes(bool manualRefresh)
|
||||||
qCWarning(chatterinoTwitch)
|
qCWarning(chatterinoTwitch)
|
||||||
<< "Failed to get following status:" << error;
|
<< "Failed to get following status:" << error;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (manualRefresh)
|
|
||||||
{
|
|
||||||
getApp()->getAccounts()->twitch.getCurrent()->reloadEmotes(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchChannel::refreshBTTVChannelEmotes(bool manualRefresh)
|
void TwitchChannel::refreshBTTVChannelEmotes(bool manualRefresh)
|
||||||
|
|
|
@ -78,6 +78,8 @@ auto makeEmoteMessage(const EmoteMap &map, const MessageElementFlag &emoteFlag)
|
||||||
if (map.empty())
|
if (map.empty())
|
||||||
{
|
{
|
||||||
MessageBuilder builder;
|
MessageBuilder builder;
|
||||||
|
builder->flags.set(MessageFlag::Centered);
|
||||||
|
builder->flags.set(MessageFlag::DisableCompactEmotes);
|
||||||
builder.emplace<TextElement>("no emotes available",
|
builder.emplace<TextElement>("no emotes available",
|
||||||
MessageElementFlag::Text,
|
MessageElementFlag::Text,
|
||||||
MessageColor::System);
|
MessageColor::System);
|
||||||
|
@ -129,7 +131,7 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
|
||||||
{
|
{
|
||||||
if (!local->empty())
|
if (!local->empty())
|
||||||
{
|
{
|
||||||
addEmotes(subChannel, *local, channelName % u" (follower)",
|
addEmotes(subChannel, *local, channelName % u" (Follower)",
|
||||||
MessageElementFlag::TwitchEmote);
|
MessageElementFlag::TwitchEmote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,6 +295,17 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
this->search_->setFocus();
|
this->search_->setFocus();
|
||||||
|
|
||||||
|
this->signalHolder_.managedConnect(
|
||||||
|
getApp()->getAccounts()->twitch.emotesReloaded,
|
||||||
|
[this](auto * /*caller*/, const auto &result) {
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
// some error occurred, no need to reload
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->reloadEmotes();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmotePopup::addShortcuts()
|
void EmotePopup::addShortcuts()
|
||||||
|
@ -402,9 +415,30 @@ void EmotePopup::loadChannel(ChannelPtr channel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto subChannel = std::make_shared<Channel>("", Channel::Type::None);
|
this->globalEmotesView_->setChannel(
|
||||||
auto globalChannel = std::make_shared<Channel>("", Channel::Type::None);
|
std::make_shared<Channel>("", Channel::Type::None));
|
||||||
auto channelChannel = std::make_shared<Channel>("", Channel::Type::None);
|
this->subEmotesView_->setChannel(
|
||||||
|
std::make_shared<Channel>("", Channel::Type::None));
|
||||||
|
this->channelEmotesView_->setChannel(
|
||||||
|
std::make_shared<Channel>("", Channel::Type::None));
|
||||||
|
|
||||||
|
this->reloadEmotes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmotePopup::reloadEmotes()
|
||||||
|
{
|
||||||
|
if (this->twitchChannel_ == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto subChannel = this->subEmotesView_->underlyingChannel();
|
||||||
|
auto globalChannel = this->globalEmotesView_->underlyingChannel();
|
||||||
|
auto channelChannel = this->channelEmotesView_->underlyingChannel();
|
||||||
|
|
||||||
|
subChannel->clearMessages();
|
||||||
|
globalChannel->clearMessages();
|
||||||
|
channelChannel->clearMessages();
|
||||||
|
|
||||||
// twitch
|
// twitch
|
||||||
addTwitchEmoteSets(
|
addTwitchEmoteSets(
|
||||||
|
@ -447,10 +481,6 @@ void EmotePopup::loadChannel(ChannelPtr channel)
|
||||||
"7TV", MessageElementFlag::SevenTVEmote);
|
"7TV", MessageElementFlag::SevenTVEmote);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->globalEmotesView_->setChannel(globalChannel);
|
|
||||||
this->subEmotesView_->setChannel(subChannel);
|
|
||||||
this->channelEmotesView_->setChannel(channelChannel);
|
|
||||||
|
|
||||||
if (subChannel->getMessageSnapshot().size() == 0)
|
if (subChannel->getMessageSnapshot().size() == 0)
|
||||||
{
|
{
|
||||||
MessageBuilder builder;
|
MessageBuilder builder;
|
||||||
|
|
|
@ -52,6 +52,8 @@ private:
|
||||||
void addShortcuts() override;
|
void addShortcuts() override;
|
||||||
bool eventFilter(QObject *object, QEvent *event) override;
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
|
|
||||||
|
void reloadEmotes();
|
||||||
|
|
||||||
void saveBounds() const;
|
void saveBounds() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -897,6 +897,11 @@ ChannelPtr ChannelView::channel()
|
||||||
return this->channel_;
|
return this->channel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelPtr ChannelView::underlyingChannel() const
|
||||||
|
{
|
||||||
|
return this->underlyingChannel_;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChannelView::showScrollbarHighlights() const
|
bool ChannelView::showScrollbarHighlights() const
|
||||||
{
|
{
|
||||||
return this->channel_->getType() != Channel::Type::TwitchMentions;
|
return this->channel_->getType() != Channel::Type::TwitchMentions;
|
||||||
|
@ -976,6 +981,11 @@ void ChannelView::setChannel(const ChannelPtr &underlyingChannel)
|
||||||
this->channel_->fillInMissingMessages(filtered);
|
this->channel_->fillInMissingMessages(filtered);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->channelConnections_.managedConnect(underlyingChannel->messagesCleared,
|
||||||
|
[this]() {
|
||||||
|
this->clearMessages();
|
||||||
|
});
|
||||||
|
|
||||||
// Copy over messages from the backing channel to the filtered one
|
// Copy over messages from the backing channel to the filtered one
|
||||||
// and the ui.
|
// and the ui.
|
||||||
auto snapshot = underlyingChannel->getMessageSnapshot();
|
auto snapshot = underlyingChannel->getMessageSnapshot();
|
||||||
|
|
|
@ -144,9 +144,20 @@ public:
|
||||||
/// filter settings. It will always be of type Channel, not TwitchChannel
|
/// filter settings. It will always be of type Channel, not TwitchChannel
|
||||||
/// nor IrcChannel.
|
/// nor IrcChannel.
|
||||||
/// It's **not** equal to the channel passed in #setChannel().
|
/// It's **not** equal to the channel passed in #setChannel().
|
||||||
|
/// @see #underlyingChannel()
|
||||||
ChannelPtr channel();
|
ChannelPtr channel();
|
||||||
|
|
||||||
/// Set the channel this view is displaying
|
/// @brief The channel this view displays messages for
|
||||||
|
///
|
||||||
|
/// This channel potentially contains more messages than visible in this
|
||||||
|
/// view due to filter settings.
|
||||||
|
/// It's equal to the channel passed in #setChannel().
|
||||||
|
/// @see #channel()
|
||||||
|
ChannelPtr underlyingChannel() const;
|
||||||
|
|
||||||
|
/// @brief Set the channel this view is displaying
|
||||||
|
///
|
||||||
|
/// @see #underlyingChannel()
|
||||||
void setChannel(const ChannelPtr &underlyingChannel);
|
void setChannel(const ChannelPtr &underlyingChannel);
|
||||||
|
|
||||||
void setFilters(const QList<QUuid> &ids);
|
void setFilters(const QList<QUuid> &ids);
|
||||||
|
|
Loading…
Reference in a new issue