From b8c14d6bc4a8b2cf634a33b4d4754ac5d9144dc2 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 5 Sep 2020 14:24:39 +0200 Subject: [PATCH] fixed bug in auto-determination of aspect ratio and update of geometry --- .../src/gui/gxschannels/GxsChannelPostThumbnail.cpp | 2 +- .../src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp index 4a547602d..4c1c782ee 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp @@ -165,7 +165,7 @@ ChannelPostThumbnailView::AspectRatio ChannelPostThumbnailView::bestAspectRatio( float as = mPostImage->originalImage().height() / (float)mPostImage->originalImage().width() ; - if(as < 0.8) + if(as <= 0.8) return ASPECT_RATIO_16_9; else if(as < 1.15) return ASPECT_RATIO_1_1; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index b692e133a..72e18684e 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -790,7 +790,7 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad() // now compute aspect ratio for posts. We do that by looking at the 5 latest posts and compute the best aspect ratio for them. - std::vector ar_votes(3,0); + std::vector ar_votes(4,0); for(uint32_t i=0;igetNumberOfPosts(),5u);++i) { @@ -800,12 +800,13 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad() ++ar_votes[ static_cast( v.bestAspectRatio() )]; } int best=0; - for(uint32_t i=0;i<3;++i) + for(uint32_t i=0;i<4;++i) if(ar_votes[i] > ar_votes[best]) best = i; mChannelPostsDelegate->setAspectRatio(static_cast(best)); mChannelPostsModel->triggerViewUpdate(); + handlePostsTreeSizeChange(ui->postsTree->size(),true); // force the update } void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)