mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-23 22:01:05 -05:00
added photoview on click to compact view in boards
This commit is contained in:
parent
ddd4ac8087
commit
4bc90ea9ad
@ -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
|
||||
|
@ -46,7 +46,11 @@ public:
|
||||
virtual ~BoardPostDisplayWidget();
|
||||
|
||||
static const char *DEFAULT_BOARD_IMAGE;
|
||||
protected:
|
||||
|
||||
public slots:
|
||||
void viewPicture() ;
|
||||
|
||||
protected slots:
|
||||
/* GxsGroupFeedItem */
|
||||
|
||||
virtual void setup(); // to be overloaded by the different views
|
||||
|
@ -132,7 +132,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="pictureLabel_compact">
|
||||
<widget class="ClickableLabel" name="pictureLabel_compact">
|
||||
<property name="text">
|
||||
<string>PictureLabel_compact</string>
|
||||
</property>
|
||||
@ -472,6 +472,11 @@
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>util/ClickableLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
|
@ -32,16 +32,17 @@ public:
|
||||
explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~ClickableLabel();
|
||||
|
||||
void setUseStyleSheet(bool b){ mUseStyleSheet=b ; update();}
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
void enterEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #039bd5; }");}
|
||||
|
||||
void leaveEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #CCCCCC; border-radius: 3px; }");}
|
||||
void enterEvent(QEvent * /* ev */ ) override { if(mUseStyleSheet) setStyleSheet("QLabel { border: 2px solid #039bd5; }");}
|
||||
void leaveEvent(QEvent * /* ev */ ) override { if(mUseStyleSheet) setStyleSheet("QLabel { border: 2px solid #CCCCCC; border-radius: 3px; }");}
|
||||
|
||||
bool mUseStyleSheet;
|
||||
};
|
||||
|
||||
#endif // CLICKABLELABEL_H
|
||||
|
Loading…
Reference in New Issue
Block a user