X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.h;h=07fec1bf9ada37493e3ccd79202c695424d93ced;hb=5d321588ac2c292e217e2f77a3016912f29f1b6f;hp=c139ecb42d94cee33504edfd2305541400ac0ba1;hpb=feb8ff0d7dfaebbaeb56450fb33dfb6c4584ba69;p=quassel.git diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index c139ecb4..07fec1bf 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel 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,15 +18,17 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _BUFFERVIEWFILTER_H_ -#define _BUFFERVIEWFILTER_H_ +#ifndef BUFFERVIEWFILTER_H_ +#define BUFFERVIEWFILTER_H_ -#include #include -#include +#include +#include #include -#include "buffer.h" -#include "buffertreemodel.h" +#include + +#include "types.h" +#include "bufferviewconfig.h" /***************************************** * Buffer View Filter @@ -47,30 +49,36 @@ public: }; Q_DECLARE_FLAGS(Modes, Mode); - BufferViewFilter(QAbstractItemModel *model, const Modes &mode, const QList &nets); + BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config = 0); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - + + QVariant data(const QModelIndex &index, int role) const; + QVariant foreground(const QModelIndex &index) const; + + void setConfig(BufferViewConfig *config); + inline BufferViewConfig *config() const { return _config; } + public slots: void removeBuffer(const QModelIndex &); - void invalidateFilter_(); + void source_rowsInserted(const QModelIndex &parent, int start, int end); protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - bool lessThan(const QModelIndex &, const QModelIndex &) const; - + bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + bool bufferLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + bool networkLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + private: - Modes mode; - QSet networks; - QSet buffers; + QPointer _config; bool filterAcceptBuffer(const QModelIndex &) const; bool filterAcceptNetwork(const QModelIndex &) const; - void addBuffer(const uint &); - + void addBuffer(const BufferId &); }; Q_DECLARE_OPERATORS_FOR_FLAGS(BufferViewFilter::Modes) -#endif +bool bufferIdLessThan(const BufferId &, const BufferId &); +#endif // BUFFERVIEWFILTER_H_