diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp index 66dc02e34..2aeb31e1f 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp @@ -25,6 +25,7 @@ #include "gui/gxschannels/GxsChannelPostThumbnail.h" const float ChannelPostThumbnailView::DEFAULT_SIZE_IN_FONT_HEIGHT = 5.0; +const float ChannelPostThumbnailView::FONT_SCALE_FACTOR = 2.0; ChannelPostThumbnailView::ChannelPostThumbnailView(const RsGxsChannelPost& post,uint32_t flags,QWidget *parent) : QWidget(parent),mPostTitle(nullptr),mFlags(flags), mAspectRatio(ASPECT_RATIO_2_3) @@ -134,7 +135,10 @@ void ChannelPostThumbnailView::init(const RsGxsChannelPost& post) QFont font = mPostTitle->font(); - font.setPointSizeF(DEFAULT_SIZE_IN_FONT_HEIGHT / 5.0 * font.pointSizeF()); + if(mFlags & ChannelPostThumbnailView::FLAG_SCALE_FONT) + font.setPointSizeF(FONT_SCALE_FACTOR * DEFAULT_SIZE_IN_FONT_HEIGHT / 5.0 * font.pointSizeF()); + else + font.setPointSizeF(FONT_SCALE_FACTOR * DEFAULT_SIZE_IN_FONT_HEIGHT / 5.0 * font.pointSizeF()); if(is_msg_new) font.setBold(true); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h index f8c0f4650..b7a68e19f 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h @@ -85,6 +85,7 @@ public: static constexpr uint32_t FLAG_NONE = 0x00; static constexpr uint32_t FLAG_SHOW_TEXT = 0x01; static constexpr uint32_t FLAG_ALLOW_PAN = 0x02; + static constexpr uint32_t FLAG_SCALE_FONT= 0x04; // Size of thumbnails as a function of the height of the font. An aspect ratio of 3/4 is good. @@ -119,6 +120,7 @@ public: AspectRatio bestAspectRatio() ; private: static const float DEFAULT_SIZE_IN_FONT_HEIGHT ; + static const float FONT_SCALE_FACTOR ; float thumbnail_w() const; float thumbnail_h() const; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 2e9808a13..804aeac7a 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -125,7 +125,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem & { // Draw a thumbnail - uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT):0; + uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0; ChannelPostThumbnailView w(post,flags); w.setAspectRatio(mAspectRatio); w.updateGeometry(); @@ -206,7 +206,7 @@ QSize ChannelPostDelegate::sizeHint(const QStyleOptionViewItem& option, const QM QFontMetricsF fm(option.font); RsGxsChannelPost post = index.data(Qt::UserRole).value() ; - uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT):0; + uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0; ChannelPostThumbnailView w(post,flags); w.setAspectRatio(mAspectRatio); @@ -798,7 +798,7 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad() for(uint32_t i=0;igetNumberOfPosts(),5u);++i) { const RsGxsChannelPost& post = mChannelPostsModel->post(i); - ChannelPostThumbnailView v(post,ChannelPostThumbnailView::FLAG_SHOW_TEXT); + ChannelPostThumbnailView v(post,ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT); ++ar_votes[ static_cast( v.bestAspectRatio() )]; }