diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
index 241c713d1..6d2cbb4a4 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
@@ -122,14 +122,14 @@ void BoardPostDisplayWidgetBase::setReadStatus(bool isNew, bool isUnread)
void BoardPostDisplayWidget_compact::doExpand(bool e)
{
#ifdef DEBUG_BOARDPOSTDISPLAYWIDGET
- std::cerr << "Expanding" << std::endl;
+ std::cerr << "Expanding" << std::endl;
#endif
- if(e)
- ui->frame_notes->show();
- else
- ui->frame_notes->hide();
+ if(e)
+ ui->frame_notes->show();
+ else
+ ui->frame_notes->hide();
- emit expand(mPost.mMeta.mMsgId,e);
+ emit expand(mPost.mMeta.mMsgId,e);
}
void BoardPostDisplayWidgetBase::loadComments(bool e)
@@ -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; }
diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
index a6d4a04d6..189f83ae5 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h
@@ -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) ;
diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui
index 28ce4fd1d..85eb14906 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui
@@ -90,7 +90,10 @@
-
-
+
+
+ 0
+
0
@@ -173,6 +176,13 @@
+ -
+
+
+ Qt::Vertical
+
+
+
@@ -277,7 +287,7 @@
-
-
+
Qt::Horizontal
@@ -340,7 +350,7 @@
-
-
+
Qt::Horizontal
@@ -401,16 +411,16 @@
:/images/share.png:/images/share.png
-
- true
-
Qt::ToolButtonTextBesideIcon
+
+ true
+
-
-
+
Qt::Horizontal
@@ -424,10 +434,30 @@
+ -
+
+
+ Qt::Vertical
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui
index f27524f08..8c6e89748 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui
@@ -7,7 +7,7 @@
0
0
542
- 150
+ 151
@@ -90,7 +90,22 @@
-
-
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
@@ -161,6 +176,13 @@
+ -
+
+
+ Qt::Vertical
+
+
+
@@ -287,7 +309,7 @@
-
-
+
Qt::Horizontal
@@ -305,7 +327,7 @@
-
-
+
-
@@ -400,7 +422,7 @@
-
-
+
Qt::Horizontal
@@ -414,6 +436,13 @@
+ -
+
+
+ Qt::Vertical
+
+
+
@@ -473,6 +502,13 @@
+ -
+
+
+ Qt::Vertical
+
+
+
diff --git a/retroshare-gui/src/gui/Posted/PostedCardView.ui b/retroshare-gui/src/gui/Posted/PostedCardView.ui
index a55acad24..dba517263 100644
--- a/retroshare-gui/src/gui/Posted/PostedCardView.ui
+++ b/retroshare-gui/src/gui/Posted/PostedCardView.ui
@@ -7,7 +7,7 @@
0
0
614
- 182
+ 198
@@ -16,7 +16,7 @@
-
+
0
@@ -118,7 +118,7 @@
-
-
+
5
@@ -216,7 +216,7 @@
-
-
+
Qt::Horizontal
@@ -241,30 +241,27 @@
0
-
-
-
QFrame::NoFrame
QFrame::Plain
-
+
0
- 3
+ 0
- 3
+ 0
- 3
+ 0
- 3
+ 0
-
@@ -337,26 +334,20 @@
-
-
+
Qt::Vertical
QSizePolicy::Expanding
-
-
- 20
- 5
-
-
-
-
+
-
@@ -389,7 +380,7 @@
-
-
+
Qt::Horizontal
@@ -461,7 +452,7 @@
-
-
+
0
@@ -485,7 +476,7 @@
-
-
+
Qt::Horizontal
@@ -513,9 +504,9 @@
-
-
+
+
diff --git a/retroshare-gui/src/gui/Posted/PostedItem.ui b/retroshare-gui/src/gui/Posted/PostedItem.ui
index fc316a632..6c6b290f8 100644
--- a/retroshare-gui/src/gui/Posted/PostedItem.ui
+++ b/retroshare-gui/src/gui/Posted/PostedItem.ui
@@ -16,7 +16,7 @@
-
+
1
@@ -82,21 +82,21 @@
QFrame::Plain
-
+
0
- 3
+ 0
- 3
+ 0
- 3
+ 0
- 3
+ 0
-
@@ -169,26 +169,20 @@
-
-
+
Qt::Vertical
QSizePolicy::Expanding
-
-
- 20
- 5
-
-
-
-
+
9
@@ -233,7 +227,7 @@
-
-
+
Qt::Vertical
@@ -248,7 +242,7 @@
-
-
+
6
@@ -286,7 +280,7 @@
-
-
+
0
@@ -312,7 +306,7 @@
-
-
+
0
@@ -320,7 +314,7 @@
QLayout::SetDefaultConstraint
-
-
+
5
@@ -416,7 +410,7 @@
-
-
+
Qt::Horizontal
@@ -434,7 +428,7 @@
-
-
+
6
@@ -567,7 +561,7 @@
-
-
+
Qt::Horizontal
@@ -631,9 +625,9 @@
QFrame::Raised
-
+
-
-
+
Qt::Horizontal
@@ -659,7 +653,7 @@
-
-
+
Qt::Horizontal
@@ -685,7 +679,7 @@
QFrame::Sunken
-
+
3
@@ -726,17 +720,17 @@
+
+ GxsIdLabel
+ QLabel
+
+
ElidedLabel
QLabel
1
-
- GxsIdLabel
- QLabel
-
-
ClickableLabel
QLabel
diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
index 087eebe3c..7dcc767b8 100644
--- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
@@ -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,8 +85,12 @@ 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.
+ return; // so when selected, we only draw the selected one.
// prepare
painter->save();
@@ -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,40 +200,46 @@ uint8_t PostedPostDelegate::displayFlags(const RsGxsMessageId &id) const
QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const
{
- RsPostedPost post = index.data(Qt::UserRole).value() ;
- if(index.column() == RsPostedPostsModel::COLUMN_POSTS)
- {
- QWidget *w ;
+ if (!index.isValid())
+ return nullptr;
- if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT)
- w = new BoardPostDisplayWidget_compact(post,displayFlags(post.mMeta.mMsgId),parent);
- else
- w = new BoardPostDisplayWidget_card(post,displayFlags(post.mMeta.mMsgId),parent);
+ if(index.column() != RsPostedPostsModel::COLUMN_POSTS)
+ return nullptr;
- 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)));
+ QWidget *w ;
+ RsPostedPost post = index.data(Qt::UserRole).value() ;
- // 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(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
- QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
+#ifdef DEBUG_POSTED
+ RS_DBG("Title:", post.mMeta.mMsgName.c_str());
+#endif
- w->setFixedSize(option.rect.size());
- w->adjustSize();
- w->updateGeometry();
- w->adjustSize();
+ if(mDisplayMode==BoardPostDisplayWidget_compact::DISPLAY_MODE_COMPACT)
+ w = new BoardPostDisplayWidget_compact(post,displayFlags(post.mMeta.mMsgId),parent);
+ else
+ w = new BoardPostDisplayWidget_card(post,displayFlags(post.mMeta.mMsgId),parent);
- return w;
- }
- else
- return NULL;
+ 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(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(RsGxsMessageId,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
+ QObject::connect(w,SIGNAL(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
+ QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
+
+ w->setGeometry(option.rect);
+ w->adjustSize();
+ w->updateGeometry();
+ w->adjustSize();
+
+ return w;
}
+
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,23 +385,20 @@ 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);
+ if(mPostedPostsModel->displayedStartPostIndex() + POSTS_CHUNK_SIZE < mPostedPostsModel->filteredPostsCount())
+ {
+ mPostedPostsModel->setPostsInterval(POSTS_CHUNK_SIZE+mPostedPostsModel->displayedStartPostIndex(),POSTS_CHUNK_SIZE);
updateShowLabel();
- }
+ }
}
void PostedListWidgetWithModel::prevPosts()
{
- ui->postsTree->selectionModel()->clear();
-
- if((int)mPostedPostsModel->displayedStartPostIndex() > 0)
- {
- mPostedPostsModel->setPostsInterval((int)mPostedPostsModel->displayedStartPostIndex()-POSTS_CHUNK_SIZE,POSTS_CHUNK_SIZE);
- updateShowLabel();
- }
+ if((int)mPostedPostsModel->displayedStartPostIndex() > 0)
+ {
+ mPostedPostsModel->setPostsInterval((int)mPostedPostsModel->displayedStartPostIndex()-POSTS_CHUNK_SIZE,POSTS_CHUNK_SIZE);
+ updateShowLabel();
+ }
}
void PostedListWidgetWithModel::showAuthorInPeople()
@@ -490,29 +498,30 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptrmPostedEventCode)
{
- case RsPostedEventCode::NEW_COMMENT: // [[fallthrough]];
- case RsPostedEventCode::NEW_VOTE: // [[fallthrough]];
- {
- // special treatment here because the message might be a comment, so we need to refresh the comment tab if openned
+ 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
- for(int i=2;itabWidget->count();++i)
- {
- auto *t = dynamic_cast(ui->tabWidget->widget(i));
+ for(int i=2;itabWidget->count();++i)
+ {
+ auto *t = dynamic_cast(ui->tabWidget->widget(i));
- if(t->groupId() == e->mPostedGroupId)
- 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:
- case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
- {
+ if(t->groupId() == e->mPostedGroupId)
+ t->refresh();
+ }
+ }
+ [[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())
updateDisplay(true);
- }
+ }
default:
break;
diff --git a/retroshare-gui/src/gui/common/RSTreeView.cpp b/retroshare-gui/src/gui/common/RSTreeView.cpp
index 624021f2f..454ab250e 100644
--- a/retroshare-gui/src/gui/common/RSTreeView.cpp
+++ b/retroshare-gui/src/gui/common/RSTreeView.cpp
@@ -18,42 +18,73 @@
* *
*******************************************************************************/
-#include
-#include
#include "RSTreeView.h"
-RSTreeView::RSTreeView(QWidget *parent) : QTreeView(parent)
+#include "util/rsdebug.h"
+
+#include
+#include
+
+//#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);
- return;
- }
- else
- QTreeView::wheelEvent(e);
+ if(e->modifiers() == Qt::ControlModifier)
+ {
+ emit zoomRequested(e->angleDelta().y() > 0);
+ return;
+ }
+ else
+ QTreeView::wheelEvent(e);
}
void RSTreeView::mouseMoveEvent(QMouseEvent *e)
{
- QModelIndex idx = indexAt(e->pos());
+#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())
- selectionModel()->setCurrentIndex(idx,QItemSelectionModel::ClearAndSelect);
+ if(idx.isValid() && idx != selectionModel()->currentIndex())
+ {
+#ifdef DEBUG_RSTREEVIEW
+ RS_DBG("Selection changed");
+#endif
+ 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)
{
- if(b)
- setMouseTracking(true);
- else
- setMouseTracking(false);
+ autoSelect = b; // Keep this because setMouseTracking can be called outside.
+ setMouseTracking(b);
}
void RSTreeView::resizeEvent(QResizeEvent *e)
diff --git a/retroshare-gui/src/gui/common/RSTreeView.h b/retroshare-gui/src/gui/common/RSTreeView.h
index 116ccac31..0ccd34134 100644
--- a/retroshare-gui/src/gui/common/RSTreeView.h
+++ b/retroshare-gui/src/gui/common/RSTreeView.h
@@ -29,26 +29,34 @@ 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
-
- void setAutoSelect(bool b);
+ /**
+ * @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:
- void sizeChanged(QSize);
- void zoomRequested(bool zoom_or_unzoom);
+ void sizeChanged(QSize);
+ void zoomRequested(bool zoom_or_unzoom);
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 resizeEvent(QResizeEvent *e) override;
virtual void paintEvent(QPaintEvent *event) override;
QString placeholderText;
+ bool autoSelect;
};
#endif
diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss
index fc95d1d46..d3983c6b9 100644
--- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss
+++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss
@@ -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;
}
diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss
index e6616c855..42a727888 100644
--- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss
+++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss
@@ -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;
}