diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index 186580b7a..bd33883cb 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -589,12 +589,12 @@ void PostedItem::fill() else if (urlOkay && (mPost.mImage.mData == NULL)) { ui->expandButton->setDisabled(true); - ui->thumbnailLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(LINK_IMAGE)); + ui->thumbnailLabel->setPicture(FilesDefs::getPixmapFromQtResourcePath(LINK_IMAGE)); } else { ui->expandButton->setDisabled(true); - ui->thumbnailLabel->setPixmap(sqpixmap2); + ui->thumbnailLabel->setPicture(sqpixmap2); } } diff --git a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp index 54a967639..112881977 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp @@ -204,9 +204,9 @@ void GxsChannelGroupItem::fill() QPixmap chanImage; GxsIdDetails::loadPixmapFromData(mGroup.mImage.mData, mGroup.mImage.mSize, chanImage,GxsIdDetails::ORIGINAL); - ui->logoLabel->setPixmap(chanImage); + ui->logoLabel->setPicture(chanImage); } else { - ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/feeds_channel.png")); + ui->logoLabel->setPicture(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channels.png")); } if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) { diff --git a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.ui b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.ui index eccaf2018..71ccbd7b5 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.ui +++ b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.ui @@ -311,7 +311,7 @@ - + 70 @@ -411,7 +411,7 @@ - ZoomableLabel + GroupFeedLogoLabel QLabel
gui/gxschannels/GxsChannelPostThumbnail.h
@@ -420,4 +420,4 @@ - + diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp index 3c71544d4..d826fdca7 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp @@ -212,9 +212,9 @@ void GxsForumGroupItem::fill() ui->forumlogo_label->setFixedSize(ITEM_PICTURE_FORMAT_RATIO*desired_height,desired_height); if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) { - ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/feeds_forum.png")); + ui->forumlogo_label->setPicture(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forum.png")); } else { - ui->forumlogo_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/feeds_forum_default.png")); + ui->forumlogo_label->setPicture(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/forums-default.png")); } if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) { diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui index 27ff509ba..a11805973 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.ui @@ -135,7 +135,7 @@ - + 70 @@ -421,7 +421,7 @@ - ZoomableLabel + GroupFeedLogoLabel QLabel
gui/gxschannels/GxsChannelPostThumbnail.h
@@ -430,4 +430,4 @@ - + diff --git a/retroshare-gui/src/gui/feeds/PeerItem.ui b/retroshare-gui/src/gui/feeds/PeerItem.ui index 2433cdf09..596ae1d4a 100644 --- a/retroshare-gui/src/gui/feeds/PeerItem.ui +++ b/retroshare-gui/src/gui/feeds/PeerItem.ui @@ -56,6 +56,9 @@ 0 + + 0 + 0 diff --git a/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp b/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp index 7e39a03de..d0e358551 100644 --- a/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp @@ -182,9 +182,9 @@ void PostedGroupItem::fill() if (mGroup.mGroupImage.mData != NULL) { QPixmap postedImage; GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL); - ui->logoLabel->setPixmap(QPixmap(postedImage)); + ui->logoLabel->setPicture(QPixmap(postedImage)); } else { - ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/feeds_board.png")); + ui->logoLabel->setPicture(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/postedlinks.png")); } if(mGroup.mMeta.mLastPost==0) diff --git a/retroshare-gui/src/gui/feeds/PostedGroupItem.ui b/retroshare-gui/src/gui/feeds/PostedGroupItem.ui index aae3ac659..866d95186 100644 --- a/retroshare-gui/src/gui/feeds/PostedGroupItem.ui +++ b/retroshare-gui/src/gui/feeds/PostedGroupItem.ui @@ -311,7 +311,7 @@
- + 70 @@ -411,7 +411,7 @@ - ZoomableLabel + GroupFeedLogoLabel QLabel
gui/gxschannels/GxsChannelPostThumbnail.h
@@ -420,4 +420,4 @@ - + diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp index dd0163371..72c6bf798 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.cpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include "gui/common/FilesDefs.h" #include "gui/gxschannels/GxsChannelPostThumbnail.h" @@ -352,6 +354,10 @@ void ZoomableLabel::setPicture(const QPixmap& pix) reset(); updateView(); } +void ZoomableLabel::setPixmap(const QPixmap& pix) +{ + setPicture(pix); +} void ZoomableLabel::resizeEvent(QResizeEvent *e) { QLabel::resizeEvent(e); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h index da30f2083..22f0f38d7 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostThumbnail.h @@ -25,6 +25,10 @@ #include #include #include +#include +#include +#include +#include #include "retroshare/rsgxschannels.h" #include "retroshare/rsidentity.h" @@ -43,6 +47,7 @@ public: ZoomableLabel(QWidget *parent): QLabel(parent),mUseStyleSheet(true),mZoomFactor(1.0),mCenterX(0.0),mCenterY(0.0),mZoomEnabled(true),mClearEnabled(false) {} void setPicture(const QPixmap& pix); + void setPixmap(const QPixmap& pix); void setEnableZoom(bool b) { mZoomEnabled = b; } void setEnableClear(bool b) { mClearEnabled = b; } void reset(); @@ -84,6 +89,76 @@ protected: bool mClearEnabled; }; +class GroupFeedLogoLabel: public QLabel +{ + Q_OBJECT + +public: + GroupFeedLogoLabel(QWidget *parent = nullptr) : QLabel(parent), mHovered(false) {} + + void setPicture(const QPixmap& pix) { + mImage = pix; + update(); + } + + void setEnableZoom(bool) {} + +protected: +#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0) + void enterEvent(QEnterEvent *event) override { + mHovered = true; + update(); + QLabel::enterEvent(event); + } +#else + void enterEvent(QEvent *event) override { + mHovered = true; + update(); + QLabel::enterEvent(event); + } +#endif + + void leaveEvent(QEvent *event) override { + mHovered = false; + update(); + QLabel::leaveEvent(event); + } + + void paintEvent(QPaintEvent *event) override { + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.setRenderHint(QPainter::SmoothPixmapTransform); + + // Draw silver/grey gradient background + QLinearGradient gradient(0, 0, 0, height()); + gradient.setColorAt(0, QColor(220, 220, 220)); // silver + gradient.setColorAt(1, QColor(170, 170, 170)); // grey + painter.fillRect(rect(), gradient); + + if (!mImage.isNull()) { + QPixmap scaled = mImage.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + int x = (width() - scaled.width()) / 2; + int y = (height() - scaled.height()) / 2; + painter.drawPixmap(x, y, scaled); + } + + // Draw rounded border + QPen pen; + pen.setWidth(2); + if (mHovered) { + pen.setColor(QColor(3, 155, 213)); // #039bd5 + } else { + pen.setColor(QColor(204, 204, 204)); // #CCCCCC + } + painter.setPen(pen); + painter.drawRoundedRect(rect().adjusted(1, 1, -1, -1), 3, 3); + } + +private: + QPixmap mImage; + bool mHovered; +}; + // Class to paint the thumbnails with title class ChannelPostThumbnailView: public QWidget diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss index 16da89a57..0f9ad2237 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss @@ -2672,4 +2672,4 @@ StartDialog QPushButton#loadButton:hover { } /* AvatarWidget */ -AvatarWidget{border-width: 10px;} +AvatarWidget{border-width: 1px;}