added photoview on click to compact view in boards

This commit is contained in:
csoler 2020-08-11 20:49:51 +02:00
parent ddd4ac8087
commit 4bc90ea9ad
5 changed files with 45 additions and 6 deletions

View file

@ -25,6 +25,7 @@
#include "rshare.h"
#include "BoardPostDisplayWidget.h"
#include "PhotoView.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h"
#include "gui/common/FilesDefs.h"
@ -121,6 +122,31 @@ BoardPostDisplayWidget::~BoardPostDisplayWidget()
delete(ui);
}
void BoardPostDisplayWidget::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(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
PView->setName(authorID);
PView->setTime(timestamp);
PView->setGroupId(mPost.mMeta.mGroupId);
PView->setMessageId(mPost.mMeta.mMsgId);
PView->show();
/* window will destroy itself! */
}
void BoardPostDisplayWidget::toggleNotes() {}
void BoardPostDisplayWidget::setup()
@ -380,6 +406,9 @@ void BoardPostDisplayWidget::setup()
mInFill = false;
#endif
ui->pictureLabel_compact->setUseStyleSheet(false); // If not this, causes dilation of the image.
connect(ui->pictureLabel_compact, SIGNAL(clicked()), this, SLOT(viewPicture()));
updateGeometry();
#ifdef TODO