From 82b62742ae1c692aca2e6a02ff72be474dc99624 Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Thu, 15 Jan 2026 17:41:10 +0100 Subject: [PATCH] restore PostedItem class --- retroshare-gui/src/gui/Posted/PostedItem.cpp | 52 +++++--------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index ff1b6b440..186580b7a 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -22,11 +22,9 @@ #include #include #include -#include #include "rshare.h" #include "PostedItem.h" -#include "BoardPostImageHelper.h" #include "gui/feeds/FeedHolder.h" #include "gui/RetroShareLink.h" #include "gui/gxs/GxsIdDetails.h" @@ -572,45 +570,21 @@ void PostedItem::fill() if(mPost.mImage.mData != NULL) { - QString format; - if (BoardPostImageHelper::isAnimatedImage(mPost.mImage.mData, mPost.mImage.mSize, &format)) - { - // Animated GIF/WEBP - use QMovie - QMovie* movie = BoardPostImageHelper::createMovieFromData(mPost.mImage.mData, mPost.mImage.mSize); - if (movie) - { - movie->setParent(ui->pictureLabel); // Ensure cleanup - ui->pictureLabel->setMovie(movie); - movie->start(); - // Loop animation when finished - connect(movie, &QMovie::finished, movie, &QMovie::start); - - // Use first frame for thumbnail (ensure it's loaded first) - movie->jumpToFrame(0); - QPixmap firstFrame = movie->currentPixmap(); - if (!firstFrame.isNull()) - ui->thumbnailLabel->setPicture(firstFrame); - } - } - else - { - // Static image - use QPixmap - QPixmap pixmap; - GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL); - ui->pictureLabel->setPicture(pixmap); - - // Set thumbnail - ui->thumbnailLabel->setPicture(pixmap); - - // Scale for pictureLabel if needed - if(pixmap.width() > 800){ - QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation); - ui->pictureLabel->setPixmap(scaledpixmap); - }else - ui->pictureLabel->setPixmap(pixmap); - } + QPixmap pixmap; + GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL); + // Wiping data - as its been passed to thumbnail. + +// QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); + ui->thumbnailLabel->setPicture(pixmap); ui->thumbnailLabel->setToolTip(tr("Click to view Picture")); ui->thumbnailLabel->setEnableZoom(false); + + QPixmap scaledpixmap; + if(pixmap.width() > 800){ + QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation); + ui->pictureLabel->setPixmap(scaledpixmap); + }else + ui->pictureLabel->setPixmap(pixmap); } else if (urlOkay && (mPost.mImage.mData == NULL)) {