X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fnickviewfilter.cpp;h=ea33660540334eb73c80c0c55075fbddac1f3b6b;hp=e4955ac5a32bc4f30f576eac3f2505387f5d0745;hb=86bd6b1ffb870e65af6d830a2ea16471c348ed5a;hpb=fee29a2c223027f15ac911809ec4fcbbf74a0e4c diff --git a/src/uisupport/nickviewfilter.cpp b/src/uisupport/nickviewfilter.cpp index e4955ac5..ea336605 100644 --- a/src/uisupport/nickviewfilter.cpp +++ b/src/uisupport/nickviewfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,11 +20,11 @@ #include "nickviewfilter.h" +#include "buffersettings.h" +#include "graphicalui.h" +#include "iconloader.h" #include "networkmodel.h" - -#include "uisettings.h" - -#include +#include "uistyle.h" /****************************************************************************************** * NickViewFilter @@ -36,36 +36,9 @@ NickViewFilter::NickViewFilter(const BufferId &bufferId, NetworkModel *parent) setSourceModel(parent); setDynamicSortFilter(true); setSortCaseSensitivity(Qt::CaseInsensitive); + setSortRole(TreeModel::SortRole); } -QVariant NickViewFilter::data(const QModelIndex &index, int role) const { - if(role == Qt::ForegroundRole) - return foreground(index); - else - return QSortFilterProxyModel::data(index, role); -// else { -// QVariant d = -// if(role == 0) -// qDebug() << index << role << d; -// return d; -// } -} - -QVariant NickViewFilter::foreground(const QModelIndex &index) const { - UiSettings s("QtUi/Colors"); - QVariant onlineStatusFG = s.value("onlineStatusFG", QVariant(QColor(Qt::black))); - QVariant awayStatusFG = s.value("awayStatusFG", QVariant(QColor(Qt::gray))); - - if(!index.data(NetworkModel::ItemActiveRole).toBool()) - return awayStatusFG.value(); - - return onlineStatusFG.value(); - - // FIXME:: make colors configurable; - // FIXME: use the style interface instead of qsettings -} - - bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { // root node, networkindexes, the bufferindex of the buffer this filter is active for and it's childs are accepted if(!source_parent.isValid()) @@ -74,3 +47,15 @@ bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex &source_ QModelIndex source_child = source_parent.child(source_row, 0); return (sourceModel()->data(source_child, NetworkModel::BufferIdRole).value() == _bufferId); } + +QVariant NickViewFilter::data(const QModelIndex &index, int role) const { + switch(role) { + case Qt::FontRole: + case Qt::ForegroundRole: + case Qt::BackgroundRole: + case Qt::DecorationRole: + return GraphicalUi::uiStyle()->nickViewItemData(mapToSource(index), role); + default: + return QSortFilterProxyModel::data(index, role); + } +}