From dcc4242ae68f5b1c2e37a2aa9630ea9b3669fcf7 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 1 Feb 2023 22:53:18 +0100 Subject: [PATCH] Fixed picture show --- .../src/gui/TheWire/PulseMessage.cpp | 64 ++++++++++++++++--- retroshare-gui/src/gui/TheWire/PulseMessage.h | 5 +- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/TheWire/PulseMessage.cpp b/retroshare-gui/src/gui/TheWire/PulseMessage.cpp index 8f4a91873..34724282f 100644 --- a/retroshare-gui/src/gui/TheWire/PulseMessage.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseMessage.cpp @@ -29,10 +29,10 @@ PulseMessage::PulseMessage(QWidget *parent) { setupUi(this); - connect(label_image1, SIGNAL(clicked()), this, SLOT(viewPicture())); - connect(label_image2, SIGNAL(clicked()), this, SLOT(viewPicture())); - connect(label_image3, SIGNAL(clicked()), this, SLOT(viewPicture())); - connect(label_image4, SIGNAL(clicked()), this, SLOT(viewPicture())); + connect(label_image1, SIGNAL(clicked()), this, SLOT(viewPictureOne())); + connect(label_image2, SIGNAL(clicked()), this, SLOT(viewPictureTwo())); + connect(label_image3, SIGNAL(clicked()), this, SLOT(viewPictureThree())); + connect(label_image4, SIGNAL(clicked()), this, SLOT(viewPictureFour())); } void PulseMessage::setup(RsWirePulseSPtr pulse) @@ -148,7 +148,7 @@ void PulseMessage::setRefImageCount(uint32_t count) } } -void PulseMessage::viewPicture() +void PulseMessage::viewPictureOne() { PhotoView *photoView = new PhotoView(this); @@ -158,21 +158,69 @@ void PulseMessage::viewPicture() pixmap.loadFromData(mPulse->mImage1.mData, mPulse->mImage1.mSize); photoView->setPixmap(pixmap); } - + + QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs); + + photoView->setTitle(QString::fromStdString(mPulse->mPulseText)); + photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName)); + photoView->setTime(timestamp); + //photoView->setGroupId(mPulse->mRefGroupId); + + photoView->show(); + + /* window will destroy itself! */ +} + +void PulseMessage::viewPictureTwo() +{ + PhotoView *photoView = new PhotoView(this); + if (!mPulse->mImage2.empty()) { // install image. QPixmap pixmap; pixmap.loadFromData(mPulse->mImage2.mData, mPulse->mImage2.mSize); photoView->setPixmap(pixmap); } - + + QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs); + + photoView->setTitle(QString::fromStdString(mPulse->mPulseText)); + photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName)); + photoView->setTime(timestamp); + //photoView->setGroupId(mPulse->mRefGroupId); + + photoView->show(); + + /* window will destroy itself! */ +} + +void PulseMessage::viewPictureThree() +{ + PhotoView *photoView = new PhotoView(this); + if (!mPulse->mImage3.empty()) { // install image. QPixmap pixmap; pixmap.loadFromData(mPulse->mImage3.mData, mPulse->mImage3.mSize); photoView->setPixmap(pixmap); } - + + QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs); + + photoView->setTitle(QString::fromStdString(mPulse->mPulseText)); + photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName)); + photoView->setTime(timestamp); + //photoView->setGroupId(mPulse->mRefGroupId); + + photoView->show(); + + /* window will destroy itself! */ +} + +void PulseMessage::viewPictureFour() +{ + PhotoView *photoView = new PhotoView(this); + if (!mPulse->mImage4.empty()) { // install image. QPixmap pixmap; diff --git a/retroshare-gui/src/gui/TheWire/PulseMessage.h b/retroshare-gui/src/gui/TheWire/PulseMessage.h index a2372ebbf..234f0da02 100644 --- a/retroshare-gui/src/gui/TheWire/PulseMessage.h +++ b/retroshare-gui/src/gui/TheWire/PulseMessage.h @@ -37,7 +37,10 @@ public: void setRefImageCount(uint32_t count); private slots: - void viewPicture(); + void viewPictureOne(); + void viewPictureTwo(); + void viewPictureThree(); + void viewPictureFour(); private: RsWirePulseSPtr mPulse;