diff --git a/retroshare-gui/src/gui/Posted/PhotoView.cpp b/retroshare-gui/src/gui/Posted/PhotoView.cpp new file mode 100644 index 000000000..ed6628151 --- /dev/null +++ b/retroshare-gui/src/gui/Posted/PhotoView.cpp @@ -0,0 +1,76 @@ +/******************************************************************************* + * retroshare-gui/src/gui/Posted/PhotoView.cpp * + * * + * Copyright (C) 2020 by RetroShare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include "PhotoView.h" + +#include +#include +#include + +#include "gui/gxs/GxsIdDetails.h" +#include + +/** Constructor */ +PhotoView::PhotoView(QWidget *parent) +: QDialog(parent), + ui(new Ui::PhotoView) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui->setupUi(this); + + ui->shareButton->hide(); +} + +/** Destructor */ +PhotoView::~PhotoView() +{ + delete ui; +} + +void PhotoView::setPixmap(const QPixmap& pixmap) +{ + ui->photoLabel->setPixmap(pixmap); +} + +void PhotoView::setTitle(const QString& text) +{ + ui->titleLabel->setText(text); +} + +void PhotoView::setName(const RsGxsId& authorID) +{ + ui->nameLabel->setId(authorID); + + RsIdentityDetails idDetails ; + rsIdentity->getIdDetails(authorID,idDetails); + + QPixmap pixmap ; + + if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL)) + pixmap = GxsIdDetails::makeDefaultIcon(authorID,GxsIdDetails::SMALL); + + ui->avatarWidget->setPixmap(pixmap); +} + +void PhotoView::setTime(const QString& text) +{ + ui->timeLabel->setText(text); +} + diff --git a/retroshare-gui/src/gui/Posted/PhotoView.h b/retroshare-gui/src/gui/Posted/PhotoView.h new file mode 100644 index 000000000..9de96b620 --- /dev/null +++ b/retroshare-gui/src/gui/Posted/PhotoView.h @@ -0,0 +1,62 @@ +/******************************************************************************* + * retroshare-gui/src/gui/Posted/PhotoView.h * + * * + * Copyright (C) 2020 by RetroShare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#ifndef _PHOTO_VIEW_H +#define _PHOTO_VIEW_H + +#include "ui_PhotoView.h" + +#include + +namespace Ui { + class PhotoView; +} + +class PhotoView : public QDialog +{ + Q_OBJECT + +public: + /** Default Constructor */ + PhotoView(QWidget *parent = 0); + + /** Default Destructor */ + ~PhotoView(); + + +public slots: + void setPixmap(const QPixmap& pixmap); + void setTitle (const QString &text); + void setName(const RsGxsId& authorID); + void setTime(const QString& text); + +private slots: + + +private: + + + /** Qt Designer generated object */ + Ui::PhotoView *ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/Posted/PhotoView.ui b/retroshare-gui/src/gui/Posted/PhotoView.ui new file mode 100644 index 000000000..9d159500a --- /dev/null +++ b/retroshare-gui/src/gui/Posted/PhotoView.ui @@ -0,0 +1,200 @@ + + + PhotoView + + + + 0 + 0 + 565 + 464 + + + + Photo View + + + Qt::LeftToRight + + + + + + + MS Sans Serif + 11 + 75 + true + + + + TextLabel + + + true + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + MS Sans Serif + 9 + 50 + false + + + + Posted by + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + + MS Sans Serif + 9 + + + + TextLabel + + + + + + + + MS Sans Serif + 9 + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 398 + 20 + + + + + + + + Share + + + + :/images/share.png:/images/share.png + + + Qt::ToolButtonTextBesideIcon + + + true + + + + + + + + + + GxsIdLabel + QLabel +
gui/gxs/GxsIdLabel.h
+
+ + AvatarWidget + QWidget +
gui/common/AvatarWidget.h
+ 1 +
+
+ + + + + +
diff --git a/retroshare-gui/src/gui/Posted/PostedCardView.ui b/retroshare-gui/src/gui/Posted/PostedCardView.ui index fa026e6f9..8cbbd4d56 100644 --- a/retroshare-gui/src/gui/Posted/PostedCardView.ui +++ b/retroshare-gui/src/gui/Posted/PostedCardView.ui @@ -180,7 +180,7 @@ - + 24 @@ -203,7 +203,7 @@ false - + true diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index cc422c788..b797a1dbe 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -29,7 +29,7 @@ #include "gui/gxs/GxsIdDetails.h" #include "util/misc.h" #include "util/HandleRichText.h" - +#include "PhotoView.h" #include "ui_PostedItem.h" #include @@ -110,11 +110,12 @@ void PostedItem::setup() connect(ui->notesButton, SIGNAL(clicked()), this, SLOT( toggleNotes())); connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool))); - + connect(ui->thumbnailLabel, SIGNAL(clicked()), this, SLOT(viewPicture())); + QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this); connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink())); - - + + int S = QFontMetricsF(font()).height() ; ui->voteUpButton->setIconSize(QSize(S*1.5,S*1.5)); @@ -319,6 +320,7 @@ void PostedItem::fill() QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); ui->thumbnailLabel->setPixmap(sqpixmap); ui->pictureLabel->setPixmap(pixmap); + ui->thumbnailLabel->setToolTip(tr("Click to view Picture")); } else if (urlOkay && (mPost.mImage.mData == NULL)) { @@ -578,3 +580,26 @@ void PostedItem::toggleNotes() } } + +void PostedItem::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->show(); + + /* window will destroy itself! */ +} diff --git a/retroshare-gui/src/gui/Posted/PostedItem.h b/retroshare-gui/src/gui/Posted/PostedItem.h index 7bb920a6c..76e612321 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.h +++ b/retroshare-gui/src/gui/Posted/PostedItem.h @@ -63,6 +63,7 @@ private slots: void toggle(); void copyMessageLink(); void toggleNotes(); + void viewPicture(); signals: void vote(const RsGxsGrpMsgIdPair& msgId, bool up); diff --git a/retroshare-gui/src/gui/Posted/PostedItem.ui b/retroshare-gui/src/gui/Posted/PostedItem.ui index 164ba1a89..f470fea00 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.ui +++ b/retroshare-gui/src/gui/Posted/PostedItem.ui @@ -7,7 +7,7 @@ 0 0 825 - 339 + 337 @@ -109,6 +109,9 @@ Vote up + + + @@ -148,8 +151,8 @@ Vote down - - \/ + + @@ -185,7 +188,7 @@ 6 - + 0 @@ -267,6 +270,9 @@ true + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + @@ -415,6 +421,9 @@ + + Expand + @@ -428,7 +437,7 @@ - + 24 @@ -451,7 +460,7 @@ false - + true @@ -482,6 +491,18 @@ + + + 0 + 0 + + + + + 0 + 22 + + Share @@ -489,6 +510,9 @@ :/images/share.png:/images/share.png + + false + true @@ -529,24 +553,6 @@ - - - 0 - 0 - - - - - 50 - 44 - - - - - 50 - 44 - - Qt::NoFocus @@ -561,24 +567,6 @@ - - - 0 - 0 - - - - - 50 - 44 - - - - - 50 - 44 - - Qt::NoFocus @@ -634,6 +622,9 @@ true + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + @@ -714,11 +705,16 @@ QLabel
gui/gxs/GxsIdLabel.h
+ + ClickableLabel + QLabel +
util/ClickableLabel.h
+
- - + + diff --git a/retroshare-gui/src/qss/qdarkstyle-v2.qss b/retroshare-gui/src/qss/qdarkstyle-v2.qss index 90324f9ab..a1988ad6d 100644 --- a/retroshare-gui/src/qss/qdarkstyle-v2.qss +++ b/retroshare-gui/src/qss/qdarkstyle-v2.qss @@ -934,6 +934,7 @@ QPushButton::menu-indicator { subcontrol-origin: padding; subcontrol-position: bottom right; bottom: 4px; + } QPushButton:pressed { @@ -1836,6 +1837,7 @@ QToolBox QScrollArea QWidget QWidget { QFrame { border-radius: 4px; border: 1px solid #32414B; + } QFrame[frameShape="0"] { @@ -2045,4 +2047,91 @@ GxsChannelPostsWidget QToolButton#subscribeToolButton::menu-arrow { GxsChannelPostsWidget QToolButton#subscribeToolButton::menu-button { image: none; -} \ No newline at end of file +} + +QTabBar#smTab::tab{ + height: 32px; + width: 32px; +} + +PostedCreatePostDialog QPushButton#submitButton { + font: bold; + font-size: 15px; + color: white; + background: #0099cc; + border-radius: 4px; + min-width: 2em; + +} + +PostedCreatePostDialog QPushButton#submitButton:hover { + background: #03b1f3; + border-radius: 4px; + min-width: 2em; + +} + +PostedItem QFrame#mainFrame { + border-radius: 4px; + border: 1px solid #32414B; + background-color: #19232D; + +} + +GxsChannelPostItem QFrame#mainFrame { + border-radius: 4px; + border: 1px solid #32414B; + background-color: #19232D; + +} + +PostedItem QPushButton#shareButton +{ + background-color: transparent; + min-width: 80px; + max-height: 22px; + +} + +PostedItem QLabel#scoreLabel +{ + background-color: transparent; + +} + +PostedItem QFrame#voteFrame { + background: #141415; +} + +PostedItem QToolButton#voteDownButton, QToolButton#voteUpButton +{ + border: none; + +} + +PostedCardView QPushButton#shareButton +{ + background-color: transparent; + min-width: 80px; + max-height: 22px; + +} + +PostedCardView QFrame#voteFrame { + background: #141415; +} + +PostedCardView QFrame#mainFrame { + + background-color: #19232D; + +} + +PostedCardView QFrame#mainFrame [new=false]{ + background: #19232D; +} + +PostedCardView > QFrame#mainFrame[new=true] { + background-color: #005000; +} + diff --git a/retroshare-gui/src/qss/qdarkstyle.qss b/retroshare-gui/src/qss/qdarkstyle.qss index 3e0927975..053c4d105 100644 --- a/retroshare-gui/src/qss/qdarkstyle.qss +++ b/retroshare-gui/src/qss/qdarkstyle.qss @@ -996,7 +996,7 @@ QToolButton::menu-arrow:open { QPushButton::menu-indicator { subcontrol-origin: padding; subcontrol-position: bottom right; - left: 8px; + } QTableView @@ -1209,3 +1209,80 @@ GxsChannelPostsWidget QToolButton#subscribeToolButton::menu-button { image: none; } + +QTabBar#smTab::tab{ + height: 32px; + width: 32px; +} + +PostedCreatePostDialog QPushButton#submitButton { + font: bold; + font-size: 15px; + color: white; + background: #0099cc; + border-radius: 4px; + min-width: 2em; + +} + +PostedCreatePostDialog QPushButton#submitButton:hover { + background: #03b1f3; + border-radius: 4px; + min-width: 2em; + +} + +GxsForumThreadWidget QLabel#forumName +{ + qproperty-fontSizeFactor: 140; + color: #0099cc; + font-size: 15px; + font: bold; +} + +PostedItem QPushButton#shareButton +{ + background-color: transparent; + border: none; + min-width: 75px; + max-height: 22px; +} + +PostedCardView QPushButton#shareButton +{ + background-color: transparent; + border: none; + min-width: 75px; +} + +PostedItem QFrame#voteFrame { + background: #141415; +} + +PostedCardView QFrame#voteFrame { + background: #141415; +} + +QPushButton#shareButton:hover, QPushButton#shareButton::menu-button:hover { + background-color: #4A4949; + border: 1px solid gray; +} + +PostedItem QToolButton#voteDownButton, QToolButton#voteUpButton, QToolButton#expandButton, QToolButton#readButton, +QToolButton#commentButton, QToolButton#notesButton +{ + border: none; +} + +PostedCardView QToolButton#voteDownButton, QToolButton#voteUpButton +{ + border: none; +} + +PostedCardView QFrame#mainFrame [new=false]{ + background: #302F2F; +} + +PostedCardView > QFrame#mainFrame[new=true] { + background-color: #005000; +} diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 67540cc3a..6cad0904a 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -469,6 +469,7 @@ HEADERS += rshare.h \ util/QtVersion.h \ util/RsFile.h \ util/qtthreadsutils.h \ + util/ClickableLabel.h \ gui/profile/ProfileWidget.h \ gui/profile/ProfileManager.h \ gui/profile/StatusMessage.h \ @@ -828,6 +829,7 @@ SOURCES += main.cpp \ util/ObjectPainter.cpp \ util/RsFile.cpp \ util/RichTextEdit.cpp \ + util/ClickableLabel.cpp \ gui/profile/ProfileWidget.cpp \ gui/profile/StatusMessage.cpp \ gui/profile/ProfileManager.cpp \ @@ -1348,6 +1350,7 @@ posted { gui/Posted/PostedGroupDialog.h \ gui/feeds/PostedGroupItem.h \ gui/Posted/PostedCreatePostDialog.h \ + gui/Posted/PhotoView.h \ gui/Posted/PostedUserNotify.h #gui/Posted/PostedCreateCommentDialog.h \ @@ -1358,7 +1361,7 @@ posted { gui/Posted/PostedItem.ui \ gui/Posted/PostedCardView.ui \ gui/Posted/PostedCreatePostDialog.ui \ - + gui/Posted/PhotoView.ui #gui/Posted/PostedDialog.ui \ #gui/Posted/PostedComments.ui \ #gui/Posted/PostedCreateCommentDialog.ui @@ -1370,6 +1373,7 @@ posted { gui/Posted/PostedCardView.cpp \ gui/Posted/PostedGroupDialog.cpp \ gui/Posted/PostedCreatePostDialog.cpp \ + gui/Posted/PhotoView.cpp \ gui/Posted/PostedUserNotify.cpp #gui/Posted/PostedDialog.cpp \ diff --git a/retroshare-gui/src/util/ClickableLabel.cpp b/retroshare-gui/src/util/ClickableLabel.cpp new file mode 100644 index 000000000..7b7ccb5fb --- /dev/null +++ b/retroshare-gui/src/util/ClickableLabel.cpp @@ -0,0 +1,35 @@ +/******************************************************************************* + * retroshare-gui/src/util/ClickableLabel.cpp * + * * + * Copyright (C) 2020 by RetroShare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include "ClickableLabel.h" + +/** Constructor */ +ClickableLabel::ClickableLabel(QWidget* parent, Qt::WindowFlags f) + : QLabel(parent) { + +} + +ClickableLabel::~ClickableLabel() { + +} + +void ClickableLabel::mousePressEvent(QMouseEvent* event) { + emit clicked(); +} \ No newline at end of file diff --git a/retroshare-gui/src/util/ClickableLabel.h b/retroshare-gui/src/util/ClickableLabel.h new file mode 100644 index 000000000..c9506cec0 --- /dev/null +++ b/retroshare-gui/src/util/ClickableLabel.h @@ -0,0 +1,47 @@ +/******************************************************************************* + * retroshare-gui/src/util/ClickableLabel.h * + * * + * Copyright (C) 2020 by RetroShare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#ifndef CLICKABLELABEL_H +#define CLICKABLELABEL_H + +#include +#include +#include + +class ClickableLabel : public QLabel { + Q_OBJECT + +public: + explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); + ~ClickableLabel(); + +signals: + void clicked(); + +protected: + void mousePressEvent(QMouseEvent* event); + + void enterEvent(QEvent *ev) override { setStyleSheet("QLabel { border: 1px solid #3A3939; }");} + + void leaveEvent(QEvent *ev) override { setStyleSheet("QLabel { border: none; }");} + +}; + +#endif // CLICKABLELABEL_H \ No newline at end of file