From fa64fd03620220a171724ea1176b33bb1e30934e Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 29 Nov 2020 16:46:02 +0100 Subject: [PATCH 1/3] Added ZoomableLabel for the Channel Post Feeds --- .../src/gui/feeds/GxsChannelPostItem.cpp | 22 ++++++++----------- .../src/gui/feeds/GxsChannelPostItem.ui | 7 +++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index fa37f17a1..ea643346e 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -221,6 +221,10 @@ void GxsChannelPostItem::setup() //ui->subjectLabel->setMinimumWidth(100); //ui->warning_label->setMinimumWidth(100); + ui->logoLabel->setEnableZoom(false); + int desired_height = QFontMetricsF(font()).height() * 8; + ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height); + ui->mainFrame->setProperty("new", false); ui->mainFrame->style()->unpolish(ui->mainFrame); ui->mainFrame->style()->polish( ui->mainFrame); @@ -435,24 +439,16 @@ void GxsChannelPostItem::fill() if(mPost.mThumbnail.mData != NULL) { QPixmap thumbnail; - - ui->logoLabel->setScaledContents(true); + + ui->logoLabel->setScaledContents(true); GxsIdDetails::loadPixmapFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL); // Wiping data - as its been passed to thumbnail. -// if( thumbnail.width() < 90 ){ -// ui->logoLabel->setMaximumSize(82*f,108*f); -// } -// else if( thumbnail.width() < 109 ){ -// ui->logoLabel->setMinimumSize(108*f,108*f); -// ui->logoLabel->setMaximumSize(108*f,108*f); -// } -// else{ -// ui->logoLabel->setMinimumSize(156*f,108*f); -// ui->logoLabel->setMaximumSize(156*f,108*f); -// } + ui->logoLabel->setPixmap(thumbnail); } + else + ui->logoLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png") ); if( !IS_GROUP_PUBLISHER(mGroupMeta.mSubscribeFlags) ) ui->editButton->hide() ; diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui index e45e9d867..3ce8c06b3 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui @@ -52,7 +52,7 @@ - + 0 @@ -475,6 +475,11 @@
gui/common/ElidedLabel.h
1 + + ZoomableLabel + QLabel +
gui/gxschannels/GxsChannelPostThumbnail.h
+
From f67153538f2836a82c6e96b1cc9cdb6657096aba Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 5 Dec 2020 13:39:42 +0100 Subject: [PATCH 2/3] removed scale contents --- retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index ea643346e..4d00e0290 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -221,10 +221,6 @@ void GxsChannelPostItem::setup() //ui->subjectLabel->setMinimumWidth(100); //ui->warning_label->setMinimumWidth(100); - ui->logoLabel->setEnableZoom(false); - int desired_height = QFontMetricsF(font()).height() * 8; - ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height); - ui->mainFrame->setProperty("new", false); ui->mainFrame->style()->unpolish(ui->mainFrame); ui->mainFrame->style()->polish( ui->mainFrame); @@ -436,12 +432,13 @@ void GxsChannelPostItem::fill() QString msgText; //float f = QFontMetricsF(font()).height()/14.0 ; + ui->logoLabel->setEnableZoom(false); + int desired_height = QFontMetricsF(font()).height() * 8; + ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height); + if(mPost.mThumbnail.mData != NULL) { - QPixmap thumbnail; - - ui->logoLabel->setScaledContents(true); - + QPixmap thumbnail; GxsIdDetails::loadPixmapFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL); // Wiping data - as its been passed to thumbnail. From 15d1b1c4fc202509b6a4f7d063ff47006c47252e Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 5 Dec 2020 14:58:27 +0100 Subject: [PATCH 3/3] Fixed that the images are not deformed --- retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 4d00e0290..7c0873b9a 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -442,7 +442,7 @@ void GxsChannelPostItem::fill() GxsIdDetails::loadPixmapFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL); // Wiping data - as its been passed to thumbnail. - ui->logoLabel->setPixmap(thumbnail); + ui->logoLabel->setPicture(thumbnail); } else ui->logoLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png") );