From 1f253f6bfa7f33052e6a13920cbfac4a01ef74dc Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 Sep 2020 21:46:31 +0200 Subject: [PATCH] using a simple comments tree in tab in order to avoid layout problems --- .../src/gui/Posted/BoardPostDisplayWidget.cpp | 29 +---- .../src/gui/Posted/BoardPostDisplayWidget.h | 1 - .../src/gui/Posted/BoardPostDisplayWidget.ui | 2 +- .../gui/Posted/PostedListWidgetWithModel.cpp | 9 +- .../src/gui/gxs/GxsCommentDialog.cpp | 4 +- .../src/gui/gxs/GxsCommentDialog.ui | 100 +++++++----------- .../GxsChannelPostsWidgetWithModel.ui | 18 ++-- retroshare-gui/src/retroshare-gui.pro | 2 +- 8 files changed, 60 insertions(+), 105 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp index ca84a8d25..ca8ea4850 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp @@ -55,11 +55,7 @@ BoardPostDisplayWidget::BoardPostDisplayWidget(const RsPostedPost& post, Display ui->setupUi(this); setup(); - if(mode != DISPLAY_MODE_COMMENTS) - ui->verticalLayout->addStretch(); - else - ui->commentsWidget->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding); - + ui->verticalLayout->addStretch(); ui->verticalLayout->setAlignment(Qt::AlignTop); ui->topLayout->setAlignment(Qt::AlignTop); ui->arrowsLayout->addStretch(); @@ -184,24 +180,6 @@ void BoardPostDisplayWidget::setup() ui->siteLabel->hide(); } break; - case DISPLAY_MODE_COMMENTS: - { - ui->pictureLabel_compact->show(); - ui->expandButton->hide(); - ui->pictureLabel->hide(); - ui->notes->hide(); - ui->scoreLabel->hide(); - ui->voteDownButton->hide(); - ui->voteUpButton->hide(); - ui->siteLabel->hide(); - ui->newLabel->hide(); - ui->commentButton->hide(); - ui->expandButton->hide(); - ui->shareButton->hide(); - ui->readButton->hide(); - ui->newLabel->hide(); - } - break; case DISPLAY_MODE_CARD_VIEW: { ui->frame_picture->hide(); @@ -341,7 +319,7 @@ void BoardPostDisplayWidget::setup() ui->siteLabel->setText(sitestr); - if(dmode == DISPLAY_MODE_COMPACT || dmode == DISPLAY_MODE_COMMENTS) + if(dmode == DISPLAY_MODE_COMPACT) { if(mPost.mImage.mData != NULL) { @@ -403,8 +381,7 @@ void BoardPostDisplayWidget::setup() // feed. //frame_comment->show(); - if(dmode != DISPLAY_MODE_COMMENTS) - ui->commentButton->show(); + ui->commentButton->show(); if (mPost.mComments) { diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h index d8ce2d568..e36e1a56a 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h @@ -40,7 +40,6 @@ public: DISPLAY_MODE_UNKNOWN = 0x00, DISPLAY_MODE_CARD_VIEW = 0x01, DISPLAY_MODE_COMPACT = 0x02, - DISPLAY_MODE_COMMENTS = 0x03, }; enum DisplayFlags: uint8_t { diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui index 7fde763f4..ae8bd01de 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui @@ -134,7 +134,7 @@ - + 0 0 diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp index d6f5dbe4a..805e75747 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp @@ -29,6 +29,7 @@ #include "ui_PostedListWidgetWithModel.h" #include "gui/feeds/GxsChannelPostItem.h" #include "gui/gxs/GxsIdDetails.h" +#include "gui/gxs/GxsCommentDialog.h" #include "util/misc.h" #include "gui/Posted/PostedCreatePostDialog.h" #include "gui/common/UIStateHelper.h" @@ -653,14 +654,16 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId) return; RsPostedPost post = index.data(Qt::UserRole).value() ; - BoardPostDisplayWidget *w = new BoardPostDisplayWidget(post,BoardPostDisplayWidget::DISPLAY_MODE_COMMENTS,BoardPostDisplayWidget::SHOW_COMMENTS); + auto *commentDialog = new GxsCommentDialog(this,rsPosted->getTokenService(),rsPosted); + + std::set msg_versions({post.mMeta.mMsgId}); + commentDialog->commentLoad(post.mMeta.mGroupId, msg_versions, post.mMeta.mMsgId); QString title = QString::fromUtf8(post.mMeta.mMsgName.c_str()); if(title.length() > 30) title = title.left(27) + "..."; - ui->tabWidget->addTab(w,title); - ui->tabWidget->layout(); + ui->tabWidget->addTab(commentDialog,title); } void PostedListWidgetWithModel::tabCloseRequested(int index) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index 01455e6a3..7797b39f1 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -152,10 +152,10 @@ void GxsCommentDialog::setCommentHeader(QWidget *header) //header->setParent(ui->postFrame); //ui->postFrame->setVisible(true); - QLayout *alayout = ui->postFrame->layout(); +#if 0 + QLayout *alayout = ui->postFrame->layout(); alayout->addWidget(header); -#if 0 ui->postFrame->setVisible(true); QDateTime qtime; diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui index 0328eef9f..e23a16b44 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui @@ -20,31 +20,55 @@ Form - - + + - + 0 0 - - - 1 + + true + + + + Comment - - 1 + + + + Author - - 1 + + + + Date - - 1 + + + + Score - + + + + UpVotes + + + + + DownVotes + + + + + OwnVote + + - + @@ -147,54 +171,6 @@ - - - - - 0 - 0 - - - - true - - - - Comment - - - - - Author - - - - - Date - - - - - Score - - - - - UpVotes - - - - - DownVotes - - - - - OwnVote - - - - diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui index d6b45252f..61045dd7f 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui @@ -428,7 +428,7 @@ p, li { white-space: pre-wrap; } - 1 + 2 @@ -593,16 +593,16 @@ p, li { white-space: pre-wrap; } QToolButton
gui/common/SubscribeToolButton.h
- - StyledElidedLabel - QLabel -
gui/common/StyledElidedLabel.h
-
RSTreeView QTreeView
gui/common/RSTreeView.h
+ + LineEditClear + QLineEdit +
gui/common/LineEditClear.h
+
GxsCommentDialog QWidget @@ -610,9 +610,9 @@ p, li { white-space: pre-wrap; } 1 - LineEditClear - QLineEdit -
gui/common/LineEditClear.h
+ StyledElidedLabel + QLabel +
gui/common/StyledElidedLabel.h
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index ab02f16a1..80035a460 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -1409,7 +1409,7 @@ posted { gui/Posted/PostedItem.ui \ gui/Posted/PostedCardView.ui \ gui/Posted/PostedCreatePostDialog.ui \ - gui/Posted/PhotoView.ui + gui/Posted/PhotoView.ui \ #gui/Posted/PostedDialog.ui \ #gui/Posted/PostedComments.ui \ #gui/Posted/PostedCreateCommentDialog.ui