moved the edit button from top bar to each channel post

This commit is contained in:
csoler 2017-05-11 23:44:57 +02:00
parent 5406da92fa
commit 5044ac12ca
5 changed files with 18 additions and 22 deletions

View File

@ -35,6 +35,7 @@
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "util/stringutil.h"
#include "gui/gxschannels/CreateGxsChannelMsg.h"
#include <iostream>
@ -127,6 +128,7 @@ void GxsChannelPostItem::setup()
connect(ui->commentButton, SIGNAL(clicked()), this, SLOT(loadComments()));
connect(ui->playButton, SIGNAL(clicked()), this, SLOT(play(void)));
connect(ui->editButton, SIGNAL(clicked()), this, SLOT(edit(void)));
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyMessageLink()));
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
@ -690,6 +692,12 @@ void GxsChannelPostItem::download()
updateItem();
}
void GxsChannelPostItem::edit()
{
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mGroup.mMeta.mGroupId,mPost.mMeta.mMsgId);
msgDialog->show();
}
void GxsChannelPostItem::play()
{
std::list<SubFileItem *>::iterator it;

View File

@ -78,6 +78,7 @@ private slots:
void readAndClearItem();
void download();
void play();
void edit();
void loadComments();
void readToggled(bool checked);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>840</width>
<height>180</height>
<width>1052</width>
<height>338</height>
</rect>
</property>
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
@ -332,6 +332,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editButton">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -67,14 +67,11 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
mStateHelper->addLoadPlaceholder(mTokenTypeGroupData, ui->nameLabel);
mStateHelper->addWidget(mTokenTypeGroupData, ui->postButton);
mStateHelper->addWidget(mTokenTypeGroupData, ui->editButton);
mStateHelper->addWidget(mTokenTypeGroupData, ui->logoLabel);
mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);
/* Connect signals */
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editMsg()));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
@ -214,21 +211,7 @@ void GxsChannelPostsWidget::openComments(uint32_t /*type*/, const RsGxsGroupId &
{
emit loadComment(groupId, msgId, title);
}
void GxsChannelPostsWidget::editMsg()
{
if (groupId().isNull()) {
return;
}
if (!IS_GROUP_SUBSCRIBED(subscribeFlags())) {
return;
}
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(groupId(),mCurrentMessageId);
msgDialog->show();
/* window will destroy itself! */
}
void GxsChannelPostsWidget::createMsg()
{
if (groupId().isNull()) {
@ -261,12 +244,10 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
{
mStateHelper->setWidgetEnabled(ui->postButton, true);
mStateHelper->setWidgetEnabled(ui->editButton, true);
}
else
{
mStateHelper->setWidgetEnabled(ui->postButton, false);
mStateHelper->setWidgetEnabled(ui->editButton, false);
}
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));

View File

@ -79,7 +79,6 @@ protected:
private slots:
void createMsg();
void editMsg();
void toggleAutoDownload();
void subscribeGroup(bool subscribe);
void filterChanged(int filter);