Added Picture View Dialog for open the picture in a external View

* Added Picture View Dialog for open the picture in a external View
* Added a clickable Label for Classic Views Thumbnail label to open Picture via one click
* Imroved the Classic & Card views dark stylesheets for better look and feel
This commit is contained in:
defnax 2020-01-10 19:27:58 +01:00
parent 42491f80e6
commit d0fcd90ccc
12 changed files with 665 additions and 53 deletions

View file

@ -29,7 +29,7 @@
#include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "PhotoView.h"
#include "ui_PostedItem.h"
#include <retroshare/rsposted.h>
@ -110,11 +110,12 @@ void PostedItem::setup()
connect(ui->notesButton, SIGNAL(clicked()), this, SLOT( toggleNotes()));
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
connect(ui->thumbnailLabel, SIGNAL(clicked()), this, SLOT(viewPicture()));
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink()));
int S = QFontMetricsF(font()).height() ;
ui->voteUpButton->setIconSize(QSize(S*1.5,S*1.5));
@ -319,6 +320,7 @@ void PostedItem::fill()
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPixmap(sqpixmap);
ui->pictureLabel->setPixmap(pixmap);
ui->thumbnailLabel->setToolTip(tr("Click to view Picture"));
}
else if (urlOkay && (mPost.mImage.mData == NULL))
{
@ -578,3 +580,26 @@ void PostedItem::toggleNotes()
}
}
void PostedItem::viewPicture()
{
if(mPost.mImage.mData == NULL) {
return;
}
QString timestamp = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
QPixmap pixmap;
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
RsGxsId authorID = mPost.mMeta.mAuthorId;
PhotoView *PView = new PhotoView(this);
PView->setPixmap(pixmap);
PView->setTitle(messageName());
PView->setName(authorID);
PView->setTime(timestamp);
PView->show();
/* window will destroy itself! */
}