mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed bug in auto-determination of aspect ratio and update of geometry
This commit is contained in:
parent
062f0eb195
commit
b8c14d6bc4
@ -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;
|
||||
|
@ -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<uint32_t> ar_votes(3,0);
|
||||
std::vector<uint32_t> ar_votes(4,0);
|
||||
|
||||
for(uint32_t i=0;i<std::min(mChannelPostsModel->getNumberOfPosts(),5u);++i)
|
||||
{
|
||||
@ -800,12 +800,13 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
|
||||
++ar_votes[ static_cast<uint32_t>( 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<ChannelPostThumbnailView::AspectRatio>(best));
|
||||
mChannelPostsModel->triggerViewUpdate();
|
||||
handlePostsTreeSizeChange(ui->postsTree->size(),true); // force the update
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)
|
||||
|
Loading…
Reference in New Issue
Block a user