From fcee6d3f635b9cdfaadcd40c56ac55614a83c809 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 28 Mar 2019 22:41:23 +0100 Subject: [PATCH] fixed size of thumbnail on all screens --- retroshare-gui/src/gui/Posted/PostedItem.cpp | 19 ++++++++++++------ retroshare-gui/src/gui/Posted/PostedItem.ui | 20 ++++--------------- .../src/gui/gxs/GxsCommentTreeWidget.cpp | 2 +- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index d107b660d..2ab455a21 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -247,19 +247,26 @@ void PostedItem::fill() } mInFill = true; - + int desired_height = ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height(); if(mPost.mImage.mData != NULL) { QPixmap pixmap; pixmap.loadFromData(mPost.mImage.mData, mPost.mImage.mSize, "PNG"); // Wiping data - as its been passed to thumbnail. - QPixmap sqpixmap = pixmap.scaled(800, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation); - ui->pictureLabel->setPixmap(sqpixmap); - - ui->thumbnailLabel->setPixmap(pixmap); - }else + QPixmap sqpixmap = pixmap.scaled(10*desired_height,1.5*desired_height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + ui->thumbnailLabel->setMaximumSize(sqpixmap.size()); + ui->thumbnailLabel->setPixmap(sqpixmap); + ui->pictureLabel->setPixmap(pixmap); +std::cerr << "new size=" << desired_height << " " << sqpixmap.width() << " " << sqpixmap.height() << std::endl; + } + else { + QPixmap sqpixmap = QPixmap(":/images/thumb-default.png").scaled(10*desired_height,1.5*desired_height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + + ui->thumbnailLabel->setMaximumSize(sqpixmap.size()); + ui->thumbnailLabel->setPixmap(sqpixmap); + ui->expandButton->setDisabled(true); } diff --git a/retroshare-gui/src/gui/Posted/PostedItem.ui b/retroshare-gui/src/gui/Posted/PostedItem.ui index d991b99ef..e6faa0117 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.ui +++ b/retroshare-gui/src/gui/Posted/PostedItem.ui @@ -6,8 +6,8 @@ 0 0 - 617 - 190 + 825 + 337 @@ -187,23 +187,11 @@ - + 0 0 - - - 100 - 75 - - - - - 100 - 75 - - @@ -683,8 +671,8 @@ - + diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index a66b93b34..296ce68c8 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -542,7 +542,7 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token) text = qtime.toString("yyyy-MM-dd hh:mm:ss") ; item->setText(PCITEM_COLUMN_DATE, text) ; item->setToolTip(PCITEM_COLUMN_DATE, text) ; - item->setData(PCITEM_COLUMN_DATE, ROLE_SORT, comment.mMeta.mPublishTs); + item->setData(PCITEM_COLUMN_DATE, ROLE_SORT, QVariant(qlonglong(comment.mMeta.mPublishTs))); }