Added to get view the attached Pulse images

This commit is contained in:
defnax 2020-12-30 01:31:27 +01:00
parent a177d456a1
commit daa724151b
5 changed files with 88 additions and 4 deletions

View File

@ -101,3 +101,8 @@ void PhotoView::copyMessageLink()
QMessageBox::information(NULL,tr("information"),tr("The Retrohare link was copied to your clipboard.")) ;
}
}
void PhotoView::setGroupNameString(const QString& name)
{
ui->nameLabel->setText("@" + name);
}

View File

@ -48,6 +48,7 @@ public slots:
void setTime(const QString& text);
void setGroupId(const RsGxsGroupId &groupId);
void setMessageId(const RsGxsMessageId& messageId);
void setGroupNameString(const QString& name);
private slots:
void copyMessageLink();

View File

@ -19,6 +19,8 @@
*******************************************************************************/
#include "PulseMessage.h"
#include "gui/Posted/PhotoView.h"
#include "util/misc.h"
/** Constructor */
@ -26,6 +28,11 @@ PulseMessage::PulseMessage(QWidget *parent)
: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()));
}
void PulseMessage::setup(RsWirePulseSPtr pulse)
@ -34,6 +41,8 @@ void PulseMessage::setup(RsWirePulseSPtr pulse)
return;
}
mPulse = pulse;
setMessage(QString::fromStdString(pulse->mPulseText));
// show indent if republish (both RESPONSE or REF)
@ -139,3 +148,46 @@ void PulseMessage::setRefImageCount(uint32_t count)
}
}
void PulseMessage::viewPicture()
{
PhotoView *photoView = new PhotoView(this);
if (!mPulse->mImage1.empty()) {
// install image.
QPixmap pixmap;
pixmap.loadFromData(mPulse->mImage1.mData, mPulse->mImage1.mSize);
photoView->setPixmap(pixmap);
}
if (!mPulse->mImage2.empty()) {
// install image.
QPixmap pixmap;
pixmap.loadFromData(mPulse->mImage2.mData, mPulse->mImage2.mSize);
photoView->setPixmap(pixmap);
}
if (!mPulse->mImage3.empty()) {
// install image.
QPixmap pixmap;
pixmap.loadFromData(mPulse->mImage3.mData, mPulse->mImage3.mSize);
photoView->setPixmap(pixmap);
}
if (!mPulse->mImage4.empty()) {
// install image.
QPixmap pixmap;
pixmap.loadFromData(mPulse->mImage4.mData, mPulse->mImage4.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! */
}

View File

@ -35,6 +35,13 @@ public:
void setup(RsWirePulseSPtr pulse);
void setMessage(QString msg);
void setRefImageCount(uint32_t count);
private slots:
void viewPicture();
private:
RsWirePulseSPtr mPulse;
};
#endif

View File

@ -68,13 +68,16 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_image1">
<widget class="ClickableLabel" name="label_image1">
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="toolTip">
<string>Click to view picture</string>
</property>
<property name="text">
<string>Image</string>
</property>
@ -84,13 +87,16 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_image2">
<widget class="ClickableLabel" name="label_image2">
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="toolTip">
<string>Click to view picture</string>
</property>
<property name="text">
<string>Image</string>
</property>
@ -100,13 +106,16 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_image3">
<widget class="ClickableLabel" name="label_image3">
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="toolTip">
<string>Click to view picture</string>
</property>
<property name="text">
<string>Image</string>
</property>
@ -116,13 +125,16 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_image4">
<widget class="ClickableLabel" name="label_image4">
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="toolTip">
<string>Click to view picture</string>
</property>
<property name="text">
<string>Image</string>
</property>
@ -136,6 +148,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>util/ClickableLabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>