tried to improve layout of items

This commit is contained in:
csoler 2020-09-22 22:43:24 +02:00
parent 1f253f6bfa
commit 010fc1dc44
2 changed files with 450 additions and 390 deletions

View File

@ -61,16 +61,20 @@ BoardPostDisplayWidget::BoardPostDisplayWidget(const RsPostedPost& post, Display
ui->arrowsLayout->addStretch();
ui->arrowsLayout->setAlignment(Qt::AlignTop);
ui->verticalLayout_2->addStretch();
// ui->verticalLayout_3->addStretch();
// ui->verticalLayout_3->setAlignment(Qt::AlignTop);
if(display_flags & SHOW_COMMENTS)
{
ui->commentsWidget->setTokenService(rsPosted->getTokenService(),rsPosted);
adjustSize();
std::set<RsGxsMessageId> post_versions ;
post_versions.insert(post.mMeta.mMsgId) ;
ui->commentsWidget->commentLoad(post.mMeta.mGroupId, post_versions,mPost.mMeta.mMsgId,true);
}
// if(display_flags & SHOW_COMMENTS)
// {
// ui->commentsWidget->setTokenService(rsPosted->getTokenService(),rsPosted);
//
// std::set<RsGxsMessageId> post_versions ;
// post_versions.insert(post.mMeta.mMsgId) ;
//
// ui->commentsWidget->commentLoad(post.mMeta.mGroupId, post_versions,mPost.mMeta.mMsgId,true);
// }
}
void BoardPostDisplayWidget::setCommentsSize(int comNb)
@ -172,8 +176,8 @@ void BoardPostDisplayWidget::setup()
case DISPLAY_MODE_COMPACT:
{
ui->pictureLabel_compact->show();
ui->expandButton->hide();
//ui->expandButton->show(); // always hide, since we have the photoview already
//ui->expandButton->hide();
ui->expandButton->show(); // always hide, since we have the photoview already
ui->pictureLabel->hide();
ui->notes->hide();
@ -207,7 +211,7 @@ void BoardPostDisplayWidget::setup()
if(!(mDisplayFlags & SHOW_COMMENTS))
{
ui->commentsWidget->hide();
//ui->commentsWidget->hide();
ui->commentButton->setChecked(false);
}
else
@ -269,7 +273,7 @@ void BoardPostDisplayWidget::setup()
QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago");
ui->dateLabel->setText(timestamp2);
ui->dateLabel->setToolTip(timestamp);
@ -377,7 +381,10 @@ void BoardPostDisplayWidget::setup()
doc.setHtml(ui->notes->text());
if(doc.toPlainText().trimmed().isEmpty())
{
ui->notes->hide();
ui->expandButton->hide();
}
// feed.
//frame_comment->show();
@ -385,9 +392,7 @@ void BoardPostDisplayWidget::setup()
if (mPost.mComments)
{
QString commentText = QString::number(mPost.mComments);
commentText += " ";
commentText += tr("Comments");
QString commentText = tr("Comments (%1)").arg(QString::number(mPost.mComments));
ui->commentButton->setText(commentText);
}
else
@ -435,6 +440,16 @@ void BoardPostDisplayWidget::setup()
void BoardPostDisplayWidget::doExpand(bool e)
{
std::cerr << "Expanding" << std::endl;
if(e)
{
//ui->notes->show();
ui->pictureLabel_2->show();
}
else
{
//ui->notes->hide();
ui->pictureLabel_2->hide();
}
emit expand(mPost.mMeta.mMsgId,e);
}

View File

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>211</height>
<width>558</width>
<height>202</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -22,26 +22,29 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -52,11 +55,39 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="topLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QVBoxLayout" name="arrowsLayout">
<item>
@ -148,10 +179,40 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="StyledLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
@ -214,6 +275,26 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>70</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="readButton">
<property name="maximumSize">
@ -250,42 +331,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>70</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="commentButton">
<property name="text">
<string>Comments</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/comments.png</normaloff>:/images/comments.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="shareButton">
<property name="text">
@ -320,41 +365,41 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="StyledLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<widget class="QToolButton" name="commentButton">
<property name="text">
<string notr="true">This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope</string>
<string>Comments</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/comments.png</normaloff>:/images/comments.png</iconset>
</property>
<property name="wordWrap">
<property name="checkable">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="notes">
<property name="text">
@ -424,6 +469,24 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="pictureLabel_2">
<property name="sizePolicy">
@ -449,18 +512,6 @@
</layout>
</widget>
</item>
<item>
<widget class="GxsCommentDialog" name="commentsWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@ -482,12 +533,6 @@
<extends>QLabel</extends>
<header>util/ClickableLabel.h</header>
</customwidget>
<customwidget>
<class>GxsCommentDialog</class>
<extends>QWidget</extends>
<header>gui/gxs/GxsCommentDialog.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="Posted_images.qrc"/>