/***************************************************************************
- * 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 *
#include "ui_bufferwidget.h"
+#include "abstractitemview.h"
#include "chatview.h"
#include "types.h"
-class Buffer;
+class Network;
class ChatView;
class ChatWidget;
-class LayoutThread;
+
+#include "buffermodel.h"
//! Displays the contents of a Buffer.
/**
*/
-class BufferWidget : public QWidget {
+class BufferWidget : public AbstractItemView {
Q_OBJECT
public:
virtual ~BufferWidget();
void init();
- QSize sizeHint() const;
-
-signals:
- void userInput(QString msg);
- void aboutToClose();
-
-public slots:
- void setBuffer(Buffer *);
- void saveState();
+ inline BufferId currentBuffer() const { return _currentBuffer; }
+
+protected slots:
+ virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
+ virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
private slots:
- void enterPressed();
- void setActive(bool act = true);
- void bufferDestroyed(QObject *);
-
+ void removeBuffer(BufferId bufferId);
+ void setCurrentBuffer(BufferId bufferId);
private:
Ui::BufferWidget ui;
- //QHash<BufferId, ChatView*> _chatViews;
- QHash<Buffer *, ChatWidget *> _chatWidgets;
- bool active;
+ QHash<BufferId, ChatWidget *> _chatWidgets;
+ QHash<BufferId, ChatView *> _chatViews;
- QString _networkName;
- QString _bufferName;
+ BufferId _currentBuffer;
};
-
#endif