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();
QString response = QString();
QString linkString = url;
ImagePtr thumbnail =
Image::fromUrl({root.value("thumbnail").toString()});
ImagePtr thumbnail = nullptr;
if (statusCode == 200)
{
response = root.value("tooltip").toString();
thumbnail =
Image::fromUrl({root.value("thumbnail").toString()});
if (getSettings()->unshortLinks)
{
linkString = root.value("link").toString();

View file

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