* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef _BUFFERVIEW_H_
-#define _BUFFERVIEW_H_
+#ifndef _BUFFERVIEWWIDGET_H_
+#define _BUFFERVIEWWIDGET_H_
#include <QtGui>
#include <QtCore>
-#include "clientproxy.h"
-#include "buffer.h"
-#include "ui_bufferviewwidget.h"
+#include "bufferviewfilter.h"
#include "bufferview.h"
-
-/*****************************************
- * general item used in the Tree Model
- *****************************************/
-class TreeItem {
-public:
- TreeItem(QList<QVariant> &data, TreeItem *parent = 0);
- TreeItem(TreeItem *parent = 0);
- virtual ~TreeItem();
-
- void appendChild(TreeItem *child);
- void removeChild(int row);
-
- TreeItem *child(int row);
- int childCount() const;
- int columnCount() const;
- virtual QVariant data(int column, int role) const;
- int row() const;
- TreeItem *parent();
-
- void setForeground(QColor);
-
-private:
- QList<TreeItem*> childItems;
- TreeItem *parentItem;
- QList<QVariant> itemData;
-
- QColor foreground;
-};
-
-
-/*****************************************
- * Fancy Buffer Items
- *****************************************/
-class BufferTreeItem : public TreeItem{
-public:
- BufferTreeItem(Buffer *, TreeItem *parent = 0);
- QVariant data(int column, int role) const;
- Buffer *buffer() const { return buf; }
- void setActivity(const Buffer::ActivityLevel &);
-
-private:
- QString text(int column) const;
- QColor foreground(int column) const;
- Buffer *buf;
- Buffer::ActivityLevel activity;
-};
-
-
-/*****************************************
- * BufferTreeModel
- *****************************************/
-class BufferTreeModel : public QAbstractItemModel {
- Q_OBJECT
-
-public:
- enum myRoles {
- BufferTypeRole = Qt::UserRole,
- BufferActiveRole
- };
-
-
- BufferTreeModel(QObject *parent = 0);
- ~BufferTreeModel();
-
- QVariant data(const QModelIndex &index, int role) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
- void clearActivity(Buffer *buffer);
-
-public slots:
- void bufferUpdated(Buffer *);
- void changeCurrent(const QModelIndex &, const QModelIndex &);
- void selectBuffer(Buffer *buffer);
- void doubleClickReceived(const QModelIndex &);
- void bufferActivity(Buffer::ActivityLevel, Buffer *buffer);
-
-signals:
- void bufferSelected(Buffer *);
- void invalidateFilter();
- void fakeUserInput(BufferId, QString);
- void updateSelection(const QModelIndex &, QItemSelectionModel::SelectionFlags);
-
-private:
- bool isBufferIndex(const QModelIndex &) const;
- Buffer *getBufferByIndex(const QModelIndex &) const;
- QModelIndex getOrCreateNetworkItemIndex(Buffer *buffer);
- QModelIndex getOrCreateBufferItemIndex(Buffer *buffer);
-
- bool removeRow(int row, const QModelIndex &parent = QModelIndex());
-
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &) const;
- bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &);
- TreeItem *rootItem;
-
- QHash<QString, TreeItem*> networkItem;
- QHash<Buffer *, BufferTreeItem*> bufferItem;
- Buffer *currentBuffer;
-};
-
-
+#include "ui_bufferviewwidget.h"
/*****************************************
private:
Ui::BufferViewWidget ui;
-
};