From b265cdf284daf8ddc66123f5690c28b134536ddd Mon Sep 17 00:00:00 2001 From: chelovechishko Date: Mon, 6 Jul 2020 13:18:45 +0900 Subject: [PATCH] gxsforums: add background color for pinned and filtered posts into qss --- retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp | 4 ++-- retroshare-gui/src/gui/gxsforums/GxsForumModel.h | 6 ++++++ .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 3 +++ .../src/gui/gxsforums/GxsForumThreadWidget.h | 12 ++++++++++++ retroshare-gui/src/gui/qss/stylesheet/qss.default | 3 +++ retroshare-gui/src/qss/qdarkstyle.qss | 3 +++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index af62f5a91..ef09a9c8d 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -596,10 +596,10 @@ QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int /*colum QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED) - return QVariant(QBrush(QColor(255,200,180))); + return QVariant(QBrush(mBackgroundColorPinned)); if(mFilteringEnabled && (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_PASSES_FILTER)) - return QVariant(QBrush(QColor(255,240,210))); + return QVariant(QBrush(mBackgroundColorFiltered)); return QVariant(); } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.h b/retroshare-gui/src/gui/gxsforums/GxsForumModel.h index 0dc9c6898..50de234fa 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.h @@ -118,6 +118,9 @@ public: void setTextColorMissing (QColor color) { mTextColorMissing = color;} void setTextColorPinned (QColor color) { mTextColorPinned = color;} + void setBackgroundColorPinned (QColor color) { mBackgroundColorPinned = color;} + void setBackgroundColorFiltered (QColor color) { mBackgroundColorFiltered = color;} + void setMsgReadStatus(const QModelIndex &i, bool read_status, bool with_children); void setFilter(int column, const QStringList &strings, uint32_t &count) ; void setAuthorOpinion(const QModelIndex& indx,RsOpinion op); @@ -205,5 +208,8 @@ private: QColor mTextColorMissing ; QColor mTextColorPinned ; + QColor mBackgroundColorPinned; + QColor mBackgroundColorFiltered; + friend class const_iterator; }; diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 4af17cc0f..87daafc50 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -219,6 +219,9 @@ void GxsForumThreadWidget::setTextColorMissing (QColor color) { mTextColor // Suppose to be different from unread one void GxsForumThreadWidget::setTextColorPinned (QColor color) { mTextColorPinned = color; mThreadModel->setTextColorPinned (color);} +void GxsForumThreadWidget::setBackgroundColorPinned (QColor color) { mBackgroundColorPinned = color; mThreadModel->setBackgroundColorPinned (color);} +void GxsForumThreadWidget::setBackgroundColorFiltered(QColor color) { mBackgroundColorFiltered = color; mThreadModel->setBackgroundColorFiltered (color);} + GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent) : GxsMessageFrameWidget(rsGxsForums, parent), ui(new Ui::GxsForumThreadWidget) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index cc3342344..22aa2ecc3 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -54,6 +54,9 @@ class GxsForumThreadWidget : public GxsMessageFrameWidget Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing) Q_PROPERTY(QColor textColorPinned READ textColorPinned WRITE setTextColorPinned) + Q_PROPERTY(QColor backgroundColorPinned READ backgroundColorPinned WRITE setBackgroundColorPinned) + Q_PROPERTY(QColor backgroundColorFiltered READ backgroundColorFiltered WRITE setBackgroundColorFiltered) + public: explicit GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent = NULL); ~GxsForumThreadWidget(); @@ -65,6 +68,9 @@ public: QColor textColorMissing() const { return mTextColorMissing; } QColor textColorPinned() const { return mTextColorPinned; } + QColor backgroundColorPinned() const { return mBackgroundColorPinned; } + QColor backgroundColorFiltered() const { return mBackgroundColorFiltered; } + void setTextColorRead (QColor color) ; void setTextColorUnread (QColor color) ; void setTextColorUnreadChildren(QColor color) ; @@ -72,6 +78,9 @@ public: void setTextColorMissing (QColor color) ; void setTextColorPinned (QColor color) ; + void setBackgroundColorPinned (QColor color); + void setBackgroundColorFiltered (QColor color); + /* GxsMessageFrameWidget */ virtual void groupIdChanged(); virtual QString groupName(bool withUnreadCount); @@ -212,6 +221,9 @@ private: QColor mTextColorMissing; QColor mTextColorPinned; + QColor mBackgroundColorPinned; + QColor mBackgroundColorFiltered; + RsGxsMessageId mNavigatePendingMsgId; QList mIgnoredMsgId; diff --git a/retroshare-gui/src/gui/qss/stylesheet/qss.default b/retroshare-gui/src/gui/qss/stylesheet/qss.default index 3a9072058..d55011bee 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/qss.default +++ b/retroshare-gui/src/gui/qss/stylesheet/qss.default @@ -139,6 +139,9 @@ ForumsDialog, GxsForumThreadWidget qproperty-textColorNotSubscribed: black; qproperty-textColorMissing: darkRed; qproperty-textColorPinned: darkOrange; + + qproperty-backgroundColorPinned: rgb(255, 200, 180); + qproperty-backgroundColorFiltered: rgb(255, 240, 210); } GroupTreeWidget diff --git a/retroshare-gui/src/qss/qdarkstyle.qss b/retroshare-gui/src/qss/qdarkstyle.qss index fda8d04a0..d226dc8c8 100644 --- a/retroshare-gui/src/qss/qdarkstyle.qss +++ b/retroshare-gui/src/qss/qdarkstyle.qss @@ -94,6 +94,9 @@ ForumsDialog, GxsForumThreadWidget qproperty-textColorNotSubscribed: white; qproperty-textColorMissing: darkred; qproperty-textColorPinned: darkOrange; + + qproperty-backgroundColorPinned: black; + qproperty-backgroundColorFiltered: darkGreen; } QMenuBar