Fixed thumbnails merging with link info without thumbnails (#2244)

This commit is contained in:
Paweł 2020-12-05 15:03:13 +01:00 committed by GitHub
parent 5232cb535e
commit 8b2c3c7386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -32,11 +32,12 @@ void LinkResolver::getLinkInfo(
auto statusCode = root.value("status").toInt(); auto statusCode = root.value("status").toInt();
QString response = QString(); QString response = QString();
QString linkString = url; QString linkString = url;
ImagePtr thumbnail = ImagePtr thumbnail = nullptr;
Image::fromUrl({root.value("thumbnail").toString()});
if (statusCode == 200) if (statusCode == 200)
{ {
response = root.value("tooltip").toString(); response = root.value("tooltip").toString();
thumbnail =
Image::fromUrl({root.value("thumbnail").toString()});
if (getSettings()->unshortLinks) if (getSettings()->unshortLinks)
{ {
linkString = root.value("link").toString(); linkString = root.value("link").toString();

View file

@ -1458,12 +1458,14 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} }
else else
{ {
const auto isHideLink = const auto shouldHideThumbnail =
isInStreamerMode() && isInStreamerMode() &&
getSettings()->streamerModeHideLinkThumbnails && getSettings()->streamerModeHideLinkThumbnails &&
(!element->getThumbnail()->url().string.isEmpty()); element->getThumbnail() != nullptr &&
!element->getThumbnail()->url().string.isEmpty();
auto thumb = auto thumb =
isHideLink ? Image::fromPixmap(getResources().streamerMode) shouldHideThumbnail
? Image::fromPixmap(getResources().streamerMode)
: element->getThumbnail(); : element->getThumbnail();
tooltipPreviewImage.setImage(std::move(thumb)); tooltipPreviewImage.setImage(std::move(thumb));