mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Moved most of the hardcoded colors of lists and trees to the file qss.default (with help from braindead).
Now the stylesheet can redefine these colors. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5843 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9c1d702128
commit
a8d1d05405
@ -267,6 +267,19 @@ void ForumsDialog::processSettings(bool bLoad)
|
||||
m_bProcessSettings = false;
|
||||
}
|
||||
|
||||
void ForumsDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
CalculateIconsAndFonts();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ForumsDialog::forumListCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
@ -684,20 +697,20 @@ void ForumsDialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasRead
|
||||
|
||||
if (!IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
||||
qf.setBold(false);
|
||||
pItem->setTextColor(i, Qt::black);
|
||||
pItem->setTextColor(i, textColorNotSubscribed());
|
||||
} else if (bUnread) {
|
||||
qf.setBold(true);
|
||||
pItem->setTextColor(i, Qt::black);
|
||||
pItem->setTextColor(i, textColorUnread());
|
||||
} else if (bMyUnreadChilddren) {
|
||||
qf.setBold(true);
|
||||
pItem->setTextColor(i, Qt::gray);
|
||||
pItem->setTextColor(i, textColorUnreadChildren());
|
||||
} else {
|
||||
qf.setBold(false);
|
||||
pItem->setTextColor(i, Qt::gray);
|
||||
pItem->setTextColor(i, textColorRead());
|
||||
}
|
||||
if (missing) {
|
||||
/* Missing message */
|
||||
pItem->setTextColor(i, Qt::darkRed);
|
||||
pItem->setTextColor(i, textColorMissing());
|
||||
}
|
||||
pItem->setFont(i, qf);
|
||||
}
|
||||
|
@ -35,7 +35,13 @@ class RSTreeWidgetItemCompareRole;
|
||||
|
||||
class ForumsDialog : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorRead READ textColorRead WRITE setTextColorRead)
|
||||
Q_PROPERTY(QColor textColorUnread READ textColorUnread WRITE setTextColorUnread)
|
||||
Q_PROPERTY(QColor textColorUnreadChildren READ textColorUnreadChildren WRITE setTextColorUnreadChildren)
|
||||
Q_PROPERTY(QColor textColorNotSubscribed READ textColorNotSubscribed WRITE setTextColorNotSubscribed)
|
||||
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
|
||||
|
||||
public:
|
||||
ForumsDialog(QWidget *parent = 0);
|
||||
@ -51,8 +57,21 @@ public:
|
||||
static QString titleFromInfo(ForumMsgInfo &msgInfo);
|
||||
static QString messageFromInfo(ForumMsgInfo &msgInfo);
|
||||
|
||||
QColor textColorRead() const { return mTextColorRead; }
|
||||
QColor textColorUnread() const { return mTextColorUnread; }
|
||||
QColor textColorUnreadChildren() const { return mTextColorUnreadChildren; }
|
||||
QColor textColorNotSubscribed() const { return mTextColorNotSubscribed; }
|
||||
QColor textColorMissing() const { return mTextColorMissing; }
|
||||
|
||||
void setTextColorRead(QColor color) { mTextColorRead = color; }
|
||||
void setTextColorUnread(QColor color) { mTextColorUnread = color; }
|
||||
void setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color; }
|
||||
void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; }
|
||||
void setTextColorMissing(QColor color) { mTextColorMissing = color; }
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
@ -149,6 +168,13 @@ private:
|
||||
|
||||
ForumsFillThread *fillThread;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorRead;
|
||||
QColor mTextColorUnread;
|
||||
QColor mTextColorUnreadChildren;
|
||||
QColor mTextColorNotSubscribed;
|
||||
QColor mTextColorMissing;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ForumsDialog ui;
|
||||
};
|
||||
@ -186,4 +212,3 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -363,6 +363,19 @@ bool MessagesDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
return MainPage::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void MessagesDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
insertMessages();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::fillQuickView()
|
||||
{
|
||||
MsgTagType tags;
|
||||
@ -1136,18 +1149,22 @@ void MessagesDialog::insertMessages()
|
||||
item[COLUMN_TAGS]->setData(text, ROLE_SORT);
|
||||
|
||||
// set color
|
||||
QBrush Brush; // standard
|
||||
QColor color;
|
||||
if (tagInfo.tagIds.size()) {
|
||||
Tag = Tags.types.find(tagInfo.tagIds.front());
|
||||
if (Tag != Tags.types.end()) {
|
||||
Brush = QBrush(Tag->second.second);
|
||||
color = Tag->second.second;
|
||||
} else {
|
||||
// clean tagId
|
||||
rsMsgs->setMessageTag(it->msgId, tagInfo.tagIds.front(), false);
|
||||
}
|
||||
}
|
||||
if (!color.isValid()) {
|
||||
color = ui.messagestreeView->palette().color(QPalette::Text);
|
||||
}
|
||||
QBrush brush = QBrush(color);
|
||||
for (int i = 0; i < COLUMN_COUNT; i++) {
|
||||
item[i]->setForeground(Brush);
|
||||
item[i]->setForeground(brush);
|
||||
}
|
||||
|
||||
// No of Files.
|
||||
@ -1685,7 +1702,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||
qf.setBold(true);
|
||||
item->setFont(qf);
|
||||
item->setIcon(QIcon(":/images/folder-inbox-new.png"));
|
||||
item->setForeground(QBrush(QColor(49, 106, 197)));
|
||||
item->setForeground(QBrush(mTextColorInbox));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1695,7 +1712,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||
qf.setBold(false);
|
||||
item->setFont(qf);
|
||||
item->setIcon(QIcon(":/images/folder-inbox.png"));
|
||||
item->setForeground(QBrush(QColor(0, 0, 0)));
|
||||
item->setForeground(QBrush(ui.messagestreeView->palette().color(QPalette::Text)));
|
||||
}
|
||||
|
||||
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
||||
|
@ -33,6 +33,8 @@ class MessagesDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorInbox READ textColorInbox WRITE setTextColorInbox)
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
MessagesDialog(QWidget *parent = 0);
|
||||
@ -44,8 +46,13 @@ public:
|
||||
// replaced by shortcut
|
||||
// virtual void keyPressEvent(QKeyEvent *) ;
|
||||
|
||||
QColor textColorInbox() const { return mTextColorInbox; }
|
||||
|
||||
void setTextColorInbox(QColor color) { mTextColorInbox = color; }
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
public slots:
|
||||
void insertMessages();
|
||||
@ -142,6 +149,9 @@ private:
|
||||
|
||||
MessageWidget *msgWidget;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorInbox;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MessagesDialog ui;
|
||||
};
|
||||
|
@ -179,6 +179,19 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
||||
#endif
|
||||
}
|
||||
|
||||
void NetworkDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
insertConnect();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkDialog::updateNewDiscoveryInfo()
|
||||
{
|
||||
//std::cerr << "Received new p3disc info. Updating networkview." << std::endl;
|
||||
@ -436,13 +449,13 @@ void NetworkDialog::insertConnect()
|
||||
{
|
||||
item -> setText(0, "0");
|
||||
item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
|
||||
backgrndcolor=QColor("#45ff45");//bright green
|
||||
backgrndcolor = backgroundColorOwnSign();
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setText(0, "0");
|
||||
item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
|
||||
backgrndcolor=QColor("#43C043");//light green
|
||||
backgrndcolor = backgroundColorAcceptConnection();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -451,14 +464,14 @@ void NetworkDialog::insertConnect()
|
||||
|
||||
if (detail.hasSignedMe)
|
||||
{
|
||||
backgrndcolor=QColor("#B242B2"); //kind of purple
|
||||
backgrndcolor = backgroundColorHasSignedMe();
|
||||
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
|
||||
for(int k=0;k<8;++k)
|
||||
item -> setToolTip(k, QString::fromUtf8(detail.name.c_str()) + tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect."));
|
||||
}
|
||||
else
|
||||
{
|
||||
backgrndcolor=Qt::lightGray;
|
||||
backgrndcolor = backgroundColorDenied();
|
||||
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
|
||||
}
|
||||
}
|
||||
@ -502,7 +515,7 @@ void NetworkDialog::insertConnect()
|
||||
// Color each Background column in the Network Tab except the first one => 1-9
|
||||
for(int i=0;i<10;++i)
|
||||
{
|
||||
self_item->setBackground(i,Qt::yellow) ;//QBrush(QColor("#45ff45")));
|
||||
self_item->setBackground(i,backgroundColorSelf()) ;
|
||||
}
|
||||
connectWidget->addTopLevelItem(self_item);
|
||||
|
||||
|
@ -30,6 +30,12 @@ class NetworkDialog : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor backgroundColorSelf READ backgroundColorSelf WRITE setBackgroundColorSelf)
|
||||
Q_PROPERTY(QColor backgroundColorOwnSign READ backgroundColorOwnSign WRITE setBackgroundColorOwnSign)
|
||||
Q_PROPERTY(QColor backgroundColorAcceptConnection READ backgroundColorAcceptConnection WRITE setBackgroundColorAcceptConnection)
|
||||
Q_PROPERTY(QColor backgroundColorHasSignedMe READ backgroundColorHasSignedMe WRITE setBackgroundColorHasSignedMe)
|
||||
Q_PROPERTY(QColor backgroundColorDenied READ backgroundColorDenied WRITE setBackgroundColorDenied)
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
NetworkDialog(QWidget *parent = 0);
|
||||
@ -37,12 +43,26 @@ public:
|
||||
//void load();
|
||||
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
|
||||
|
||||
QColor backgroundColorSelf() const { return mBackgroundColorSelf; }
|
||||
QColor backgroundColorOwnSign() const { return mBackgroundColorOwnSign; }
|
||||
QColor backgroundColorAcceptConnection() const { return mBackgroundColorAcceptConnection; }
|
||||
QColor backgroundColorHasSignedMe() const { return mBackgroundColorHasSignedMe; }
|
||||
QColor backgroundColorDenied() const { return mBackgroundColorDenied; }
|
||||
|
||||
void setBackgroundColorSelf(QColor color) { mBackgroundColorSelf = color; }
|
||||
void setBackgroundColorOwnSign(QColor color) { mBackgroundColorOwnSign = color; }
|
||||
void setBackgroundColorAcceptConnection(QColor color) { mBackgroundColorAcceptConnection = color; }
|
||||
void setBackgroundColorHasSignedMe(QColor color) { mBackgroundColorHasSignedMe = color; }
|
||||
void setBackgroundColorDenied(QColor color) { mBackgroundColorDenied = color; }
|
||||
|
||||
public slots:
|
||||
void insertConnect();
|
||||
// std::string loadneighbour();
|
||||
/* void loadneighbour(); */
|
||||
void updateNewDiscoveryInfo() ;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
|
||||
@ -91,6 +111,13 @@ private:
|
||||
|
||||
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mBackgroundColorSelf;
|
||||
QColor mBackgroundColorOwnSign;
|
||||
QColor mBackgroundColorAcceptConnection;
|
||||
QColor mBackgroundColorHasSignedMe;
|
||||
QColor mBackgroundColorDenied;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::NetworkDialog ui;
|
||||
};
|
||||
|
@ -526,7 +526,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
||||
if(details.min_age > ageIndicator)
|
||||
return Qt::gray ;
|
||||
else
|
||||
return Qt::black ;
|
||||
return QVariant() ; // standard
|
||||
} /* end of TextColorRole */
|
||||
|
||||
|
||||
|
@ -1003,53 +1003,27 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
||||
QColor foreground;
|
||||
|
||||
int sources = friendSource + anonymousSource ;
|
||||
if (sources < 1)
|
||||
if (sources <= 0)
|
||||
{
|
||||
foreground = QColor(0, 0, 19);
|
||||
foreground = textColorNoSources();
|
||||
}
|
||||
else if (sources < 2)
|
||||
else if (sources <= 10)
|
||||
{
|
||||
foreground = QColor(0, 0, 38);
|
||||
}
|
||||
else if (sources < 3)
|
||||
{
|
||||
foreground = QColor(0, 0, 57);
|
||||
}
|
||||
else if (sources < 4)
|
||||
{
|
||||
foreground = QColor(0, 0, 76);
|
||||
}
|
||||
else if (sources < 5)
|
||||
{
|
||||
foreground = QColor(0, 0, 96);
|
||||
}
|
||||
else if (sources < 6)
|
||||
{
|
||||
foreground = QColor(0, 0, 114);
|
||||
}
|
||||
else if (sources < 7)
|
||||
{
|
||||
foreground = QColor(0, 0, 133);
|
||||
}
|
||||
else if (sources < 8)
|
||||
{
|
||||
foreground = QColor(0, 0, 152);
|
||||
}
|
||||
else if (sources < 9)
|
||||
{
|
||||
foreground = QColor(0, 0, 171);
|
||||
}
|
||||
else if (sources < 10)
|
||||
{
|
||||
foreground = QColor(0, 0, 190);
|
||||
}
|
||||
else if (sources < 11)
|
||||
{
|
||||
foreground = QColor(0, 0, 209);
|
||||
QColor colorLow = textColorLowSources();
|
||||
QColor colorHigh = textColorHighSources();
|
||||
|
||||
float percent = (float) (sources - 1) / 10; // 100% not used here, see next else
|
||||
|
||||
int red = (int) (colorLow.red() + (float) (colorHigh.red() - colorLow.red()) * percent);
|
||||
int green = (int) (colorLow.green() + (float)(colorHigh.green() - colorLow.green()) * percent);
|
||||
int blue = (int) (colorLow.blue() + (float)(colorHigh.blue() - colorLow.blue()) * percent);
|
||||
|
||||
foreground = QColor(red, green, blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreground = QColor(0, 0, 228);
|
||||
// > 10
|
||||
foreground = textColorHighSources();
|
||||
}
|
||||
|
||||
QBrush brush(foreground);
|
||||
@ -1104,7 +1078,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
||||
FileInfo fi;
|
||||
if (rsFiles->FileDetails(file.hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_SPEC_ONLY, fi)) {
|
||||
item->setData(SR_DATA_COL, SR_ROLE_LOCAL, true);
|
||||
foreground = Qt::red;
|
||||
foreground = textColorLocal();
|
||||
setForeground = true;
|
||||
} else {
|
||||
item->setData(SR_DATA_COL, SR_ROLE_LOCAL, false);
|
||||
@ -1112,7 +1086,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
||||
sources = item->text(SR_ID_COL).toInt();
|
||||
if (sources == 1)
|
||||
{
|
||||
foreground = QColor(0, 0, 0);
|
||||
foreground = ui.searchResultWidget->palette().color(QPalette::Text);
|
||||
setForeground = true;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,12 @@ class SearchDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(QColor textColorLocal READ textColorLocal WRITE setTextColorLocal)
|
||||
Q_PROPERTY(QColor textColorNoSources READ textColorNoSources WRITE setTextColorNoSources)
|
||||
Q_PROPERTY(QColor textColorLowSources READ textColorLowSources WRITE setTextColorLowSources)
|
||||
Q_PROPERTY(QColor textColorHighSources READ textColorHighSources WRITE setTextColorHighSources)
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
SearchDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
@ -44,6 +49,16 @@ class SearchDialog : public MainPage
|
||||
|
||||
void searchKeywords(const QString& keywords);
|
||||
|
||||
QColor textColorLocal() const { return mTextColorLocal; }
|
||||
QColor textColorNoSources() const { return mTextColorNoSources; }
|
||||
QColor textColorLowSources() const { return mTextColorLowSources; }
|
||||
QColor textColorHighSources() const { return mTextColorHighSources; }
|
||||
|
||||
void setTextColorLocal(QColor color) { mTextColorLocal = color; }
|
||||
void setTextColorNoSources(QColor color) { mTextColorNoSources = color; }
|
||||
void setTextColorLowSources(QColor color) { mTextColorLowSources = color; }
|
||||
void setTextColorHighSources(QColor color) { mTextColorHighSources = color; }
|
||||
|
||||
public slots:
|
||||
void updateFiles(qulonglong request_id,FileDetail file) ;
|
||||
|
||||
@ -130,6 +145,12 @@ private:
|
||||
RSTreeWidgetItemCompareRole *compareSummaryRole;
|
||||
RSTreeWidgetItemCompareRole *compareResultRole;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorLocal;
|
||||
QColor mTextColorNoSources;
|
||||
QColor mTextColorLowSources;
|
||||
QColor mTextColorHighSources;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::SearchDialog ui;
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <QDateTime>
|
||||
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsstatus.h"
|
||||
|
||||
#include "GroupDefs.h"
|
||||
#include "gui/chat/ChatDialog.h"
|
||||
@ -235,6 +234,19 @@ void FriendList::processSettings(bool bLoad)
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
insertPeers();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::initializeHeader(bool afterLoadSettings)
|
||||
{
|
||||
// set column size
|
||||
@ -683,7 +695,7 @@ void FriendList::insertPeers()
|
||||
groupItem->setSizeHint(COLUMN_NAME, QSize(26, 26));
|
||||
groupItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
groupItem->setIcon(COLUMN_NAME, QIcon(IMAGE_GROUP24));
|
||||
groupItem->setForeground(COLUMN_NAME, QBrush(QColor(123, 123, 123)));
|
||||
groupItem->setForeground(COLUMN_NAME, QBrush(textColorGroup()));
|
||||
|
||||
/* used to find back the item */
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
|
||||
@ -957,10 +969,10 @@ void FriendList::insertPeers()
|
||||
|
||||
if (rsState == 0) {
|
||||
sslFont.setBold(true);
|
||||
sslColor = Qt::darkBlue;
|
||||
sslColor = mTextColorStatus[RS_STATUS_ONLINE];
|
||||
} else {
|
||||
sslFont = StatusDefs::font(rsState);
|
||||
sslColor = StatusDefs::textColor(rsState);
|
||||
sslColor = mTextColorStatus[rsState];
|
||||
}
|
||||
} else if (sslDetail.state & RS_PEER_STATE_ONLINE) {
|
||||
sslItem->setHidden(mHideUnconnected);
|
||||
@ -973,7 +985,7 @@ void FriendList::insertPeers()
|
||||
}
|
||||
|
||||
sslFont.setBold(true);
|
||||
sslColor = Qt::black;
|
||||
sslColor = mTextColorStatus[RS_STATUS_ONLINE];
|
||||
} else {
|
||||
sslItem->setHidden(mHideUnconnected);
|
||||
if (sslDetail.connectState) {
|
||||
@ -983,7 +995,7 @@ void FriendList::insertPeers()
|
||||
}
|
||||
|
||||
sslFont.setBold(false);
|
||||
sslColor = Qt::black;
|
||||
sslColor = mTextColorStatus[RS_STATUS_OFFLINE];
|
||||
}
|
||||
|
||||
if (std::find(privateChatIds.begin(), privateChatIds.end(), sslDetail.id) != privateChatIds.end()) {
|
||||
@ -1011,7 +1023,7 @@ void FriendList::insertPeers()
|
||||
bestRSState = RS_STATUS_ONLINE;
|
||||
}
|
||||
|
||||
QColor textColor = StatusDefs::textColor(bestRSState);
|
||||
QColor textColor = mTextColorStatus[bestRSState];
|
||||
QFont font = StatusDefs::font(bestRSState);
|
||||
for(int i = 0; i < COLUMN_COUNT; i++) {
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
@ -1047,8 +1059,9 @@ void FriendList::insertPeers()
|
||||
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
QColor textColor = mTextColorStatus[RS_STATUS_ONLINE];
|
||||
for(int i = 0; i < COLUMN_COUNT; i++) {
|
||||
gpgItem->setTextColor(i,(Qt::black));
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
gpgItem->setFont(i,font);
|
||||
}
|
||||
} else {
|
||||
@ -1062,7 +1075,7 @@ void FriendList::insertPeers()
|
||||
gpgItem->setHidden(mHideUnconnected);
|
||||
gpgIcon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
|
||||
|
||||
QColor textColor = StatusDefs::textColor(RS_STATUS_OFFLINE);
|
||||
QColor textColor = mTextColorStatus[RS_STATUS_OFFLINE];
|
||||
QFont font = StatusDefs::font(RS_STATUS_OFFLINE);
|
||||
for(int i = 0; i < COLUMN_COUNT; i++) {
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
#include "retroshare/rsstatus.h"
|
||||
|
||||
namespace Ui {
|
||||
class FriendList;
|
||||
@ -40,6 +41,13 @@ class FriendList : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorGroup READ textColorGroup WRITE setTextColorGroup)
|
||||
Q_PROPERTY(QColor textColorStatusOffline READ textColorStatusOffline WRITE setTextColorStatusOffline)
|
||||
Q_PROPERTY(QColor textColorStatusAway READ textColorStatusAway WRITE setTextColorStatusAway)
|
||||
Q_PROPERTY(QColor textColorStatusBusy READ textColorStatusBusy WRITE setTextColorStatusBusy)
|
||||
Q_PROPERTY(QColor textColorStatusOnline READ textColorStatusOnline WRITE setTextColorStatusOnline)
|
||||
Q_PROPERTY(QColor textColorStatusInactive READ textColorStatusInactive WRITE setTextColorStatusInactive)
|
||||
|
||||
public:
|
||||
explicit FriendList(QWidget *parent = 0);
|
||||
~FriendList();
|
||||
@ -55,6 +63,20 @@ public:
|
||||
|
||||
virtual void updateDisplay();
|
||||
|
||||
QColor textColorGroup() const { return mTextColorGroup; }
|
||||
QColor textColorStatusOffline() const { return mTextColorStatus[RS_STATUS_OFFLINE]; }
|
||||
QColor textColorStatusAway() const { return mTextColorStatus[RS_STATUS_AWAY]; }
|
||||
QColor textColorStatusBusy() const { return mTextColorStatus[RS_STATUS_BUSY]; }
|
||||
QColor textColorStatusOnline() const { return mTextColorStatus[RS_STATUS_ONLINE]; }
|
||||
QColor textColorStatusInactive() const { return mTextColorStatus[RS_STATUS_INACTIVE]; }
|
||||
|
||||
void setTextColorGroup(QColor color) { mTextColorGroup = color; }
|
||||
void setTextColorStatusOffline(QColor color) { mTextColorStatus[RS_STATUS_OFFLINE] = color; }
|
||||
void setTextColorStatusAway(QColor color) { mTextColorStatus[RS_STATUS_AWAY] = color; }
|
||||
void setTextColorStatusBusy(QColor color) { mTextColorStatus[RS_STATUS_BUSY] = color; }
|
||||
void setTextColorStatusOnline(QColor color) { mTextColorStatus[RS_STATUS_ONLINE] = color; }
|
||||
void setTextColorStatusInactive(QColor color) { mTextColorStatus[RS_STATUS_INACTIVE] = color; }
|
||||
|
||||
public slots:
|
||||
void filterItems(const QString &text);
|
||||
|
||||
@ -72,6 +94,9 @@ public slots:
|
||||
void sortPeersAscendingOrder();
|
||||
void sortPeersDescendingOrder();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::FriendList *ui;
|
||||
RSTreeWidgetItemCompareRole *m_compareRole;
|
||||
@ -88,6 +113,10 @@ private:
|
||||
std::set<std::string> *openGroups;
|
||||
std::set<std::string> *openPeers;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorGroup;
|
||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
||||
|
||||
QTreeWidgetItem *getCurrentPeer() const;
|
||||
static bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||
void updateHeader();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsstatus.h>
|
||||
@ -40,8 +41,6 @@
|
||||
#define ROLE_ID Qt::UserRole
|
||||
#define ROLE_SORT Qt::UserRole + 1
|
||||
|
||||
#define COLOR_CONNECT Qt::blue
|
||||
|
||||
#define IMAGE_GROUP16 ":/images/user/group16.png"
|
||||
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
|
||||
|
||||
@ -98,6 +97,9 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent) :
|
||||
|
||||
ui->filterLineEdit->setPlaceholderText(tr("Search Friends"));
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
/* Refresh style to have the correct text color */
|
||||
Rshare::refreshStyleSheet(this, false);
|
||||
}
|
||||
|
||||
FriendSelectionWidget::~FriendSelectionWidget()
|
||||
@ -105,6 +107,19 @@ FriendSelectionWidget::~FriendSelectionWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
fillList();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::setHeaderText(const QString &text)
|
||||
{
|
||||
ui->friendList->headerItem()->setText(COLUMN_NAME, text);
|
||||
@ -253,7 +268,7 @@ void FriendSelectionWidget::fillList()
|
||||
}
|
||||
|
||||
if (state != (int) RS_STATUS_OFFLINE) {
|
||||
item->setTextColor(COLUMN_NAME, COLOR_CONNECT);
|
||||
item->setTextColor(COLUMN_NAME, textColorOnline());
|
||||
}
|
||||
|
||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||
@ -304,7 +319,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
||||
QColor color;
|
||||
if (status != (int) RS_STATUS_OFFLINE) {
|
||||
color = COLOR_CONNECT;
|
||||
color = textColorOnline();
|
||||
}
|
||||
|
||||
item->setTextColor(COLUMN_NAME, color);
|
||||
|
@ -36,6 +36,8 @@ class FriendSelectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorOnline READ textColorOnline WRITE setTextColorOnline)
|
||||
|
||||
public:
|
||||
enum IdType
|
||||
{
|
||||
@ -68,6 +70,13 @@ public:
|
||||
void setSelectedSslIds(const std::list<std::string> &sslIds, bool add) { setSelectedIds(IDTYPE_SSL, sslIds, add); }
|
||||
void setSelectedGroupIds(const std::list<std::string> &groupIds, bool add) { setSelectedIds(IDTYPE_GROUP, groupIds, add); }
|
||||
|
||||
QColor textColorOnline() const { return mTextColorOnline; }
|
||||
|
||||
void setTextColorOnline(QColor color) { mTextColorOnline = color; }
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
signals:
|
||||
void contentChanged();
|
||||
void customContextMenuRequested(const QPoint &pos);
|
||||
@ -93,6 +102,9 @@ private:
|
||||
bool showGroups;
|
||||
bool inItemChanged;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorOnline;
|
||||
|
||||
Ui::FriendSelectionWidget *ui;
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define ROLE_POPULARITY Qt::UserRole + 3
|
||||
#define ROLE_LASTPOST Qt::UserRole + 4
|
||||
#define ROLE_SEARCH_SCORE Qt::UserRole + 5
|
||||
#define ROLE_COLOR Qt::UserRole + 6
|
||||
|
||||
#define FILTER_NAME_INDEX 0
|
||||
#define FILTER_DESC_INDEX 1
|
||||
@ -102,7 +103,11 @@ void GroupTreeWidget::changeEvent(QEvent *e)
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
case QEvent::StyleChange:
|
||||
updateColors();
|
||||
break;
|
||||
default:
|
||||
// remove compiler warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -188,6 +193,27 @@ void GroupTreeWidget::initDisplayMenu(QToolButton *toolButton)
|
||||
toolButton->setMenu(displayMenu);
|
||||
}
|
||||
|
||||
void GroupTreeWidget::updateColors()
|
||||
{
|
||||
QBrush brush;
|
||||
QBrush standardBrush = ui->treeWidget->palette().color(QPalette::Text);
|
||||
|
||||
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *itemIterator) != NULL) {
|
||||
itemIterator++;
|
||||
|
||||
int color = item->data(COLUMN_DATA, ROLE_COLOR).toInt();
|
||||
if (color >= 0) {
|
||||
brush = QBrush(mTextColor[color]);
|
||||
} else {
|
||||
brush = standardBrush;
|
||||
}
|
||||
|
||||
item->setForeground(COLUMN_NAME, brush);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupTreeWidget::customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
emit treeCustomContextMenuRequested(pos);
|
||||
@ -218,7 +244,8 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
|
||||
item->setFont(COLUMN_NAME, font);
|
||||
item->setIcon(COLUMN_NAME, icon);
|
||||
item->setSizeHint(COLUMN_NAME, QSize(18, 18));
|
||||
item->setForeground(COLUMN_NAME, QBrush(QColor(79, 79, 79)));
|
||||
item->setForeground(COLUMN_NAME, QBrush(textColorCategory()));
|
||||
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_CATEGORY);
|
||||
|
||||
ui->treeWidget->addTopLevelItem(item);
|
||||
|
||||
@ -294,7 +321,11 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
|
||||
/* Set color */
|
||||
QBrush brush;
|
||||
if (itemInfo.privatekey) {
|
||||
brush = QBrush(Qt::blue);
|
||||
brush = QBrush(textColorPrivateKey());
|
||||
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_PRIVATEKEY);
|
||||
} else {
|
||||
brush = ui->treeWidget->palette().color(QPalette::Text);
|
||||
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_STANDARD);
|
||||
}
|
||||
item->setForeground(COLUMN_NAME, brush);
|
||||
|
||||
|
@ -31,6 +31,11 @@ class QToolButton;
|
||||
class RshareSettings;
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
|
||||
#define GROUPTREEWIDGET_COLOR_STANDARD -1
|
||||
#define GROUPTREEWIDGET_COLOR_CATEGORY 0
|
||||
#define GROUPTREEWIDGET_COLOR_PRIVATEKEY 1
|
||||
#define GROUPTREEWIDGET_COLOR_COUNT 2
|
||||
|
||||
namespace Ui {
|
||||
class GroupTreeWidget;
|
||||
}
|
||||
@ -58,6 +63,9 @@ class GroupTreeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorCategory READ textColorCategory WRITE setTextColorCategory)
|
||||
Q_PROPERTY(QColor textColorPrivateKey READ textColorPrivateKey WRITE setTextColorPrivateKey)
|
||||
|
||||
public:
|
||||
GroupTreeWidget(QWidget *parent = 0);
|
||||
~GroupTreeWidget();
|
||||
@ -79,6 +87,12 @@ public:
|
||||
QTreeWidgetItem *getItemFromId(const QString &id);
|
||||
QTreeWidgetItem *activateId(const QString &id, bool focus);
|
||||
|
||||
QColor textColorCategory() const { return mTextColor[GROUPTREEWIDGET_COLOR_CATEGORY]; }
|
||||
QColor textColorPrivateKey() const { return mTextColor[GROUPTREEWIDGET_COLOR_PRIVATEKEY]; }
|
||||
|
||||
void setTextColorCategory(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_CATEGORY] = color; }
|
||||
void setTextColorPrivateKey(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_PRIVATEKEY] = color; }
|
||||
|
||||
signals:
|
||||
void treeCustomContextMenuRequested(const QPoint &pos);
|
||||
void treeCurrentItemChanged(const QString &id);
|
||||
@ -96,6 +110,7 @@ private slots:
|
||||
private:
|
||||
void calculateScore(QTreeWidgetItem *item, const QString &filterText);
|
||||
void resort(QTreeWidgetItem *categoryItem);
|
||||
void updateColors();
|
||||
|
||||
private:
|
||||
QMenu *displayMenu;
|
||||
@ -107,6 +122,9 @@ private:
|
||||
|
||||
RSTreeWidgetItemCompareRole *compareRole;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColor[GROUPTREEWIDGET_COLOR_COUNT];
|
||||
|
||||
Ui::GroupTreeWidget *ui;
|
||||
};
|
||||
|
||||
|
@ -101,25 +101,6 @@ QString StatusDefs::tooltip(unsigned int status)
|
||||
return "";
|
||||
}
|
||||
|
||||
QColor StatusDefs::textColor(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return Qt::black;
|
||||
case RS_STATUS_AWAY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_BUSY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_ONLINE:
|
||||
return Qt::darkBlue;
|
||||
case RS_STATUS_INACTIVE:
|
||||
return Qt::gray;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::textColor: Unknown status requested " << status;
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
QFont StatusDefs::font(unsigned int status)
|
||||
{
|
||||
QFont font;
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
static const char* imageUser(unsigned int status);
|
||||
static QString tooltip(unsigned int status);
|
||||
|
||||
static QColor textColor(unsigned int status);
|
||||
static QFont font(unsigned int status);
|
||||
|
||||
static QString peerStateString(int peerState);
|
||||
|
@ -10,3 +10,57 @@ AvatarWidget[frameState="INACTIVE"]{border-image:url(:/images/avatarstatus-bg-id
|
||||
AvatarWidget[frameState="ONLINE"]{border-image:url(:/images/avatarstatus-bg-online-116.png);}
|
||||
AvatarWidget[frameState="AWAY"]{border-image:url(:/images/avatarstatus-bg-away-116.png);}
|
||||
AvatarWidget[frameState="BUSY"]{border-image:url(:/images/avatarstatus-bg-busy-116.png);}
|
||||
|
||||
/* Color definitions */
|
||||
|
||||
ForumsDialog
|
||||
{
|
||||
qproperty-textColorRead: gray;
|
||||
qproperty-textColorUnread: black;
|
||||
qproperty-textColorUnreadChildren: gray;
|
||||
qproperty-textColorNotSubscribed: black;
|
||||
qproperty-textColorMissing: darkRed;
|
||||
}
|
||||
|
||||
GroupTreeWidget
|
||||
{
|
||||
qproperty-textColorCategory: rgb(79, 79, 79);
|
||||
qproperty-textColorPrivateKey: blue;
|
||||
}
|
||||
|
||||
FriendSelectionWidget
|
||||
{
|
||||
qproperty-textColorOnline: blue;
|
||||
}
|
||||
|
||||
MessagesDialog
|
||||
{
|
||||
qproperty-textColorInbox: rgb(49, 106, 197);
|
||||
}
|
||||
|
||||
FriendList
|
||||
{
|
||||
qproperty-textColorStatusOffline: black;
|
||||
qproperty-textColorStatusAway: gray;
|
||||
qproperty-textColorStatusBusy: gray;
|
||||
qproperty-textColorStatusOnline: darkBlue;
|
||||
qproperty-textColorStatusInactive: gray;
|
||||
qproperty-textColorGroup: rgb(123, 123, 123);
|
||||
}
|
||||
|
||||
SearchDialog
|
||||
{
|
||||
qproperty-textColorLocal: red;
|
||||
qproperty-textColorNoSources: rgb(0, 0, 19);
|
||||
qproperty-textColorLowSources: rgb(0, 0, 38);
|
||||
qproperty-textColorHighSources: rgb(0, 0, 228);
|
||||
}
|
||||
|
||||
NetworkDialog
|
||||
{
|
||||
qproperty-backgroundColorSelf: yellow;
|
||||
qproperty-backgroundColorOwnSign: rgb(69, 255, 69);
|
||||
qproperty-backgroundColorAcceptConnection: rgb(67, 192, 67);
|
||||
qproperty-backgroundColorHasSignedMe: rgb(178, 66, 178);
|
||||
qproperty-backgroundColorDenied: lightGray;
|
||||
}
|
||||
|
@ -3,6 +3,44 @@ HeaderFrame {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
ForumsDialog
|
||||
{
|
||||
qproperty-textColorRead: gray;
|
||||
qproperty-textColorUnread: white;
|
||||
qproperty-textColorUnreadChildren: gray;
|
||||
qproperty-textColorNotSubscribed: white;
|
||||
qproperty-textColorMissing: red;
|
||||
}
|
||||
|
||||
GroupTreeWidget
|
||||
{
|
||||
qproperty-textColorCategory: white;
|
||||
qproperty-textColorPrivateKey: blue;
|
||||
}
|
||||
|
||||
FriendSelectionWidget
|
||||
{
|
||||
qproperty-textColorOnline: lightBlue;
|
||||
}
|
||||
|
||||
FriendList
|
||||
{
|
||||
qproperty-textColorStatusOffline: white;
|
||||
qproperty-textColorStatusAway: gray;
|
||||
qproperty-textColorStatusBusy: gray;
|
||||
qproperty-textColorStatusOnline: lightBlue;
|
||||
qproperty-textColorStatusInactive: gray;
|
||||
qproperty-textColorGroup: rgb(123, 123, 123);
|
||||
}
|
||||
|
||||
SearchDialog
|
||||
{
|
||||
qproperty-textColorLocal: red;
|
||||
qproperty-textColorNoSources: rgb(255, 255, 19);
|
||||
qproperty-textColorLowSources: rgb(255, 255, 38);
|
||||
qproperty-textColorHighSources: rgb(255, 255, 228);
|
||||
}
|
||||
|
||||
QWidget{
|
||||
background: black;
|
||||
color: lightgray;
|
||||
@ -292,10 +330,3 @@ QTextEdit#lineEdit{
|
||||
QTextBrowser#postText{
|
||||
color: white;
|
||||
}
|
||||
|
||||
QTreeWidget#treeWidget{
|
||||
color: white;
|
||||
background: white;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user