From 1bf251f8f7b24d3721463c51c866c7aede78a474 Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 22 Nov 2020 15:41:06 +0100 Subject: [PATCH] Added a "Remove Thumbnail" button to remove a unwanted Thumbnail from the post easy & fast. --- .../src/gui/gxschannels/CreateGxsChannelMsg.cpp | 16 +++++++++++++--- .../src/gui/gxschannels/CreateGxsChannelMsg.h | 1 + .../src/gui/gxschannels/CreateGxsChannelMsg.ui | 13 +++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index ed21fd86d..07a1d0ee9 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -88,6 +88,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png")); addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png")); expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/up-arrow.png"))); + removeButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/mail/delete.png"))); aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg")); aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg")); @@ -116,6 +117,8 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId generateSpinBox->hide(); #endif + removeButton->hide(); + /* load settings */ processSettings(true); } @@ -826,8 +829,8 @@ void CreateGxsChannelMsg::addThumbnail() picture = img; // to show the selected - preview_W->setPixmap(picture, aspectRatio_CB->currentIndex()==0); - + preview_W->setPixmap(picture, aspectRatio_CB->currentIndex()==0); + removeButton->show(); } void CreateGxsChannelMsg::loadOriginalChannelPostInfo() @@ -871,7 +874,8 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo() if(post.mThumbnail.mData != NULL) { GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData,post.mThumbnail.mSize,picture,GxsIdDetails::ORIGINAL); - preview_W->setPixmap(picture,true); + preview_W->setPixmap(picture,true); + removeButton->show(); } @@ -947,3 +951,9 @@ void CreateGxsChannelMsg::toggle() } } +void CreateGxsChannelMsg::on_removeButton_clicked() +{ + preview_W->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ChannelPostThumbnailView::CHAN_DEFAULT_IMAGE),true); + removeButton->hide(); +} + diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h index c527f35ae..116081fee 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h @@ -75,6 +75,7 @@ private slots: void on_channelpostButton_clicked(); void on_attachmentsButton_clicked(); + void on_removeButton_clicked(); private: void processSettings(bool load); void loadChannelInfo(); diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui index 30b07a2e3..b29e9cdd8 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui @@ -240,6 +240,19 @@ p, li { white-space: pre-wrap; } + + + + <html><head/><body><p>Remove Thumbnail</p></body></html> + + + + 24 + 24 + + + +