mirror of
https://github.com/RetroShare/RetroShare.git
synced 2026-09-14 11:06:01 +05:00
restore PostedItem class
This commit is contained in:
parent
2a4ac83406
commit
82b62742ae
@ -22,11 +22,9 @@
|
||||
#include <QMenu>
|
||||
#include <QStyle>
|
||||
#include <QTextDocument>
|
||||
#include <QMovie>
|
||||
|
||||
#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))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user