mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-26 07:55:44 -04:00
Merge pull request #2515 from PhenomRetroShare/Fix_PostedItemRedraw
Fix BoardPostDisplayWidget when editor redraw.
This commit is contained in:
commit
b5a7655f29
11 changed files with 281 additions and 203 deletions
|
@ -144,7 +144,7 @@ void BoardPostDisplayWidgetBase::readToggled()
|
||||||
emit changeReadStatusRequested(mPost.mMeta.mMsgId,s);
|
emit changeReadStatusRequested(mPost.mMeta.mMsgId,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoardPostDisplayWidgetBase::setup()
|
void BoardPostDisplayWidgetBase::baseSetup()
|
||||||
{
|
{
|
||||||
// show/hide things based on the view type
|
// 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);
|
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
|
||||||
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(handleCopyLinkClicked()));
|
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(handleCopyLinkClicked()));
|
||||||
|
|
||||||
int S = QFontMetricsF(font()).height() ;
|
|
||||||
|
|
||||||
readButton()->setChecked(false);
|
readButton()->setChecked(false);
|
||||||
|
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
|
@ -196,8 +194,6 @@ void BoardPostDisplayWidgetBase::setup()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png");
|
|
||||||
|
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
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())
|
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_compact())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setup();
|
BoardPostDisplayWidget_compact::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::~BoardPostDisplayWidget_compact()
|
BoardPostDisplayWidget_compact::~BoardPostDisplayWidget_compact()
|
||||||
|
@ -314,7 +301,7 @@ BoardPostDisplayWidget_compact::~BoardPostDisplayWidget_compact()
|
||||||
|
|
||||||
void BoardPostDisplayWidget_compact::setup()
|
void BoardPostDisplayWidget_compact::setup()
|
||||||
{
|
{
|
||||||
BoardPostDisplayWidgetBase::setup();
|
baseSetup();
|
||||||
|
|
||||||
// show/hide things based on the view type
|
// 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)));
|
QObject::connect(ui->expandButton, SIGNAL(toggled(bool)), this, SLOT(doExpand(bool)));
|
||||||
|
|
||||||
QTextDocument doc;
|
QTextDocument doc;
|
||||||
doc.setHtml(notes()->text());
|
doc.setHtml(BoardPostDisplayWidget_compact::notes()->text());
|
||||||
|
|
||||||
if(mDisplayFlags & SHOW_NOTES)
|
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())
|
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_card())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setup();
|
BoardPostDisplayWidget_card::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::~BoardPostDisplayWidget_card()
|
BoardPostDisplayWidget_card::~BoardPostDisplayWidget_card()
|
||||||
|
@ -446,7 +424,7 @@ BoardPostDisplayWidget_card::~BoardPostDisplayWidget_card()
|
||||||
|
|
||||||
void BoardPostDisplayWidget_card::setup()
|
void BoardPostDisplayWidget_card::setup()
|
||||||
{
|
{
|
||||||
BoardPostDisplayWidgetBase::setup();
|
baseSetup();
|
||||||
|
|
||||||
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
||||||
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
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);
|
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
|
||||||
// Wiping data - as its been passed to thumbnail.
|
// Wiping data - as its been passed to thumbnail.
|
||||||
|
|
||||||
QPixmap scaledpixmap;
|
|
||||||
if(pixmap.width() > 800){
|
if(pixmap.width() > 800){
|
||||||
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
|
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
|
||||||
ui->pictureLabel->setPixmap(scaledpixmap);
|
ui->pictureLabel->setPixmap(scaledpixmap);
|
||||||
|
@ -478,10 +455,10 @@ void BoardPostDisplayWidget_card::setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextDocument doc;
|
QTextDocument doc;
|
||||||
doc.setHtml(notes()->text());
|
doc.setHtml(BoardPostDisplayWidget_card::notes()->text());
|
||||||
|
|
||||||
if(doc.toPlainText().trimmed().isEmpty())
|
if(doc.toPlainText().trimmed().isEmpty())
|
||||||
notes()->hide();
|
BoardPostDisplayWidget_card::notes()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton *BoardPostDisplayWidget_card::voteUpButton() { return ui->voteUpButton; }
|
QToolButton *BoardPostDisplayWidget_card::voteUpButton() { return ui->voteUpButton; }
|
||||||
|
|
|
@ -62,10 +62,11 @@ public:
|
||||||
|
|
||||||
static const char *DEFAULT_BOARD_IMAGE;
|
static const char *DEFAULT_BOARD_IMAGE;
|
||||||
|
|
||||||
protected slots:
|
protected:
|
||||||
/* GxsGroupFeedItem */
|
/* 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 *voteUpButton() =0;
|
||||||
virtual QToolButton *commentButton() =0;
|
virtual QToolButton *commentButton() =0;
|
||||||
|
@ -81,6 +82,7 @@ protected slots:
|
||||||
virtual QToolButton *shareButton() =0;
|
virtual QToolButton *shareButton() =0;
|
||||||
virtual QFrame *feedFrame() =0;
|
virtual QFrame *feedFrame() =0;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
void loadComments(bool e);
|
void loadComments(bool e);
|
||||||
void readToggled();
|
void readToggled();
|
||||||
void setReadStatus(bool isNew, bool isUnread) ;
|
void setReadStatus(bool isNew, bool isUnread) ;
|
||||||
|
|
|
@ -90,7 +90,10 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="voteFrame">
|
<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">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -173,6 +176,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="voteFrame_VS">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -277,7 +287,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="from_HSpacer">
|
<spacer name="from_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -340,7 +350,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="pictureLabel_HSpacer">
|
<spacer name="pictureLabel_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -401,16 +411,16 @@
|
||||||
<iconset resource="Posted_images.qrc">
|
<iconset resource="Posted_images.qrc">
|
||||||
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
|
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
<property name="toolButtonStyle">
|
||||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="buttons_HSpacer">
|
<spacer name="buttons_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -424,10 +434,30 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="feedFrame_VS">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>542</width>
|
<width>542</width>
|
||||||
<height>150</height>
|
<height>151</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -90,7 +90,22 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="voteFrame">
|
<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>
|
<item>
|
||||||
<widget class="QToolButton" name="voteUpButton">
|
<widget class="QToolButton" name="voteUpButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -161,6 +176,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="voteFrame_VS">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -287,7 +309,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="from_HSpacer">
|
<spacer name="from_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -305,7 +327,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="buttons_HM">
|
<layout class="QHBoxLayout" name="buttons_HL">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="commentButton">
|
<widget class="QToolButton" name="commentButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -400,7 +422,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="buttons_HSpacer">
|
<spacer name="buttons_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -414,6 +436,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="right_VS">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -473,6 +502,13 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="feedFrame_VS">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>614</width>
|
<width>614</width>
|
||||||
<height>182</height>
|
<height>198</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="PostedCardView_GL">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="from_HL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<spacer name="from_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -241,30 +241,27 @@
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="voteUpButton">
|
<widget class="QToolButton" name="voteUpButton">
|
||||||
|
@ -337,26 +334,20 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="voteFrame_VS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>5</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="buttons_HL">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="commentButton">
|
<widget class="QToolButton" name="commentButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -389,7 +380,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="buttons_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -461,7 +452,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QFrame" name="picture_frame">
|
<widget class="QFrame" name="picture_frame">
|
||||||
<layout class="QHBoxLayout" name="horizontalPictureLayout">
|
<layout class="QHBoxLayout" name="picture_frame_HL">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -485,7 +476,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="picture_frame_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -513,9 +504,9 @@
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../icons.qrc"/>
|
|
||||||
<include location="Posted_images.qrc"/>
|
<include location="Posted_images.qrc"/>
|
||||||
|
<include location="../icons.qrc"/>
|
||||||
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="PostedItem_GL">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -82,21 +82,21 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="voteFrame_VL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="voteUpButton">
|
<widget class="QToolButton" name="voteUpButton">
|
||||||
|
@ -169,26 +169,20 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="voteFrame_VS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>5</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" rowspan="2">
|
<item row="0" column="1" rowspan="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="thumbnail_VL">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -233,7 +227,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="thumbnail_VS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -248,7 +242,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="title_VL">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -286,7 +280,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
<layout class="QHBoxLayout" name="newComm_HL">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -312,7 +306,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="from_VL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -320,7 +314,7 @@
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="from_HL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -416,7 +410,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<spacer name="from_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -434,7 +428,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
<layout class="QHBoxLayout" name="buttons_HL">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -567,7 +561,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="buttons_HS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -631,9 +625,9 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="frame_picture_HL">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="frame_picture_LHS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -659,7 +653,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="frame_picture_RHS">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -685,7 +679,7 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Sunken</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="frame_notes_GL">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -726,17 +720,17 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/gxs/GxsIdLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ElidedLabel</class>
|
<class>ElidedLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>gui/common/ElidedLabel.h</header>
|
<header>gui/common/ElidedLabel.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>GxsIdLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>gui/gxs/GxsIdLabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ClickableLabel</class>
|
<class>ClickableLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
|
|
|
@ -58,9 +58,7 @@
|
||||||
// number of posts to show at once.
|
// number of posts to show at once.
|
||||||
#define POSTS_CHUNK_SIZE 25
|
#define POSTS_CHUNK_SIZE 25
|
||||||
|
|
||||||
/****
|
//#define DEBUG_POSTED
|
||||||
* #define DEBUG_POSTED
|
|
||||||
***/
|
|
||||||
|
|
||||||
static const int POSTED_TABS_POSTS = 1;
|
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
|
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,
|
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.
|
return; // so when selected, we only draw the selected one.
|
||||||
|
|
||||||
|
@ -98,7 +100,7 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
painter->fillRect( option.rect, option.palette.background());
|
painter->fillRect( option.rect, option.palette.window());
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
QPixmap pixmap(option.rect.size());
|
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);
|
BoardPostDisplayWidget_compact w(post,displayFlags(post.mMeta.mMsgId),nullptr);
|
||||||
|
|
||||||
w.setFixedSize(option.rect.size());
|
w.setFixedSize(option.rect.size());
|
||||||
|
|
||||||
w.updateGeometry();
|
w.updateGeometry();
|
||||||
w.adjustSize();
|
w.adjustSize();
|
||||||
|
|
||||||
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -121,6 +123,7 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||||
w.setFixedSize(option.rect.size());
|
w.setFixedSize(option.rect.size());
|
||||||
w.updateGeometry();
|
w.updateGeometry();
|
||||||
w.adjustSize();
|
w.adjustSize();
|
||||||
|
|
||||||
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
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->save();
|
||||||
painter->drawPixmap(option.rect.topLeft(), pixmap /*,.scaled(option.rect.width(),option.rect.width()*w.height()/(float)w.width(),Qt::KeepAspectRatio,Qt::SmoothTransformation)*/);
|
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();
|
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
|
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>() ;
|
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
||||||
|
|
||||||
if(index.column() == RsPostedPostsModel::COLUMN_POSTS)
|
#ifdef DEBUG_POSTED
|
||||||
{
|
RS_DBG("Title:", post.mMeta.mMsgName.c_str());
|
||||||
QWidget *w ;
|
#endif
|
||||||
|
|
||||||
if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT)
|
if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT)
|
||||||
w = new BoardPostDisplayWidget_compact(post,displayFlags(post.mMeta.mMsgId),parent);
|
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(vote(RsGxsGrpMsgIdPair,bool)),mPostListWidget,SLOT(voteMsg(RsGxsGrpMsgIdPair,bool)));
|
||||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(expandItem(RsGxsMessageId,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(commentsRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(openComments(RsGxsMessageId)));
|
||||||
QObject::connect(w,SIGNAL(changeReadStatusRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(changeReadStatus(const RsGxsMessageId&,bool)));
|
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.
|
// 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(thumbnailOpenned()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||||
QObject::connect(w,SIGNAL(vote(RsGxsGrpMsgIdPair,bool)),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(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(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||||
QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
|
QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
|
||||||
|
|
||||||
w->setFixedSize(option.rect.size());
|
w->setGeometry(option.rect);
|
||||||
w->adjustSize();
|
w->adjustSize();
|
||||||
w->updateGeometry();
|
w->updateGeometry();
|
||||||
w->adjustSize();
|
w->adjustSize();
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
void PostedPostDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
void PostedPostDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||||
{
|
{
|
||||||
editor->setGeometry(option.rect);
|
editor->setGeometry(option.rect);
|
||||||
|
@ -264,13 +277,11 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
||||||
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
|
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
|
||||||
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prevPosts()));
|
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(ui->viewModeButton,SIGNAL(clicked()),this,SLOT(switchDisplayMode()));
|
||||||
|
|
||||||
connect(mPostedPostsModel,SIGNAL(boardPostsLoaded()),this,SLOT(postPostLoad()));
|
connect(mPostedPostsModel,SIGNAL(boardPostsLoaded()),this,SLOT(postPostLoad()));
|
||||||
|
|
||||||
QFontMetricsF fm(font());
|
|
||||||
|
|
||||||
/* Setup UI helper */
|
/* Setup UI helper */
|
||||||
|
|
||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
|
@ -374,7 +385,6 @@ void PostedListWidgetWithModel::filterItems(QString text)
|
||||||
|
|
||||||
void PostedListWidgetWithModel::nextPosts()
|
void PostedListWidgetWithModel::nextPosts()
|
||||||
{
|
{
|
||||||
ui->postsTree->selectionModel()->clear();
|
|
||||||
if(mPostedPostsModel->displayedStartPostIndex() + POSTS_CHUNK_SIZE < mPostedPostsModel->filteredPostsCount())
|
if(mPostedPostsModel->displayedStartPostIndex() + POSTS_CHUNK_SIZE < mPostedPostsModel->filteredPostsCount())
|
||||||
{
|
{
|
||||||
mPostedPostsModel->setPostsInterval(POSTS_CHUNK_SIZE+mPostedPostsModel->displayedStartPostIndex(),POSTS_CHUNK_SIZE);
|
mPostedPostsModel->setPostsInterval(POSTS_CHUNK_SIZE+mPostedPostsModel->displayedStartPostIndex(),POSTS_CHUNK_SIZE);
|
||||||
|
@ -384,8 +394,6 @@ void PostedListWidgetWithModel::nextPosts()
|
||||||
|
|
||||||
void PostedListWidgetWithModel::prevPosts()
|
void PostedListWidgetWithModel::prevPosts()
|
||||||
{
|
{
|
||||||
ui->postsTree->selectionModel()->clear();
|
|
||||||
|
|
||||||
if((int)mPostedPostsModel->displayedStartPostIndex() > 0)
|
if((int)mPostedPostsModel->displayedStartPostIndex() > 0)
|
||||||
{
|
{
|
||||||
mPostedPostsModel->setPostsInterval((int)mPostedPostsModel->displayedStartPostIndex()-POSTS_CHUNK_SIZE,POSTS_CHUNK_SIZE);
|
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)
|
switch(e->mPostedEventCode)
|
||||||
{
|
{
|
||||||
case RsPostedEventCode::NEW_COMMENT: // [[fallthrough]];
|
case RsPostedEventCode::NEW_COMMENT: [[fallthrough]];
|
||||||
case RsPostedEventCode::NEW_VOTE: // [[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
|
// 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();
|
t->refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case RsPostedEventCode::NEW_MESSAGE: // [[fallthrough]];
|
[[clang::fallthrough]];
|
||||||
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
|
case RsPostedEventCode::NEW_MESSAGE: [[fallthrough]];
|
||||||
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
|
case RsPostedEventCode::NEW_POSTED_GROUP: [[fallthrough]];
|
||||||
case RsPostedEventCode::UPDATED_MESSAGE:
|
case RsPostedEventCode::UPDATED_POSTED_GROUP: [[fallthrough]];
|
||||||
case RsPostedEventCode::BOARD_DELETED:
|
case RsPostedEventCode::UPDATED_MESSAGE: [[fallthrough]];
|
||||||
|
case RsPostedEventCode::BOARD_DELETED: [[fallthrough]];
|
||||||
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
|
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
|
||||||
{
|
{
|
||||||
if(e->mPostedGroupId == groupId())
|
if(e->mPostedGroupId == groupId())
|
||||||
|
|
|
@ -18,20 +18,26 @@
|
||||||
* *
|
* *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QResizeEvent>
|
|
||||||
#include "RSTreeView.h"
|
#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)
|
void RSTreeView::wheelEvent(QWheelEvent *e)
|
||||||
{
|
{
|
||||||
if(e->modifiers() == Qt::ControlModifier)
|
if(e->modifiers() == Qt::ControlModifier)
|
||||||
{
|
{
|
||||||
emit zoomRequested(e->delta() > 0);
|
emit zoomRequested(e->angleDelta().y() > 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -39,21 +45,46 @@ void RSTreeView::wheelEvent(QWheelEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSTreeView::mouseMoveEvent(QMouseEvent *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());
|
QModelIndex idx = indexAt(e->pos());
|
||||||
|
|
||||||
if(idx.isValid() && idx != selectionModel()->currentIndex())
|
if(idx.isValid() && idx != selectionModel()->currentIndex())
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_RSTREEVIEW
|
||||||
|
RS_DBG("Selection changed");
|
||||||
|
#endif
|
||||||
selectionModel()->setCurrentIndex(idx,QItemSelectionModel::ClearAndSelect);
|
selectionModel()->setCurrentIndex(idx,QItemSelectionModel::ClearAndSelect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QTreeView::mouseMoveEvent(e);
|
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)
|
void RSTreeView::setAutoSelect(bool b)
|
||||||
{
|
{
|
||||||
if(b)
|
autoSelect = b; // Keep this because setMouseTracking can be called outside.
|
||||||
setMouseTracking(true);
|
setMouseTracking(b);
|
||||||
else
|
|
||||||
setMouseTracking(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSTreeView::resizeEvent(QResizeEvent *e)
|
void RSTreeView::resizeEvent(QResizeEvent *e)
|
||||||
|
|
|
@ -29,13 +29,19 @@ class RSTreeView : public QTreeView
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RSTreeView(QWidget *parent = 0);
|
RSTreeView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief set Placeholder Text
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
void setPlaceholderText(const QString &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);
|
void setAutoSelect(bool b);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -44,11 +50,13 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseMoveEvent(QMouseEvent *e) override; // overriding so as to manage auto-selection
|
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 wheelEvent(QWheelEvent *e) override; // overriding so as to manage zoom
|
||||||
virtual void resizeEvent(QResizeEvent *e) override;
|
virtual void resizeEvent(QResizeEvent *e) override;
|
||||||
virtual void paintEvent(QPaintEvent *event) override;
|
virtual void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
QString placeholderText;
|
QString placeholderText;
|
||||||
|
bool autoSelect;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#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);
|
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;
|
border: 0px;
|
||||||
}
|
}
|
||||||
QFrame[objectName^="#headerBFrame"] {
|
QFrame[objectName^="headerBFrame"] {
|
||||||
border: 1px;
|
border: 1px;
|
||||||
border-radius: 4px;
|
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);
|
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #9BDBF9, stop:1 #1592CD);
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
QFrame[objectName^="#headerBFrame"] {
|
QFrame[objectName^="headerBFrame"] {
|
||||||
border: 1px;
|
border: 1px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue