mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix link preview doesn't update link info for previous messages after setting is enabled (#2108)
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
86feef6be8
commit
892e16c533
|
@ -40,6 +40,7 @@
|
||||||
- Bugfix: Fixed timestamps missing on channel point redemption messages (#1943)
|
- Bugfix: Fixed timestamps missing on channel point redemption messages (#1943)
|
||||||
- Bugfix: Fixed tooltip didn't show in `EmotePopup` depending on the `Link preview` setting enabled or no (#2008)
|
- Bugfix: Fixed tooltip didn't show in `EmotePopup` depending on the `Link preview` setting enabled or no (#2008)
|
||||||
- Bugfix: Fixed Stream thumbnail not updating after using the "Change channel" feature (#2074, #2080)
|
- Bugfix: Fixed Stream thumbnail not updating after using the "Change channel" feature (#2074, #2080)
|
||||||
|
- Bugfix: Fixed previous link info not updating after `Link information` setting is enabled (#2054)
|
||||||
- Bugfix: Fix Tab key not working in the Ctrl+K Quick Switcher (#2065)
|
- Bugfix: Fix Tab key not working in the Ctrl+K Quick Switcher (#2065)
|
||||||
- Bugfix: Fix bug preventing moderator actions when viewing a user card from the search window (#1089)
|
- Bugfix: Fix bug preventing moderator actions when viewing a user card from the search window (#1089)
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
#include "messages/layouts/MessageLayout.hpp"
|
#include "messages/layouts/MessageLayout.hpp"
|
||||||
#include "messages/layouts/MessageLayoutElement.hpp"
|
#include "messages/layouts/MessageLayoutElement.hpp"
|
||||||
|
#include "providers/LinkResolver.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
#include "singletons/Resources.hpp"
|
#include "singletons/Resources.hpp"
|
||||||
|
@ -1379,13 +1380,13 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &tooltip = hoverLayoutElement->getCreator().getTooltip();
|
auto element = &hoverLayoutElement->getCreator();
|
||||||
bool isLinkValid = hoverLayoutElement->getLink().isValid();
|
bool isLinkValid = hoverLayoutElement->getLink().isValid();
|
||||||
auto emoteElement =
|
auto emoteElement = dynamic_cast<const EmoteElement *>(element);
|
||||||
dynamic_cast<const EmoteElement *>(&hoverLayoutElement->getCreator());
|
|
||||||
|
|
||||||
if (tooltip.isEmpty() || (isLinkValid && emoteElement == nullptr &&
|
if (element->getTooltip().isEmpty() ||
|
||||||
!getSettings()->linkInfoTooltip))
|
(isLinkValid && emoteElement == nullptr &&
|
||||||
|
!getSettings()->linkInfoTooltip))
|
||||||
{
|
{
|
||||||
tooltipWidget->hide();
|
tooltipWidget->hide();
|
||||||
}
|
}
|
||||||
|
@ -1393,8 +1394,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
auto &tooltipPreviewImage = TooltipPreviewImage::instance();
|
auto &tooltipPreviewImage = TooltipPreviewImage::instance();
|
||||||
tooltipPreviewImage.setImageScale(0, 0);
|
tooltipPreviewImage.setImageScale(0, 0);
|
||||||
auto badgeElement = dynamic_cast<const BadgeElement *>(
|
auto badgeElement = dynamic_cast<const BadgeElement *>(element);
|
||||||
&hoverLayoutElement->getCreator());
|
|
||||||
|
|
||||||
if ((badgeElement || emoteElement) &&
|
if ((badgeElement || emoteElement) &&
|
||||||
getSettings()->emotesTooltipPreview.getValue())
|
getSettings()->emotesTooltipPreview.getValue())
|
||||||
|
@ -1420,7 +1420,21 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto element = &hoverLayoutElement->getCreator();
|
if (element->getTooltip() == "No link info loaded")
|
||||||
|
{
|
||||||
|
std::weak_ptr<MessageLayout> weakLayout = layout;
|
||||||
|
LinkResolver::getLinkInfo(
|
||||||
|
element->getLink().value, nullptr,
|
||||||
|
[weakLayout, element](QString tooltipText,
|
||||||
|
Link originalLink,
|
||||||
|
ImagePtr thumbnail) {
|
||||||
|
auto shared = weakLayout.lock();
|
||||||
|
if (!shared)
|
||||||
|
return;
|
||||||
|
element->setTooltip(tooltipText);
|
||||||
|
element->setThumbnail(thumbnail);
|
||||||
|
});
|
||||||
|
}
|
||||||
auto thumbnailSize = getSettings()->thumbnailSize;
|
auto thumbnailSize = getSettings()->thumbnailSize;
|
||||||
if (!thumbnailSize)
|
if (!thumbnailSize)
|
||||||
{
|
{
|
||||||
|
@ -1448,7 +1462,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
|
||||||
tooltipWidget->moveTo(this, event->globalPos());
|
tooltipWidget->moveTo(this, event->globalPos());
|
||||||
tooltipWidget->setWordWrap(isLinkValid);
|
tooltipWidget->setWordWrap(isLinkValid);
|
||||||
tooltipWidget->setText(tooltip);
|
tooltipWidget->setText(element->getTooltip());
|
||||||
tooltipWidget->adjustSize();
|
tooltipWidget->adjustSize();
|
||||||
tooltipWidget->show();
|
tooltipWidget->show();
|
||||||
tooltipWidget->raise();
|
tooltipWidget->raise();
|
||||||
|
|
Loading…
Reference in a new issue