mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-15 00:28:58 -05:00
added picture size variables in feed items
This commit is contained in:
parent
a94c85751e
commit
d86c5dabd3
10 changed files with 52 additions and 10 deletions
|
|
@ -313,8 +313,8 @@ void BoardsPostItem::fill()
|
||||||
//float f = QFontMetricsF(font()).height()/14.0 ;
|
//float f = QFontMetricsF(font()).height()/14.0 ;
|
||||||
|
|
||||||
ui->logoLabel->setEnableZoom(false);
|
ui->logoLabel->setEnableZoom(false);
|
||||||
int desired_height = QFontMetricsF(font()).height() * 8;
|
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
|
||||||
ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height);
|
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
|
||||||
|
|
||||||
if(mPost.mImage.mData != NULL)
|
if(mPost.mImage.mData != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@
|
||||||
#include "FeedItem.h"
|
#include "FeedItem.h"
|
||||||
#include "FeedHolder.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 */
|
/** Constructor */
|
||||||
FeedItem::FeedItem(FeedHolder *fh, uint32_t feedId, QWidget *parent) : QWidget(parent),mFeedHolder(fh),mFeedId(feedId),mHash(0)
|
FeedItem::FeedItem(FeedHolder *fh, uint32_t feedId, QWidget *parent) : QWidget(parent),mFeedHolder(fh),mFeedId(feedId),mHash(0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@ protected:
|
||||||
|
|
||||||
FeedHolder *mFeedHolder;
|
FeedHolder *mFeedHolder;
|
||||||
uint32_t mFeedId;
|
uint32_t mFeedId;
|
||||||
|
static const int ITEM_HEIGHT_FACTOR ;
|
||||||
|
static const float ITEM_PICTURE_FORMAT_RATIO ;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sizeChanged(FeedItem *feedItem);
|
void sizeChanged(FeedItem *feedItem);
|
||||||
void feedItemNeedsClosing(qulonglong);
|
void feedItemNeedsClosing(qulonglong);
|
||||||
|
|
|
||||||
|
|
@ -192,11 +192,16 @@ void GxsChannelGroupItem::fill()
|
||||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
|
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
|
||||||
ui->nameLabel->setText(link.toHtml());
|
ui->nameLabel->setText(link.toHtml());
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||||
|
|
||||||
if (mGroup.mImage.mData != NULL) {
|
if (mGroup.mImage.mData != NULL) {
|
||||||
QPixmap chanImage;
|
QPixmap chanImage;
|
||||||
GxsIdDetails::loadPixmapFromData(mGroup.mImage.mData, mGroup.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(mGroup.mImage.mData, mGroup.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL);
|
||||||
|
|
||||||
ui->logoLabel->setPixmap(chanImage);
|
ui->logoLabel->setPixmap(chanImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="top_GL">
|
<layout class="QGridLayout" name="top_GL">
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QLabel" name="logoLabel">
|
<widget class="ZoomableLabel" name="logoLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>70</width>
|
<width>70</width>
|
||||||
|
|
@ -391,6 +391,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ZoomableLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -312,8 +312,8 @@ void GxsChannelPostItem::fill()
|
||||||
//float f = QFontMetricsF(font()).height()/14.0 ;
|
//float f = QFontMetricsF(font()).height()/14.0 ;
|
||||||
|
|
||||||
ui->logoLabel->setEnableZoom(false);
|
ui->logoLabel->setEnableZoom(false);
|
||||||
int desired_height = QFontMetricsF(font()).height() * 8;
|
int desired_height = QFontMetricsF(font()).height() * ITEM_HEIGHT_FACTOR;
|
||||||
ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height);
|
ui->logoLabel->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height);
|
||||||
|
|
||||||
if(mPost.mThumbnail.mData != NULL)
|
if(mPost.mThumbnail.mData != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,11 @@ void GxsForumGroupItem::fill()
|
||||||
|
|
||||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||||
|
|
||||||
if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) {
|
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"));
|
ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forums.png"));
|
||||||
} else {
|
} else {
|
||||||
ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forums-default.png"));
|
ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forums-default.png"));
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="top_GL">
|
<layout class="QGridLayout" name="top_GL">
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QLabel" name="forumlogo_label">
|
<widget class="ZoomableLabel" name="forumlogo_label">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>70</width>
|
<width>70</width>
|
||||||
|
|
@ -406,6 +406,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ZoomableLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,11 @@ void PostedGroupItem::fill()
|
||||||
|
|
||||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||||
|
|
||||||
if (mGroup.mGroupImage.mData != NULL) {
|
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;
|
QPixmap postedImage;
|
||||||
GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL);
|
||||||
ui->logoLabel->setPixmap(QPixmap(postedImage));
|
ui->logoLabel->setPixmap(QPixmap(postedImage));
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="top_GL">
|
<layout class="QGridLayout" name="top_GL">
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QLabel" name="logoLabel">
|
<widget class="ZoomableLabel" name="logoLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>70</width>
|
<width>70</width>
|
||||||
|
|
@ -396,6 +396,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ZoomableLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue