users who are away are now greyed out in the nickview
authorMarcus Eggenberger <egs@quassel-irc.org>
Thu, 31 Jan 2008 21:19:56 +0000 (21:19 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Thu, 31 Jan 2008 21:19:56 +0000 (21:19 +0000)
src/client/client.cpp
src/client/client.h
src/client/client.pri
src/client/networkmodel.cpp
src/qtui/nicklistwidget.cpp
src/uisupport/nickviewfilter.cpp [moved from src/client/nickmodel.cpp with 76% similarity]
src/uisupport/nickviewfilter.h [moved from src/client/nickmodel.h with 86% similarity]
src/uisupport/uisupport.pri
version.inc

index 772601f..c63632d 100644 (file)
@@ -29,7 +29,6 @@
 #include "network.h"
 #include "networkmodel.h"
 #include "buffermodel.h"
 #include "network.h"
 #include "networkmodel.h"
 #include "buffermodel.h"
-#include "nickmodel.h"
 #include "quasselui.h"
 #include "signalproxy.h"
 #include "util.h"
 #include "quasselui.h"
 #include "signalproxy.h"
 #include "util.h"
@@ -61,7 +60,6 @@ Client::Client(QObject *parent)
     mainUi(0),
     _networkModel(0),
     _bufferModel(0),
     mainUi(0),
     _networkModel(0),
     _bufferModel(0),
-    _nickModel(0),
     _connectedToCore(false),
     _syncedToCore(false)
 {
     _connectedToCore(false),
     _syncedToCore(false)
 {
@@ -79,7 +77,6 @@ void Client::init() {
           _networkModel, SLOT(bufferUpdated(BufferInfo)));
 
   _bufferModel = new BufferModel(_networkModel);
           _networkModel, SLOT(bufferUpdated(BufferInfo)));
 
   _bufferModel = new BufferModel(_networkModel);
-  _nickModel = new NickModel(_networkModel);
 
   SignalProxy *p = signalProxy();
   p->attachSignal(this, SIGNAL(sendSessionData(const QString &, const QVariant &)),
 
   SignalProxy *p = signalProxy();
   p->attachSignal(this, SIGNAL(sendSessionData(const QString &, const QVariant &)),
@@ -179,11 +176,6 @@ BufferModel *Client::bufferModel() {
   return instance()->_bufferModel;
 }
 
   return instance()->_bufferModel;
 }
 
-NickModel *Client::nickModel() {
-  return instance()->_nickModel;
-}
-
-
 SignalProxy *Client::signalProxy() {
   return instance()->_signalProxy;
 }
 SignalProxy *Client::signalProxy() {
   return instance()->_signalProxy;
 }
index a958057..f2b3ec3 100644 (file)
@@ -40,7 +40,6 @@ class NetworkModel;
 class BufferModel;
 class IrcUser;
 class IrcChannel;
 class BufferModel;
 class IrcUser;
 class IrcChannel;
-class NickModel;
 class SignalProxy;
 struct NetworkInfo;
 
 class SignalProxy;
 struct NetworkInfo;
 
@@ -91,7 +90,6 @@ public:
 
   static NetworkModel *networkModel();
   static BufferModel *bufferModel();
 
   static NetworkModel *networkModel();
   static BufferModel *bufferModel();
-  static NickModel *nickModel();
   static SignalProxy *signalProxy();
 
   static AbstractUiMsg *layoutMsg(const Message &);
   static SignalProxy *signalProxy();
 
   static AbstractUiMsg *layoutMsg(const Message &);
@@ -197,7 +195,6 @@ private:
   QPointer<AbstractUi> mainUi;
   QPointer<NetworkModel> _networkModel;
   QPointer<BufferModel> _bufferModel;
   QPointer<AbstractUi> mainUi;
   QPointer<NetworkModel> _networkModel;
   QPointer<BufferModel> _bufferModel;
-  QPointer<NickModel> _nickModel;
 
   ClientMode clientMode;
 
 
   ClientMode clientMode;
 
index a35211c..a6b81f4 100644 (file)
@@ -1,6 +1,6 @@
 DEPMOD = common
 QT_MOD = core network gui
 SRCS += buffer.cpp treemodel.cpp networkmodel.cpp buffermodel.cpp client.cpp clientsettings.cpp clientsyncer.cpp \
 DEPMOD = common
 QT_MOD = core network gui
 SRCS += buffer.cpp treemodel.cpp networkmodel.cpp buffermodel.cpp client.cpp clientsettings.cpp clientsyncer.cpp \
-        mappedselectionmodel.cpp modelpropertymapper.cpp nickmodel.cpp selectionmodelsynchronizer.cpp
+        mappedselectionmodel.cpp modelpropertymapper.cpp selectionmodelsynchronizer.cpp
 HDRS += buffer.h treemodel.h networkmodel.h buffermodel.h client.h clientsettings.h clientsyncer.h quasselui.h \
 HDRS += buffer.h treemodel.h networkmodel.h buffermodel.h client.h clientsettings.h clientsyncer.h quasselui.h \
-        mappedselectionmodel.h modelpropertymapper.h nickmodel.h selectionmodelsynchronizer.h
+        mappedselectionmodel.h modelpropertymapper.h selectionmodelsynchronizer.h
index 1cde086..7cfc5f6 100644 (file)
@@ -415,6 +415,8 @@ int UserCategoryItem::categoryFromModes(const QString &modes) {
 
 QVariant UserCategoryItem::data(int column, int role) const {
   switch(role) {
 
 QVariant UserCategoryItem::data(int column, int role) const {
   switch(role) {
+  case NetworkModel::ItemActiveRole:
+    return true;
   case NetworkModel::ItemTypeRole:
     return NetworkModel::UserCategoryItemType;
   case NetworkModel::BufferIdRole:
   case NetworkModel::ItemTypeRole:
     return NetworkModel::UserCategoryItemType;
   case NetworkModel::BufferIdRole:
@@ -457,6 +459,8 @@ quint64 IrcUserItem::id() const {
 
 QVariant IrcUserItem::data(int column, int role) const {
   switch(role) {
 
 QVariant IrcUserItem::data(int column, int role) const {
   switch(role) {
+  case NetworkModel::ItemActiveRole:
+    return !_ircUser->isAway();
   case NetworkModel::ItemTypeRole:
     return NetworkModel::IrcUserItemType;
   case NetworkModel::BufferIdRole:
   case NetworkModel::ItemTypeRole:
     return NetworkModel::IrcUserItemType;
   case NetworkModel::BufferIdRole:
index 24f07a9..42cc350 100644 (file)
@@ -24,7 +24,7 @@
 #include "nickview.h"
 #include "client.h"
 #include "networkmodel.h"
 #include "nickview.h"
 #include "client.h"
 #include "networkmodel.h"
-#include "nickmodel.h"
+#include "nickviewfilter.h"
 
 NickListWidget::NickListWidget(QWidget *parent)
   : QWidget(parent),
 
 NickListWidget::NickListWidget(QWidget *parent)
   : QWidget(parent),
@@ -50,8 +50,9 @@ void NickListWidget::setCurrentBuffer(BufferId bufferId) {
     ui.stackedWidget->setCurrentWidget(nickViews.value(bufferId));
   } else {
     NickView *view = new NickView(this);
     ui.stackedWidget->setCurrentWidget(nickViews.value(bufferId));
   } else {
     NickView *view = new NickView(this);
-    view->setModel(Client::nickModel());
-    view->setRootIndex(Client::nickModel()->mapFromSource(bufferIdx));
+    NickViewFilter *filter = new NickViewFilter(Client::networkModel());
+    view->setModel(filter);
+    view->setRootIndex(filter->mapFromSource(bufferIdx));
     nickViews[bufferId] = view;
     ui.stackedWidget->addWidget(view);
     ui.stackedWidget->setCurrentWidget(view);
     nickViews[bufferId] = view;
     ui.stackedWidget->addWidget(view);
     ui.stackedWidget->setCurrentWidget(view);
similarity index 76%
rename from src/client/nickmodel.cpp
rename to src/uisupport/nickviewfilter.cpp
index 14a804b..28f1a7c 100644 (file)
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#include "nickmodel.h"
+#include "nickviewfilter.h"
 
 #include "networkmodel.h"
 
 #include "networkmodel.h"
+#include <QColor>
 
 /******************************************************************************************
 
 /******************************************************************************************
- * NickModel
+ * NickViewFilter
  ******************************************************************************************/
  ******************************************************************************************/
-NickModel::NickModel(NetworkModel *parent)
+NickViewFilter::NickViewFilter(NetworkModel *parent)
   : QSortFilterProxyModel(parent)
 {
   setSourceModel(parent);
   : QSortFilterProxyModel(parent)
 {
   setSourceModel(parent);
@@ -33,3 +34,18 @@ NickModel::NickModel(NetworkModel *parent)
   setSortCaseSensitivity(Qt::CaseInsensitive);
 }
 
   setSortCaseSensitivity(Qt::CaseInsensitive);
 }
 
+QVariant NickViewFilter::data(const QModelIndex &index, int role) const {
+  if(role == Qt::ForegroundRole)
+    return foreground(index);
+  else
+    return QSortFilterProxyModel::data(index, role);
+}
+
+QVariant NickViewFilter::foreground(const QModelIndex &index) const {
+  if(!index.data(NetworkModel::ItemActiveRole).toBool())
+    return QColor(Qt::gray);
+  
+  return QColor(Qt::black);
+  
+  // FIXME:: make colors configurable;
+}
similarity index 86%
rename from src/client/nickmodel.h
rename to src/uisupport/nickviewfilter.h
index 2dc3574..47da294 100644 (file)
@@ -18,8 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef NICKMODEL_H
-#define NICKMODEL_H
+#ifndef NICKVIEWFILTER_H
+#define NICKVIEWFILTER_H
 
 #include <QSortFilterProxyModel>
 
 
 #include <QSortFilterProxyModel>
 
@@ -27,13 +27,13 @@ class NetworkModel;
 
 // This is proxymodel is purely for the sorting right now
 // the old nickmodel is stored for future reference in /devnotes
 
 // This is proxymodel is purely for the sorting right now
 // the old nickmodel is stored for future reference in /devnotes
-
-//! This ProxyModel can be used on top of a NickModel in order to provide a sorted nicklist and to hide unused categories.
-class NickModel : public QSortFilterProxyModel {
+class NickViewFilter : public QSortFilterProxyModel {
   Q_OBJECT
 
   Q_OBJECT
 
-  public:
-    NickModel(NetworkModel *parent = 0);
+public:
+  NickViewFilter(NetworkModel *parent = 0);
+  QVariant data(const QModelIndex &index, int role) const;
+  QVariant foreground(const QModelIndex &index) const;
 };
 
 #endif
 };
 
 #endif
index f7f0e89..984822e 100644 (file)
@@ -1,8 +1,8 @@
 DEPMOD = common client
 QT_MOD = core gui network
 
 DEPMOD = common client
 QT_MOD = core gui network
 
-SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp
-HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h
+SRCS += bufferview.cpp bufferviewfilter.cpp nickviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp
+HDRS += bufferview.h bufferviewfilter.h nickviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h
 
 FORMNAMES = 
 
 
 FORMNAMES = 
 
index 0478b2e..1d16430 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-01-30";
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-01-30";
-  quasselBuild = 415;
+  quasselBuild = 419;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 358;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 358;