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 "rshare.h"
|
||||||
#include "BoardPostDisplayWidget.h"
|
#include "BoardPostDisplayWidget.h"
|
||||||
|
#include "PhotoView.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
@ -121,6 +122,31 @@ BoardPostDisplayWidget::~BoardPostDisplayWidget()
|
|||||||
delete(ui);
|
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::toggleNotes() {}
|
||||||
|
|
||||||
void BoardPostDisplayWidget::setup()
|
void BoardPostDisplayWidget::setup()
|
||||||
@ -380,6 +406,9 @@ void BoardPostDisplayWidget::setup()
|
|||||||
mInFill = false;
|
mInFill = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ui->pictureLabel_compact->setUseStyleSheet(false); // If not this, causes dilation of the image.
|
||||||
|
connect(ui->pictureLabel_compact, SIGNAL(clicked()), this, SLOT(viewPicture()));
|
||||||
|
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|
||||||
#ifdef TODO
|
#ifdef TODO
|
||||||
|
@ -46,7 +46,11 @@ public:
|
|||||||
virtual ~BoardPostDisplayWidget();
|
virtual ~BoardPostDisplayWidget();
|
||||||
|
|
||||||
static const char *DEFAULT_BOARD_IMAGE;
|
static const char *DEFAULT_BOARD_IMAGE;
|
||||||
protected:
|
|
||||||
|
public slots:
|
||||||
|
void viewPicture() ;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
/* GxsGroupFeedItem */
|
/* GxsGroupFeedItem */
|
||||||
|
|
||||||
virtual void setup(); // to be overloaded by the different views
|
virtual void setup(); // to be overloaded by the different views
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="pictureLabel_compact">
|
<widget class="ClickableLabel" name="pictureLabel_compact">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PictureLabel_compact</string>
|
<string>PictureLabel_compact</string>
|
||||||
</property>
|
</property>
|
||||||
@ -472,6 +472,11 @@
|
|||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>gui/common/StyledLabel.h</header>
|
<header>gui/common/StyledLabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ClickableLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>util/ClickableLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
@ -32,4 +32,4 @@ ClickableLabel::~ClickableLabel() {
|
|||||||
|
|
||||||
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
|
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,17 @@ public:
|
|||||||
explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
~ClickableLabel();
|
~ClickableLabel();
|
||||||
|
|
||||||
|
void setUseStyleSheet(bool b){ mUseStyleSheet=b ; update();}
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void enterEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #039bd5; }");}
|
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; }");}
|
||||||
void leaveEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #CCCCCC; border-radius: 3px; }");}
|
|
||||||
|
|
||||||
|
bool mUseStyleSheet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLICKABLELABEL_H
|
#endif // CLICKABLELABEL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user