added PhotoView to BoardsPostItem

This commit is contained in:
csoler 2025-11-17 22:51:46 +01:00
parent 67e07b14fd
commit c9c4b4c9d8
2 changed files with 27 additions and 0 deletions

View file

@ -24,6 +24,7 @@
#include "gui/gxs/GxsIdDetails.h"
#include "gui/common/FilesDefs.h"
#include "gui/Posted/PhotoView.h"
#include "rshare.h"
#include "BoardsPostItem.h"
#include "ui_BoardsPostItem.h"
@ -155,6 +156,7 @@ void BoardsPostItem::setup()
/* general ones */
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggle()));
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
connect(ui->logoLabel, SIGNAL(clicked()), this, SLOT(viewPicture()));
/* specific */
connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
@ -406,6 +408,30 @@ QString BoardsPostItem::messageName()
return QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
}
void BoardsPostItem::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->setGroupId(groupId());
PView->setMessageId(messageId());
PView->show();
/* window will destroy itself! */
}
void BoardsPostItem::setReadStatus(bool isNew, bool isUnread)
{
#ifdef TODO

View file

@ -78,6 +78,7 @@ private slots:
//void toggle() override;
void readAndClearItem();
void readToggled(bool checked);
void viewPicture();
signals:
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);