mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
fixed coloring in FriendListModel
This commit is contained in:
parent
fb174f0131
commit
6c534360f1
@ -1014,6 +1014,7 @@ void FriendList::insertPeers()
|
|||||||
if (rsState == 0) {
|
if (rsState == 0) {
|
||||||
sslFont.setBold(true);
|
sslFont.setBold(true);
|
||||||
sslColor = mTextColorStatus[RS_STATUS_ONLINE];
|
sslColor = mTextColorStatus[RS_STATUS_ONLINE];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sslFont = StatusDefs::font(rsState);
|
sslFont = StatusDefs::font(rsState);
|
||||||
sslColor = mTextColorStatus[rsState];
|
sslColor = mTextColorStatus[rsState];
|
||||||
|
@ -364,8 +364,9 @@ QVariant RsFriendListModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
switch(role)
|
switch(role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
|
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
|
||||||
case Qt::FontRole: return fontRole(entry,index.column()) ;
|
case Qt::FontRole: return fontRole(entry,index.column()) ;
|
||||||
|
case Qt::TextColorRole: return textColorRole(entry,index.column()) ;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -381,7 +382,6 @@ QVariant RsFriendListModel::data(const QModelIndex &index, int role) const
|
|||||||
// case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
// case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
||||||
// case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
// case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
||||||
// case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
// case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
||||||
// case Qt::TextColorRole: return textColorRole (fmpe,index.column()) ;
|
|
||||||
// case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
// case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
||||||
//
|
//
|
||||||
// case FilterRole: return filterRole (fmpe,index.column()) ;
|
// case FilterRole: return filterRole (fmpe,index.column()) ;
|
||||||
@ -395,7 +395,14 @@ QVariant RsFriendListModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
QVariant RsFriendListModel::textColorRole(const EntryIndex& fmpe,int column) const
|
QVariant RsFriendListModel::textColorRole(const EntryIndex& fmpe,int column) const
|
||||||
{
|
{
|
||||||
return QVariant();
|
switch(fmpe.type)
|
||||||
|
{
|
||||||
|
case ENTRY_TYPE_GROUP: return QVariant(QBrush(mTextColorGroup));
|
||||||
|
#warning CODE NEEDED HERE!
|
||||||
|
case ENTRY_TYPE_NODE: return QVariant(QBrush(mTextColorStatus[getPeerStatus(fmpe)]));
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsFriendListModel::statusRole(const EntryIndex& fmpe,int column) const
|
QVariant RsFriendListModel::statusRole(const EntryIndex& fmpe,int column) const
|
||||||
@ -690,6 +697,16 @@ const RsFriendListModel::RsNodeDetails *RsFriendListModel::getNodeInfo(const Ent
|
|||||||
return &node.node_info;
|
return &node.node_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t RsFriendListModel::getPeerStatus(const EntryIndex& e) const
|
||||||
|
{
|
||||||
|
const RsNodeDetails *noded = getNodeInfo(e) ;
|
||||||
|
StatusInfo info;
|
||||||
|
|
||||||
|
if(!noded || !rsStatus->getStatus(noded->id,info))
|
||||||
|
return RS_STATUS_OFFLINE;
|
||||||
|
|
||||||
|
return info.status;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant RsFriendListModel::userRole(const EntryIndex& fmpe,int col) const
|
QVariant RsFriendListModel::userRole(const EntryIndex& fmpe,int col) const
|
||||||
{
|
{
|
||||||
|
@ -23,15 +23,10 @@
|
|||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
#include "retroshare/rsstatus.h"
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
|
|
||||||
// This class holds the actual hierarchy of posts, represented by identifiers
|
|
||||||
// It is responsible for auto-updating when necessary and holds a mutex to allow the Model to
|
|
||||||
// safely access the data.
|
|
||||||
|
|
||||||
// The model contains a post in place 0 that is the parent of all posts.
|
|
||||||
|
|
||||||
typedef uint32_t ForumModelIndex;
|
typedef uint32_t ForumModelIndex;
|
||||||
|
|
||||||
// This class is the item model used by Qt to display the information
|
// This class is the item model used by Qt to display the information
|
||||||
@ -148,11 +143,17 @@ public:
|
|||||||
|
|
||||||
void clear() ;
|
void clear() ;
|
||||||
|
|
||||||
|
/* Color definitions (for standard see qss.default) */
|
||||||
|
QColor mTextColorGroup;
|
||||||
|
QColor mTextColorStatus[RS_STATUS_COUNT];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const RsGroupInfo *getGroupInfo (const EntryIndex&) const;
|
const RsGroupInfo *getGroupInfo (const EntryIndex&) const;
|
||||||
const RsProfileDetails *getProfileInfo(const EntryIndex&) const;
|
const RsProfileDetails *getProfileInfo(const EntryIndex&) const;
|
||||||
const RsNodeDetails *getNodeInfo (const EntryIndex&) const;
|
const RsNodeDetails *getNodeInfo (const EntryIndex&) const;
|
||||||
|
|
||||||
|
uint32_t getPeerStatus(const EntryIndex& e) const;
|
||||||
|
|
||||||
QVariant sizeHintRole (int col) const;
|
QVariant sizeHintRole (int col) const;
|
||||||
|
|
||||||
QVariant displayRole (const EntryIndex &e, int col) const;
|
QVariant displayRole (const EntryIndex &e, int col) const;
|
||||||
|
@ -64,19 +64,19 @@ public:
|
|||||||
void sortByColumn(int column, Qt::SortOrder sortOrder);
|
void sortByColumn(int column, Qt::SortOrder sortOrder);
|
||||||
bool isSortByState();
|
bool isSortByState();
|
||||||
|
|
||||||
QColor textColorGroup() const { return mTextColorGroup; }
|
QColor textColorGroup() const { return mModel->mTextColorGroup; }
|
||||||
QColor textColorStatusOffline() const { return mTextColorStatus[RS_STATUS_OFFLINE]; }
|
QColor textColorStatusOffline() const { return mModel->mTextColorStatus[RS_STATUS_OFFLINE ]; }
|
||||||
QColor textColorStatusAway() const { return mTextColorStatus[RS_STATUS_AWAY]; }
|
QColor textColorStatusAway() const { return mModel->mTextColorStatus[RS_STATUS_AWAY ]; }
|
||||||
QColor textColorStatusBusy() const { return mTextColorStatus[RS_STATUS_BUSY]; }
|
QColor textColorStatusBusy() const { return mModel->mTextColorStatus[RS_STATUS_BUSY ]; }
|
||||||
QColor textColorStatusOnline() const { return mTextColorStatus[RS_STATUS_ONLINE]; }
|
QColor textColorStatusOnline() const { return mModel->mTextColorStatus[RS_STATUS_ONLINE ]; }
|
||||||
QColor textColorStatusInactive() const { return mTextColorStatus[RS_STATUS_INACTIVE]; }
|
QColor textColorStatusInactive() const { return mModel->mTextColorStatus[RS_STATUS_INACTIVE]; }
|
||||||
|
|
||||||
void setTextColorGroup(QColor color) { mTextColorGroup = color; }
|
void setTextColorGroup(QColor color) { mModel->mTextColorGroup = color; }
|
||||||
void setTextColorStatusOffline(QColor color) { mTextColorStatus[RS_STATUS_OFFLINE] = color; }
|
void setTextColorStatusOffline(QColor color) { mModel->mTextColorStatus[RS_STATUS_OFFLINE ] = color; }
|
||||||
void setTextColorStatusAway(QColor color) { mTextColorStatus[RS_STATUS_AWAY] = color; }
|
void setTextColorStatusAway(QColor color) { mModel->mTextColorStatus[RS_STATUS_AWAY ] = color; }
|
||||||
void setTextColorStatusBusy(QColor color) { mTextColorStatus[RS_STATUS_BUSY] = color; }
|
void setTextColorStatusBusy(QColor color) { mModel->mTextColorStatus[RS_STATUS_BUSY ] = color; }
|
||||||
void setTextColorStatusOnline(QColor color) { mTextColorStatus[RS_STATUS_ONLINE] = color; }
|
void setTextColorStatusOnline(QColor color) { mModel->mTextColorStatus[RS_STATUS_ONLINE ] = color; }
|
||||||
void setTextColorStatusInactive(QColor color) { mTextColorStatus[RS_STATUS_INACTIVE] = color; }
|
void setTextColorStatusInactive(QColor color) { mModel->mTextColorStatus[RS_STATUS_INACTIVE] = color; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void filterItems(const QString &text);
|
void filterItems(const QString &text);
|
||||||
@ -116,10 +116,6 @@ private:
|
|||||||
std::set<RsNodeGroupId> openGroups;
|
std::set<RsNodeGroupId> openGroups;
|
||||||
std::set<RsPgpId> openPeers;
|
std::set<RsPgpId> openPeers;
|
||||||
|
|
||||||
/* Color definitions (for standard see qss.default) */
|
|
||||||
QColor mTextColorGroup;
|
|
||||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
|
||||||
|
|
||||||
bool getOrCreateGroup(const std::string& name, uint flag, RsNodeGroupId& id);
|
bool getOrCreateGroup(const std::string& name, uint flag, RsNodeGroupId& id);
|
||||||
bool getGroupIdByName(const std::string& name, RsNodeGroupId& id);
|
bool getGroupIdByName(const std::string& name, RsNodeGroupId& id);
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ MessagesDialog
|
|||||||
qproperty-textColorInbox: rgb(49, 106, 197);
|
qproperty-textColorInbox: rgb(49, 106, 197);
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendList
|
NewFriendList
|
||||||
{
|
{
|
||||||
qproperty-textColorStatusOffline: black;
|
qproperty-textColorStatusOffline: black;
|
||||||
qproperty-textColorStatusAway: gray;
|
qproperty-textColorStatusAway: gray;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user