This commit is contained in:
defnax 2026-08-31 12:02:33 -07:00 committed by GitHub
commit 6c4ecc8088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 102 additions and 18 deletions

View File

@ -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);
}
}

View File

@ -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)) {

View File

@ -311,7 +311,7 @@
</layout>
</item>
<item row="0" column="0" rowspan="3">
<widget class="ZoomableLabel" name="logoLabel">
<widget class="GroupFeedLogoLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>70</width>
@ -411,7 +411,7 @@
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<class>GroupFeedLogoLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
@ -420,4 +420,4 @@
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>
</ui>

View File

@ -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)) {

View File

@ -135,7 +135,7 @@
<item>
<layout class="QGridLayout" name="top_GL">
<item row="0" column="0" rowspan="3">
<widget class="ZoomableLabel" name="forumlogo_label">
<widget class="GroupFeedLogoLabel" name="forumlogo_label">
<property name="minimumSize">
<size>
<width>70</width>
@ -421,7 +421,7 @@
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<class>GroupFeedLogoLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
@ -430,4 +430,4 @@
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>
</ui>

View File

@ -56,6 +56,9 @@
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>

View File

@ -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)

View File

@ -311,7 +311,7 @@
</layout>
</item>
<item row="0" column="0" rowspan="3">
<widget class="ZoomableLabel" name="logoLabel">
<widget class="GroupFeedLogoLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>70</width>
@ -411,7 +411,7 @@
</widget>
<customwidgets>
<customwidget>
<class>ZoomableLabel</class>
<class>GroupFeedLogoLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
@ -420,4 +420,4 @@
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>
</ui>

View File

@ -22,6 +22,8 @@
#include <QWheelEvent>
#include <QDateTime>
#include <QPainter>
#include <QLinearGradient>
#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);

View File

@ -25,6 +25,10 @@
#include <QWidget>
#include <QLabel>
#include <QLayout>
#include <QPainter>
#include <QLinearGradient>
#include <QPen>
#include <QPaintEvent>
#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

View File

@ -2672,4 +2672,4 @@ StartDialog QPushButton#loadButton:hover {
}
/* AvatarWidget */
AvatarWidget{border-width: 10px;}
AvatarWidget{border-width: 1px;}