gxsforums: add separate text color for pinned posts

This commit is contained in:
chelovechishko 2020-07-01 17:12:34 +09:00
parent db978e147b
commit 4a4adc354f
6 changed files with 15 additions and 2 deletions

View File

@ -445,10 +445,13 @@ QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int /*co
if( (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING))
return QVariant(mTextColorMissing);
if(IS_MSG_UNREAD(fmpe.mMsgStatus) || (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED))
if(IS_MSG_UNREAD(fmpe.mMsgStatus))
return QVariant(mTextColorUnread);
else
return QVariant(mTextColorRead);
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
return QVariant(mTextColorPinned);
else
return QVariant(mTextColorRead);
return QVariant();
}

View File

@ -116,6 +116,7 @@ public:
void setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color;}
void setTextColorNotSubscribed (QColor color) { mTextColorNotSubscribed = color;}
void setTextColorMissing (QColor color) { mTextColorMissing = color;}
void setTextColorPinned (QColor color) { mTextColorPinned = color;}
void setMsgReadStatus(const QModelIndex &i, bool read_status, bool with_children);
void setFilter(int column, const QStringList &strings, uint32_t &count) ;
@ -202,6 +203,7 @@ private:
QColor mTextColorUnreadChildren;
QColor mTextColorNotSubscribed ;
QColor mTextColorMissing ;
QColor mTextColorPinned ;
friend class const_iterator;
};

View File

@ -216,6 +216,8 @@ void GxsForumThreadWidget::setTextColorUnread (QColor color) { mTextColor
void GxsForumThreadWidget::setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color; mThreadModel->setTextColorUnreadChildren(color);}
void GxsForumThreadWidget::setTextColorNotSubscribed (QColor color) { mTextColorNotSubscribed = color; mThreadModel->setTextColorNotSubscribed (color);}
void GxsForumThreadWidget::setTextColorMissing (QColor color) { mTextColorMissing = color; mThreadModel->setTextColorMissing (color);}
// Suppose to be different from unread one
void GxsForumThreadWidget::setTextColorPinned (QColor color) { mTextColorPinned = color; mThreadModel->setTextColorPinned (color);}
GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent) :
GxsMessageFrameWidget(rsGxsForums, parent),

View File

@ -52,6 +52,7 @@ class GxsForumThreadWidget : public GxsMessageFrameWidget
Q_PROPERTY(QColor textColorUnreadChildren READ textColorUnreadChildren WRITE setTextColorUnreadChildren)
Q_PROPERTY(QColor textColorNotSubscribed READ textColorNotSubscribed WRITE setTextColorNotSubscribed)
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
Q_PROPERTY(QColor textColorPinned READ textColorPinned WRITE setTextColorPinned)
public:
explicit GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent = NULL);
@ -62,12 +63,14 @@ public:
QColor textColorUnreadChildren() const { return mTextColorUnreadChildren; }
QColor textColorNotSubscribed() const { return mTextColorNotSubscribed; }
QColor textColorMissing() const { return mTextColorMissing; }
QColor textColorPinned() const { return mTextColorPinned; }
void setTextColorRead (QColor color) ;
void setTextColorUnread (QColor color) ;
void setTextColorUnreadChildren(QColor color) ;
void setTextColorNotSubscribed (QColor color) ;
void setTextColorMissing (QColor color) ;
void setTextColorPinned (QColor color) ;
/* GxsMessageFrameWidget */
virtual void groupIdChanged();
@ -205,6 +208,7 @@ private:
QColor mTextColorUnreadChildren;
QColor mTextColorNotSubscribed;
QColor mTextColorMissing;
QColor mTextColorPinned;
RsGxsMessageId mNavigatePendingMsgId;
QList<RsGxsMessageId> mIgnoredMsgId;

View File

@ -138,6 +138,7 @@ ForumsDialog, GxsForumThreadWidget
qproperty-textColorUnreadChildren: darkgray;
qproperty-textColorNotSubscribed: black;
qproperty-textColorMissing: darkRed;
qproperty-textColorPinned: darkOrange;
}
GroupTreeWidget

View File

@ -93,6 +93,7 @@ ForumsDialog, GxsForumThreadWidget
qproperty-textColorUnreadChildren: red;
qproperty-textColorNotSubscribed: white;
qproperty-textColorMissing: darkred;
qproperty-textColorPinned: darkOrange;
}
QMenuBar