mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #2515 from PhenomRetroShare/Fix_PostedItemRedraw
Fix BoardPostDisplayWidget when editor redraw.
This commit is contained in:
commit
b5a7655f29
@ -144,7 +144,7 @@ void BoardPostDisplayWidgetBase::readToggled()
|
||||
emit changeReadStatusRequested(mPost.mMeta.mMsgId,s);
|
||||
}
|
||||
|
||||
void BoardPostDisplayWidgetBase::setup()
|
||||
void BoardPostDisplayWidgetBase::baseSetup()
|
||||
{
|
||||
// show/hide things based on the view type
|
||||
|
||||
@ -166,8 +166,6 @@ void BoardPostDisplayWidgetBase::setup()
|
||||
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
|
||||
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(handleCopyLinkClicked()));
|
||||
|
||||
int S = QFontMetricsF(font()).height() ;
|
||||
|
||||
readButton()->setChecked(false);
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
@ -196,8 +194,6 @@ void BoardPostDisplayWidgetBase::setup()
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png");
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
@ -295,16 +291,7 @@ BoardPostDisplayWidget_compact::BoardPostDisplayWidget_compact(const RsPostedPos
|
||||
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_compact())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setup();
|
||||
|
||||
ui->right_VL->addStretch();
|
||||
ui->right_VL->setAlignment(Qt::AlignTop);
|
||||
ui->topLayout->setAlignment(Qt::AlignTop);
|
||||
ui->arrowsLayout->addStretch();
|
||||
ui->arrowsLayout->setAlignment(Qt::AlignTop);
|
||||
ui->feedFrame_VL->addStretch();
|
||||
|
||||
adjustSize();
|
||||
BoardPostDisplayWidget_compact::setup();
|
||||
}
|
||||
|
||||
BoardPostDisplayWidget_compact::~BoardPostDisplayWidget_compact()
|
||||
@ -314,7 +301,7 @@ BoardPostDisplayWidget_compact::~BoardPostDisplayWidget_compact()
|
||||
|
||||
void BoardPostDisplayWidget_compact::setup()
|
||||
{
|
||||
BoardPostDisplayWidgetBase::setup();
|
||||
baseSetup();
|
||||
|
||||
// show/hide things based on the view type
|
||||
|
||||
@ -356,7 +343,7 @@ void BoardPostDisplayWidget_compact::setup()
|
||||
QObject::connect(ui->expandButton, SIGNAL(toggled(bool)), this, SLOT(doExpand(bool)));
|
||||
|
||||
QTextDocument doc;
|
||||
doc.setHtml(notes()->text());
|
||||
doc.setHtml(BoardPostDisplayWidget_compact::notes()->text());
|
||||
|
||||
if(mDisplayFlags & SHOW_NOTES)
|
||||
{
|
||||
@ -427,16 +414,7 @@ BoardPostDisplayWidget_card::BoardPostDisplayWidget_card(const RsPostedPost& pos
|
||||
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_card())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setup();
|
||||
|
||||
ui->right_VL->addStretch();
|
||||
ui->right_VL->setAlignment(Qt::AlignTop);
|
||||
ui->topLayout->setAlignment(Qt::AlignTop);
|
||||
ui->arrowsLayout->addStretch();
|
||||
ui->arrowsLayout->setAlignment(Qt::AlignTop);
|
||||
ui->feedFrame_VL->addStretch();
|
||||
|
||||
adjustSize();
|
||||
BoardPostDisplayWidget_card::setup();
|
||||
}
|
||||
|
||||
BoardPostDisplayWidget_card::~BoardPostDisplayWidget_card()
|
||||
@ -446,7 +424,7 @@ BoardPostDisplayWidget_card::~BoardPostDisplayWidget_card()
|
||||
|
||||
void BoardPostDisplayWidget_card::setup()
|
||||
{
|
||||
BoardPostDisplayWidgetBase::setup();
|
||||
baseSetup();
|
||||
|
||||
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
||||
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
||||
@ -463,7 +441,6 @@ void BoardPostDisplayWidget_card::setup()
|
||||
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
|
||||
// Wiping data - as its been passed to thumbnail.
|
||||
|
||||
QPixmap scaledpixmap;
|
||||
if(pixmap.width() > 800){
|
||||
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
|
||||
ui->pictureLabel->setPixmap(scaledpixmap);
|
||||
@ -478,10 +455,10 @@ void BoardPostDisplayWidget_card::setup()
|
||||
}
|
||||
|
||||
QTextDocument doc;
|
||||
doc.setHtml(notes()->text());
|
||||
doc.setHtml(BoardPostDisplayWidget_card::notes()->text());
|
||||
|
||||
if(doc.toPlainText().trimmed().isEmpty())
|
||||
notes()->hide();
|
||||
BoardPostDisplayWidget_card::notes()->hide();
|
||||
}
|
||||
|
||||
QToolButton *BoardPostDisplayWidget_card::voteUpButton() { return ui->voteUpButton; }
|
||||
|
@ -62,10 +62,11 @@ public:
|
||||
|
||||
static const char *DEFAULT_BOARD_IMAGE;
|
||||
|
||||
protected slots:
|
||||
protected:
|
||||
/* GxsGroupFeedItem */
|
||||
|
||||
virtual void setup(); // to be overloaded by the different views
|
||||
void baseSetup();
|
||||
virtual void setup() =0; // to be overloaded by the different views
|
||||
|
||||
virtual QToolButton *voteUpButton() =0;
|
||||
virtual QToolButton *commentButton() =0;
|
||||
@ -81,6 +82,7 @@ protected slots:
|
||||
virtual QToolButton *shareButton() =0;
|
||||
virtual QFrame *feedFrame() =0;
|
||||
|
||||
protected slots:
|
||||
void loadComments(bool e);
|
||||
void readToggled();
|
||||
void setReadStatus(bool isNew, bool isUnread) ;
|
||||
|
@ -90,7 +90,10 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="voteFrame">
|
||||
<layout class="QVBoxLayout" name="arrowsLayout">
|
||||
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -173,6 +176,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="voteFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -277,7 +287,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="from_HSpacer">
|
||||
<spacer name="from_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -340,7 +350,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="pictureLabel_HSpacer">
|
||||
<spacer name="pictureLabel_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -401,16 +411,16 @@
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="buttons_HSpacer">
|
||||
<spacer name="buttons_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -424,10 +434,30 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="right_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="feedFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>542</width>
|
||||
<height>150</height>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -90,7 +90,22 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="voteFrame">
|
||||
<layout class="QVBoxLayout" name="arrowsLayout">
|
||||
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteUpButton">
|
||||
<property name="sizePolicy">
|
||||
@ -161,6 +176,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="voteFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -287,7 +309,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="from_HSpacer">
|
||||
<spacer name="from_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -305,7 +327,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttons_HM">
|
||||
<layout class="QHBoxLayout" name="buttons_HL">
|
||||
<item>
|
||||
<widget class="QToolButton" name="commentButton">
|
||||
<property name="text">
|
||||
@ -400,7 +422,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="buttons_HSpacer">
|
||||
<spacer name="buttons_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -414,6 +436,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="right_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -473,6 +502,13 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="feedFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>614</width>
|
||||
<height>182</height>
|
||||
<height>198</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -16,7 +16,7 @@
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="PostedCardView_GL">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -118,7 +118,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="from_HL">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
@ -216,7 +216,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<spacer name="from_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -241,30 +241,27 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteUpButton">
|
||||
@ -337,26 +334,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="voteFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="buttons_HL">
|
||||
<item>
|
||||
<widget class="QToolButton" name="commentButton">
|
||||
<property name="text">
|
||||
@ -389,7 +380,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<spacer name="buttons_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -461,7 +452,7 @@
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QFrame" name="picture_frame">
|
||||
<layout class="QHBoxLayout" name="horizontalPictureLayout">
|
||||
<layout class="QHBoxLayout" name="picture_frame_HL">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -485,7 +476,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="picture_frame_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -513,9 +504,9 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="Posted_images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="PostedItem_GL">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@ -82,21 +82,21 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteUpButton">
|
||||
@ -169,26 +169,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="voteFrame_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="thumbnail_VL">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
@ -233,7 +227,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="thumbnail_VS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -248,7 +242,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="title_VL">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -286,7 +280,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
||||
<layout class="QHBoxLayout" name="newComm_HL">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -312,7 +306,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="from_VL">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -320,7 +314,7 @@
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="from_HL">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
@ -416,7 +410,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<spacer name="from_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -434,7 +428,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||
<layout class="QHBoxLayout" name="buttons_HL">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -567,7 +561,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="buttons_HS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -631,9 +625,9 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="frame_picture_HL">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<spacer name="frame_picture_LHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -659,7 +653,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<spacer name="frame_picture_RHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -685,7 +679,7 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="frame_notes_GL">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
@ -726,17 +720,17 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/gxs/GxsIdLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/ElidedLabel.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GxsIdLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/gxs/GxsIdLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
|
@ -58,9 +58,7 @@
|
||||
// number of posts to show at once.
|
||||
#define POSTS_CHUNK_SIZE 25
|
||||
|
||||
/****
|
||||
* #define DEBUG_POSTED
|
||||
***/
|
||||
//#define DEBUG_POSTED
|
||||
|
||||
static const int POSTED_TABS_POSTS = 1;
|
||||
|
||||
@ -87,6 +85,10 @@ std::ostream& operator<<(std::ostream& o,const QSize& s) { return o << s.width()
|
||||
|
||||
void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
{
|
||||
#ifdef DEBUG_POSTED
|
||||
if(option.state & QStyle::State_Selected) RS_DBG("Selected");
|
||||
#endif
|
||||
|
||||
if((option.state & QStyle::State_Selected)) // Avoids double display. The selected widget is never exactly the size of the rendered one,
|
||||
return; // so when selected, we only draw the selected one.
|
||||
|
||||
@ -98,7 +100,7 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
|
||||
painter->save();
|
||||
|
||||
painter->fillRect( option.rect, option.palette.background());
|
||||
painter->fillRect( option.rect, option.palette.window());
|
||||
painter->restore();
|
||||
|
||||
QPixmap pixmap(option.rect.size());
|
||||
@ -109,9 +111,9 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
BoardPostDisplayWidget_compact w(post,displayFlags(post.mMeta.mMsgId),nullptr);
|
||||
|
||||
w.setFixedSize(option.rect.size());
|
||||
|
||||
w.updateGeometry();
|
||||
w.adjustSize();
|
||||
|
||||
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||
}
|
||||
else
|
||||
@ -121,6 +123,7 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
w.setFixedSize(option.rect.size());
|
||||
w.updateGeometry();
|
||||
w.adjustSize();
|
||||
|
||||
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||
}
|
||||
|
||||
@ -145,6 +148,10 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
|
||||
painter->save();
|
||||
painter->drawPixmap(option.rect.topLeft(), pixmap /*,.scaled(option.rect.width(),option.rect.width()*w.height()/(float)w.width(),Qt::KeepAspectRatio,Qt::SmoothTransformation)*/);
|
||||
#ifdef DEBUG_POSTED
|
||||
painter->drawText(option.rect.bottomLeft(),QString::number(time(nullptr)));
|
||||
RS_DBG("DisplayMode=", mDisplayMode == BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT? "Compact":"Card", " Title:", post.mMeta.mMsgName.c_str());
|
||||
#endif
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
@ -193,11 +200,19 @@ uint8_t PostedPostDelegate::displayFlags(const RsGxsMessageId &id) const
|
||||
|
||||
QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||
{
|
||||
|
||||
if (!index.isValid())
|
||||
return nullptr;
|
||||
|
||||
if(index.column() != RsPostedPostsModel::COLUMN_POSTS)
|
||||
return nullptr;
|
||||
|
||||
QWidget *w ;
|
||||
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
||||
|
||||
if(index.column() == RsPostedPostsModel::COLUMN_POSTS)
|
||||
{
|
||||
QWidget *w ;
|
||||
#ifdef DEBUG_POSTED
|
||||
RS_DBG("Title:", post.mMeta.mMsgName.c_str());
|
||||
#endif
|
||||
|
||||
if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT)
|
||||
w = new BoardPostDisplayWidget_compact(post,displayFlags(post.mMeta.mMsgId),parent);
|
||||
@ -206,27 +221,25 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie
|
||||
|
||||
QObject::connect(w,SIGNAL(vote(RsGxsGrpMsgIdPair,bool)),mPostListWidget,SLOT(voteMsg(RsGxsGrpMsgIdPair,bool)));
|
||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(expandItem(RsGxsMessageId,bool)));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(openComments(const RsGxsMessageId&)));
|
||||
QObject::connect(w,SIGNAL(changeReadStatusRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(changeReadStatus(const RsGxsMessageId&,bool)));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(openComments(RsGxsMessageId)));
|
||||
QObject::connect(w,SIGNAL(changeReadStatusRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(changeReadStatus(RsGxsMessageId,bool)));
|
||||
|
||||
// All other interactions with the widget should cause the msg to be set as read.
|
||||
QObject::connect(w,SIGNAL(thumbnailOpenned()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(vote(RsGxsGrpMsgIdPair,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
|
||||
|
||||
w->setFixedSize(option.rect.size());
|
||||
w->setGeometry(option.rect);
|
||||
w->adjustSize();
|
||||
w->updateGeometry();
|
||||
w->adjustSize();
|
||||
|
||||
return w;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PostedPostDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||
{
|
||||
editor->setGeometry(option.rect);
|
||||
@ -264,13 +277,11 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
||||
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
|
||||
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prevPosts()));
|
||||
|
||||
connect(ui->postsTree,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(postContextMenu(const QPoint&)));
|
||||
connect(ui->postsTree,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(postContextMenu(QPoint)));
|
||||
connect(ui->viewModeButton,SIGNAL(clicked()),this,SLOT(switchDisplayMode()));
|
||||
|
||||
connect(mPostedPostsModel,SIGNAL(boardPostsLoaded()),this,SLOT(postPostLoad()));
|
||||
|
||||
QFontMetricsF fm(font());
|
||||
|
||||
/* Setup UI helper */
|
||||
|
||||
/* Connect signals */
|
||||
@ -374,7 +385,6 @@ void PostedListWidgetWithModel::filterItems(QString text)
|
||||
|
||||
void PostedListWidgetWithModel::nextPosts()
|
||||
{
|
||||
ui->postsTree->selectionModel()->clear();
|
||||
if(mPostedPostsModel->displayedStartPostIndex() + POSTS_CHUNK_SIZE < mPostedPostsModel->filteredPostsCount())
|
||||
{
|
||||
mPostedPostsModel->setPostsInterval(POSTS_CHUNK_SIZE+mPostedPostsModel->displayedStartPostIndex(),POSTS_CHUNK_SIZE);
|
||||
@ -384,8 +394,6 @@ void PostedListWidgetWithModel::nextPosts()
|
||||
|
||||
void PostedListWidgetWithModel::prevPosts()
|
||||
{
|
||||
ui->postsTree->selectionModel()->clear();
|
||||
|
||||
if((int)mPostedPostsModel->displayedStartPostIndex() > 0)
|
||||
{
|
||||
mPostedPostsModel->setPostsInterval((int)mPostedPostsModel->displayedStartPostIndex()-POSTS_CHUNK_SIZE,POSTS_CHUNK_SIZE);
|
||||
@ -490,8 +498,8 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
|
||||
|
||||
switch(e->mPostedEventCode)
|
||||
{
|
||||
case RsPostedEventCode::NEW_COMMENT: // [[fallthrough]];
|
||||
case RsPostedEventCode::NEW_VOTE: // [[fallthrough]];
|
||||
case RsPostedEventCode::NEW_COMMENT: [[fallthrough]];
|
||||
case RsPostedEventCode::NEW_VOTE:
|
||||
{
|
||||
// special treatment here because the message might be a comment, so we need to refresh the comment tab if openned
|
||||
|
||||
@ -503,11 +511,12 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
|
||||
t->refresh();
|
||||
}
|
||||
}
|
||||
case RsPostedEventCode::NEW_MESSAGE: // [[fallthrough]];
|
||||
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
|
||||
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
|
||||
case RsPostedEventCode::UPDATED_MESSAGE:
|
||||
case RsPostedEventCode::BOARD_DELETED:
|
||||
[[clang::fallthrough]];
|
||||
case RsPostedEventCode::NEW_MESSAGE: [[fallthrough]];
|
||||
case RsPostedEventCode::NEW_POSTED_GROUP: [[fallthrough]];
|
||||
case RsPostedEventCode::UPDATED_POSTED_GROUP: [[fallthrough]];
|
||||
case RsPostedEventCode::UPDATED_MESSAGE: [[fallthrough]];
|
||||
case RsPostedEventCode::BOARD_DELETED: [[fallthrough]];
|
||||
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
|
||||
{
|
||||
if(e->mPostedGroupId == groupId())
|
||||
|
@ -18,20 +18,26 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QPainter>
|
||||
#include <QResizeEvent>
|
||||
#include "RSTreeView.h"
|
||||
|
||||
RSTreeView::RSTreeView(QWidget *parent) : QTreeView(parent)
|
||||
#include "util/rsdebug.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QResizeEvent>
|
||||
|
||||
//#define DEBUG_RSTREEVIEW
|
||||
|
||||
RSTreeView::RSTreeView(QWidget *parent)
|
||||
: QTreeView(parent), autoSelect(false)
|
||||
{
|
||||
setMouseTracking(false); // normally the default, but who knows if it's not goign to change in the future.
|
||||
setMouseTracking(false); // normally the default, but who knows if it's not going to change in the future.
|
||||
}
|
||||
|
||||
void RSTreeView::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
if(e->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
emit zoomRequested(e->delta() > 0);
|
||||
emit zoomRequested(e->angleDelta().y() > 0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -40,20 +46,45 @@ void RSTreeView::wheelEvent(QWheelEvent *e)
|
||||
|
||||
void RSTreeView::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
#ifdef DEBUG_RSTREEVIEW
|
||||
RS_DBG(e->localPos().x(), ":", e->localPos().y());
|
||||
#endif
|
||||
if (autoSelect)
|
||||
{
|
||||
QModelIndex idx = indexAt(e->pos());
|
||||
|
||||
if(idx.isValid() && idx != selectionModel()->currentIndex())
|
||||
{
|
||||
#ifdef DEBUG_RSTREEVIEW
|
||||
RS_DBG("Selection changed");
|
||||
#endif
|
||||
selectionModel()->setCurrentIndex(idx,QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
}
|
||||
|
||||
QTreeView::mouseMoveEvent(e);
|
||||
}
|
||||
|
||||
void RSTreeView::leaveEvent(QEvent *e)
|
||||
{
|
||||
#ifdef DEBUG_RSTREEVIEW
|
||||
RS_DBG("");
|
||||
#endif
|
||||
if (autoSelect)
|
||||
{
|
||||
auto fp = focusPolicy();
|
||||
setFocusPolicy(Qt::NoFocus); // To not select first index when resetting current index.
|
||||
selectionModel()->setCurrentIndex(QModelIndex(),QItemSelectionModel::Clear); // Close editor
|
||||
setFocusPolicy(fp);
|
||||
}
|
||||
|
||||
QTreeView::leaveEvent(e);
|
||||
}
|
||||
|
||||
void RSTreeView::setAutoSelect(bool b)
|
||||
{
|
||||
if(b)
|
||||
setMouseTracking(true);
|
||||
else
|
||||
setMouseTracking(false);
|
||||
autoSelect = b; // Keep this because setMouseTracking can be called outside.
|
||||
setMouseTracking(b);
|
||||
}
|
||||
|
||||
void RSTreeView::resizeEvent(QResizeEvent *e)
|
||||
|
@ -29,13 +29,19 @@ class RSTreeView : public QTreeView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RSTreeView(QWidget *parent = 0);
|
||||
RSTreeView(QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief set Placeholder Text
|
||||
* @param text
|
||||
*/
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
// Use this to make selection automatic based on mouse position. This is useful to trigger selection and therefore editing mode
|
||||
// in trees that show editing widgets using a QStyledItemDelegate
|
||||
|
||||
/**
|
||||
* @brief Use this to make selection automatic based on mouse position.
|
||||
* This is useful to trigger selection and therefore editing mode in trees that show editing widgets using a QStyledItemDelegate.
|
||||
* @param b
|
||||
*/
|
||||
void setAutoSelect(bool b);
|
||||
|
||||
signals:
|
||||
@ -44,11 +50,13 @@ signals:
|
||||
|
||||
protected:
|
||||
virtual void mouseMoveEvent(QMouseEvent *e) override; // overriding so as to manage auto-selection
|
||||
virtual void leaveEvent(QEvent *e) override; // overriding so as to manage auto-selection clear
|
||||
virtual void wheelEvent(QWheelEvent *e) override; // overriding so as to manage zoom
|
||||
virtual void resizeEvent(QResizeEvent *e) override;
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
QString placeholderText;
|
||||
bool autoSelect;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -2316,7 +2316,7 @@ QFrame#titleBarFrame {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #455364, stop: 0.5 #54687A,stop: 0.6 #44586A, stop:1 #455364);
|
||||
border: 0px;
|
||||
}
|
||||
QFrame[objectName^="#headerBFrame"] {
|
||||
QFrame[objectName^="headerBFrame"] {
|
||||
border: 1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
@ -2315,7 +2315,7 @@ QToolBar#headerToolBar {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #9BDBF9, stop:1 #1592CD);
|
||||
border: 0px;
|
||||
}
|
||||
QFrame[objectName^="#headerBFrame"] {
|
||||
QFrame[objectName^="headerBFrame"] {
|
||||
border: 1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user