From fed3dee1d70d152d7dd1ac10e1867040f0a32509 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 17 Jun 2020 22:47:44 +0200 Subject: [PATCH] Clear more fields when blank tree is selected * Clear more fields when blank tree is selected * Fixing spacing * Show different placeholder when message contains no post --- .../GxsChannelPostsWidgetWithModel.cpp | 16 ++- .../GxsChannelPostsWidgetWithModel.ui | 106 +++++++++--------- 2 files changed, 67 insertions(+), 55 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 2afd6ccf0..7bf0bedf1 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -373,6 +373,12 @@ void GxsChannelPostsWidgetWithModel::showPostDetails() { QModelIndex index = ui->postsTree->selectionModel()->currentIndex(); RsGxsChannelPost post = index.data(Qt::UserRole).value() ; + + QTextDocument doc; + doc.setHtml(post.mMsg.c_str()); + + if(doc.toPlainText().trimmed().isEmpty()) + ui->postDetails_TE->setPlaceholderText(tr("No message in this post")); if(post.mMeta.mPublishTs == 0) { @@ -492,7 +498,7 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad() //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); ui->channelFiles_TV->setAutoSelect(true); - + ui->postDetails_TE->setPlaceholderText(tr("No post selected")); } @@ -954,7 +960,7 @@ void GxsChannelPostsWidgetWithModel::blank() { ui->postButton->setEnabled(false); ui->subscribeToolButton->setEnabled(false); - + ui->channelName_LB->setText(tr("No Channel Selected")); ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channels.png")); ui->infoPosts->setText(""); @@ -965,6 +971,12 @@ void GxsChannelPostsWidgetWithModel::blank() ui->infoDescription->setText(""); mChannelPostsModel->clear(); + mChannelPostFilesModel->clear(); + ui->postDetails_TE->clear(); + ui->postDetails_TE->setPlaceholderText(tr("No post selected")); + ui->postLogo_LB->hide(); + ui->postName_LB->hide(); + ui->postTime_LB->hide(); groupNameChanged(QString()); } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui index bb12239f2..28687b2df 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui @@ -199,19 +199,6 @@ - - - - - 75 - true - - - - Distribution: - - - @@ -219,19 +206,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -245,11 +219,27 @@ - - + + unknown + + true + + + + + + + + 75 + true + + + + Distribution: + @@ -259,14 +249,30 @@ - - + + + + + 0 + 0 + + + + + 75 + true + + + + Last Post: + + + + + unknown - - true - @@ -292,7 +298,7 @@ - + 0 0 @@ -308,27 +314,21 @@ - - - - - 0 - 0 - - - - - 75 - true - - - - Last Post: - - - + + + + Qt::Horizontal + + + + 40 + 20 + + + +