added picture size variables in feed items

This commit is contained in:
csoler 2025-11-19 18:22:45 +01:00
parent a94c85751e
commit d86c5dabd3
10 changed files with 52 additions and 10 deletions

View file

@ -313,8 +313,8 @@ void BoardsPostItem::fill()
//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);
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
if(mPost.mImage.mData != NULL)
{

View file

@ -22,6 +22,11 @@
#include "FeedItem.h"
#include "FeedHolder.h"
// Height of feed items as a factor of font size height.
const int FeedItem::ITEM_HEIGHT_FACTOR = 8;
const float FeedItem::ITEM_PICTURE_FORMAT_RATIO = 16.0/9.0;
/** Constructor */
FeedItem::FeedItem(FeedHolder *fh, uint32_t feedId, QWidget *parent) : QWidget(parent),mFeedHolder(fh),mFeedId(feedId),mHash(0)
{

View file

@ -60,6 +60,9 @@ protected:
FeedHolder *mFeedHolder;
uint32_t mFeedId;
static const int ITEM_HEIGHT_FACTOR ;
static const float ITEM_PICTURE_FORMAT_RATIO ;
signals:
void sizeChanged(FeedItem *feedItem);
void feedItemNeedsClosing(qulonglong);

View file

@ -192,11 +192,16 @@ void GxsChannelGroupItem::fill()
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
ui->nameLabel->setText(link.toHtml());
ui->logoLabel->setEnableZoom(false);
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
if (mGroup.mImage.mData != NULL) {
QPixmap chanImage;
GxsIdDetails::loadPixmapFromData(mGroup.mImage.mData, mGroup.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL);
ui->logoLabel->setPixmap(chanImage);
}

View file

@ -143,7 +143,7 @@
<item row="0" column="0">
<layout class="QGridLayout" name="top_GL">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel">
<widget class="ZoomableLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>70</width>
@ -391,6 +391,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
</resources>

View file

@ -312,8 +312,8 @@ void GxsChannelPostItem::fill()
//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);
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
if(mPost.mThumbnail.mData != NULL)
{

View file

@ -205,6 +205,10 @@ void GxsForumGroupItem::fill()
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
ui->forumlogo_label->setEnableZoom(false);
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
ui->forumlogo_label->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) {
ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forums.png"));
} else {

View file

@ -135,7 +135,7 @@
<item>
<layout class="QGridLayout" name="top_GL">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="forumlogo_label">
<widget class="ZoomableLabel" name="forumlogo_label">
<property name="minimumSize">
<size>
<width>70</width>
@ -406,6 +406,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
</resources>

View file

@ -173,6 +173,10 @@ void PostedGroupItem::fill()
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
ui->logoLabel->setEnableZoom(false);
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
if (mGroup.mGroupImage.mData != NULL) {
QPixmap postedImage;
GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL);

View file

@ -135,7 +135,7 @@
<item row="0" column="0">
<layout class="QGridLayout" name="top_GL">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel">
<widget class="ZoomableLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>70</width>
@ -396,6 +396,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
</resources>