gxsforums: add background color for pinned and filtered posts into qss

This commit is contained in:
chelovechishko 2020-07-06 13:18:45 +09:00
parent 98cf944f92
commit b265cdf284
6 changed files with 29 additions and 2 deletions

View File

@ -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();
}

View File

@ -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;
};

View File

@ -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)

View File

@ -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<RsGxsMessageId> mIgnoredMsgId;

View File

@ -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

View File

@ -94,6 +94,9 @@ ForumsDialog, GxsForumThreadWidget
qproperty-textColorNotSubscribed: white;
qproperty-textColorMissing: darkred;
qproperty-textColorPinned: darkOrange;
qproperty-backgroundColorPinned: black;
qproperty-backgroundColorFiltered: darkGreen;
}
QMenuBar