remove channel/posted/forum info when no group is selected

This commit is contained in:
csoler 2018-06-25 23:08:10 +02:00
parent 08b436e5f4
commit a5d1a154a4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
9 changed files with 63 additions and 13 deletions

View File

@ -454,6 +454,10 @@ void PostedListWidget::applyRanking()
ui->scrollAreaWidgetContents->update();
}
void PostedListWidget::blank()
{
clearPosts();
}
void PostedListWidget::clearPosts()
{
/* clear all messages */

View File

@ -63,6 +63,7 @@ protected:
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
virtual void insertPosts(const uint32_t &token);
virtual void clearPosts();
virtual void blank();
virtual bool navigatePostItem(const RsGxsMessageId& msgId);
/* GxsMessageFrameWidget */

View File

@ -57,6 +57,7 @@ protected:
virtual void groupNameChanged(const QString &/*name*/) {}
virtual void clearPosts() = 0;
virtual void blank() = 0;
virtual bool navigatePostItem(const RsGxsMessageId& msgId) = 0;
/* Thread functions */

View File

@ -72,21 +72,26 @@ bool GxsMessageFrameWidget::isWaiting()
void GxsMessageFrameWidget::setGroupId(const RsGxsGroupId &groupId)
{
if (mGroupId == groupId) {
if (!groupId.isNull()) {
return;
if (mGroupId == groupId && !groupId.isNull())
return;
if(!groupId.isNull())
{
mAcknowledgeReadStatusToken = 0;
if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) {
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false);
emit waitingChanged(this);
}
mGroupId = groupId;
groupIdChanged();
}
mAcknowledgeReadStatusToken = 0;
if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) {
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false);
emit waitingChanged(this);
}
mGroupId = groupId;
groupIdChanged();
else
{
mGroupId.clear();
blank(); // clear the displayed data, because no group is selected.
}
}
void GxsMessageFrameWidget::setAllMessagesRead(bool read)

View File

@ -43,6 +43,7 @@ public:
virtual void groupIdChanged() = 0;
virtual QString groupName(bool withUnreadCount) = 0;
virtual QIcon groupIcon() = 0;
virtual void blank() =0;
virtual bool navigate(const RsGxsMessageId& msgId) = 0;
virtual bool isLoading();
virtual bool isWaiting();

View File

@ -596,6 +596,20 @@ void GxsChannelPostsWidget::clearPosts()
ui->fileWidget->clear();
}
void GxsChannelPostsWidget::blank()
{
mStateHelper->setWidgetEnabled(ui->postButton, false);
mStateHelper->setWidgetEnabled(ui->subscribeToolButton, false);
clearPosts();
groupNameChanged(QString());
ui->infoWidget->hide();
ui->feedWidget->show();
ui->fileWidget->hide();
}
bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId)
{
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId);

View File

@ -73,6 +73,7 @@ protected:
virtual bool useThread() { return mUseThread; }
virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);
virtual bool navigatePostItem(const RsGxsMessageId& msgId);
virtual void blank() ;
/* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token);

View File

@ -299,6 +299,28 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
}
void GxsForumThreadWidget::blank()
{
ui->progressBar->hide();
ui->progressText->hide();
ui->postText->clear() ;
ui->by_label->setId(RsGxsId()) ;
ui->time_label->clear();
ui->lineRight->hide();
ui->lineLeft->hide();
ui->by_text_label->hide();
ui->by_label->hide();
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
ui->threadTreeWidget->clear();
ui->forumName->setText("");
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
mStateHelper->setWidgetEnabled(ui->previousButton, false);
mStateHelper->setWidgetEnabled(ui->nextButton, false);
ui->versions_CB->hide();
}
GxsForumThreadWidget::~GxsForumThreadWidget()
{
if (mFillThread) {

View File

@ -58,6 +58,7 @@ public:
// Callback for all Loads.
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
virtual void blank();
protected:
bool eventFilter(QObject *obj, QEvent *ev);