using a simple comments tree in tab in order to avoid layout problems

This commit is contained in:
csoler 2020-09-20 21:46:31 +02:00
parent 841152fb90
commit 1f253f6bfa
8 changed files with 60 additions and 105 deletions

View File

@ -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->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,7 +381,6 @@ void BoardPostDisplayWidget::setup()
// feed.
//frame_comment->show();
if(dmode != DISPLAY_MODE_COMMENTS)
ui->commentButton->show();
if (mPost.mComments)

View File

@ -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 {

View File

@ -134,7 +134,7 @@
<item>
<widget class="ClickableLabel" name="pictureLabel_compact">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

View File

@ -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<RsPostedPost>() ;
BoardPostDisplayWidget *w = new BoardPostDisplayWidget(post,BoardPostDisplayWidget::DISPLAY_MODE_COMMENTS,BoardPostDisplayWidget::SHOW_COMMENTS);
auto *commentDialog = new GxsCommentDialog(this,rsPosted->getTokenService(),rsPosted);
std::set<RsGxsMessageId> 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)

View File

@ -152,10 +152,10 @@ void GxsCommentDialog::setCommentHeader(QWidget *header)
//header->setParent(ui->postFrame);
//ui->postFrame->setVisible(true);
#if 0
QLayout *alayout = ui->postFrame->layout();
alayout->addWidget(header);
#if 0
ui->postFrame->setVisible(true);
QDateTime qtime;

View File

@ -20,31 +20,55 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="GxsCommentDialogGLayout">
<item row="0" column="0">
<widget class="QFrame" name="postFrame">
<item row="1" column="0">
<widget class="GxsCommentTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="postFrameVLayout">
<property name="leftMargin">
<number>1</number>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="topMargin">
<number>1</number>
<column>
<property name="text">
<string>Comment</string>
</property>
<property name="rightMargin">
<number>1</number>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
<property name="bottomMargin">
<number>1</number>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</layout>
</column>
<column>
<property name="text">
<string>Score</string>
</property>
</column>
<column>
<property name="text">
<string>UpVotes</string>
</property>
</column>
<column>
<property name="text">
<string>DownVotes</string>
</property>
</column>
<column>
<property name="text">
<string>OwnVote</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="0">
<layout class="QHBoxLayout" name="toolBarHLayout">
<item>
<widget class="QToolButton" name="commentButton">
@ -147,54 +171,6 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="GxsCommentTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Score</string>
</property>
</column>
<column>
<property name="text">
<string>UpVotes</string>
</property>
</column>
<column>
<property name="text">
<string>DownVotes</string>
</property>
</column>
<column>
<property name="text">
<string>OwnVote</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -428,7 +428,7 @@ p, li { white-space: pre-wrap; }
</font>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -593,16 +593,16 @@ p, li { white-space: pre-wrap; }
<extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header>
</customwidget>
<customwidget>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header>
</customwidget>
<customwidget>
<class>RSTreeView</class>
<extends>QTreeView</extends>
<header>gui/common/RSTreeView.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>GxsCommentDialog</class>
<extends>QWidget</extends>
@ -610,9 +610,9 @@ p, li { white-space: pre-wrap; }
<container>1</container>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header>
</customwidget>
</customwidgets>
<resources>

View File

@ -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