Added a "Remove Thumbnail" button to remove a unwanted Thumbnail from the post easy & fast.

This commit is contained in:
defnax 2020-11-22 15:41:06 +01:00
parent b900a79448
commit 1bf251f8f7
3 changed files with 27 additions and 3 deletions

View File

@ -88,6 +88,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png")); attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png")); addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png"));
expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/up-arrow.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(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg"));
aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.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(); generateSpinBox->hide();
#endif #endif
removeButton->hide();
/* load settings */ /* load settings */
processSettings(true); processSettings(true);
} }
@ -826,8 +829,8 @@ void CreateGxsChannelMsg::addThumbnail()
picture = img; picture = img;
// to show the selected // 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() void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
@ -871,7 +874,8 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
if(post.mThumbnail.mData != NULL) if(post.mThumbnail.mData != NULL)
{ {
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData,post.mThumbnail.mSize,picture,GxsIdDetails::ORIGINAL); 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();
}

View File

@ -75,6 +75,7 @@ private slots:
void on_channelpostButton_clicked(); void on_channelpostButton_clicked();
void on_attachmentsButton_clicked(); void on_attachmentsButton_clicked();
void on_removeButton_clicked();
private: private:
void processSettings(bool load); void processSettings(bool load);
void loadChannelInfo(); void loadChannelInfo();

View File

@ -240,6 +240,19 @@ p, li { white-space: pre-wrap; }
</item> </item>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove Thumbnail&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">