X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnickmodel.h;h=2dc3574212a1b1eea92498172dd89fba7b544945;hp=b49ebf1da430f45e849d6314998e68a1e0237753;hb=a9b3edc811552b39dafb8fb01699490e5bcfb014;hpb=e671e9da1edaab37ec403f575979f9a92a766e9a diff --git a/src/client/nickmodel.h b/src/client/nickmodel.h index b49ebf1d..2dc35742 100644 --- a/src/client/nickmodel.h +++ b/src/client/nickmodel.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -18,56 +18,22 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _NICKMODEL_H_ -#define _NICKMODEL_H_ +#ifndef NICKMODEL_H +#define NICKMODEL_H -#include -#include +#include -class IrcChannel; -class IrcUser; +class NetworkModel; -//! Represents the IrcUsers in a given IrcChannel. -/** This model is a wrapper around the nicks/IrcUsers stored in an IrcChannel. It provides a tree with two, - * levels, where the top-level items are the categories (such as Ops, Voiced etc), and the second-level items - * the actual nicks/users. Several roles are provided to access information about a nick. - * - * Note that the nicks are not sorted in any way. Use a QSortFilterProxyModel to do that instead. - */ -class NickModel : public QAbstractItemModel { +// 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 { Q_OBJECT public: - NickModel(IrcChannel *channel = 0, QObject *parent = 0); - virtual ~NickModel(); - - virtual QModelIndex index(int row, int col, const QModelIndex &parent) const; - virtual QModelIndex parent(const QModelIndex &index) const; - virtual int rowCount(const QModelIndex &) const; - virtual int columnCount(const QModelIndex &) const; - virtual QVariant data(const QModelIndex &, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - - IrcChannel *ircChannel() const; - - QModelIndex indexOfUser(IrcUser *) const; - int categoryFromModes(const QString &modes) const; - int categoryFromIndex(const QModelIndex &index) const; - int userCategory(IrcUser *) const; - - public slots: - void setIrcChannel(IrcChannel *); - void addUser(IrcUser *); - void removeUser(IrcUser *); - void removeUser(const QModelIndex &); - void renameUser(IrcUser *); - void changeUserModes(IrcUser *); - - private: - - IrcChannel *_ircChannel; - QVector > users; - + NickModel(NetworkModel *parent = 0); }; #endif