attempt to improve

This commit is contained in:
defnax 2020-01-21 01:50:33 +01:00
parent 21cf49a009
commit f8f77f122e
3 changed files with 22 additions and 18 deletions

View File

@ -51,12 +51,17 @@ PhotoView::~PhotoView()
void PhotoView::setPixmap(const QPixmap& pixmap) void PhotoView::setPixmap(const QPixmap& pixmap)
{ {
QPixmap sqpixmap = pixmap.scaled(640,480, Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap sqpixmap;
if(pixmap.width() > 800 ){
if(pixmap.width() > 800 || pixmap.height() > 700) QPixmap sqpixmap = pixmap.scaled(640,480, Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->photoLabel->setPixmap(sqpixmap); ui->photoLabel->setPixmap(sqpixmap);
else }else if (pixmap.height() > 600){
QPixmap sqpixmap = pixmap.scaled(480,640, Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->photoLabel->setPixmap(sqpixmap);
}
else{
ui->photoLabel->setPixmap(pixmap); ui->photoLabel->setPixmap(pixmap);
}
} }
void PhotoView::setTitle(const QString& text) void PhotoView::setTitle(const QString& text)
@ -102,5 +107,6 @@ void PhotoView::copyMessageLink()
QList<RetroShareLink> urls; QList<RetroShareLink> urls;
urls.push_back(link); urls.push_back(link);
RSLinkClipboard::copyLinks(urls); RSLinkClipboard::copyLinks(urls);
QMessageBox::information(NULL,tr("information"),tr("The Retrohare link was copied to your clipboard.")) ;
} }
} }

View File

@ -308,15 +308,13 @@ void PostedCardView::fill()
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL); GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail. // Wiping data - as its been passed to thumbnail.
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); QPixmap scaledpixmap;
if(pixmap.width() > 800){
QPixmap squaledpixmap = pixmap.scaled(640,480, Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(scaledpixmap);
if(pixmap.width() > 800) }else{
ui->pictureLabel->setPixmap(squaledpixmap);
else
ui->pictureLabel->setPixmap(pixmap); ui->pictureLabel->setPixmap(pixmap);
}
} }
else if (mPost.mImage.mData == NULL) else if (mPost.mImage.mData == NULL)
{ {

View File

@ -321,13 +321,13 @@ void PostedItem::fill()
ui->thumbnailLabel->setPixmap(sqpixmap); ui->thumbnailLabel->setPixmap(sqpixmap);
ui->thumbnailLabel->setToolTip(tr("Click to view Picture")); ui->thumbnailLabel->setToolTip(tr("Click to view Picture"));
QPixmap squaledpixmap = pixmap.scaled(640,480, Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap scaledpixmap;
if(pixmap.width() > 800){
if(pixmap.width() > 800) QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(squaledpixmap); ui->pictureLabel->setPixmap(scaledpixmap);
else }else{
ui->pictureLabel->setPixmap(pixmap); ui->pictureLabel->setPixmap(pixmap);
}
} }
else if (urlOkay && (mPost.mImage.mData == NULL)) else if (urlOkay && (mPost.mImage.mData == NULL))
{ {