Fix buffer preselection on reconnect
[quassel.git] / src / qtui / nicklistwidget.h
index 1fca5e0..18f966a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef _NICKLISTWIDGET_H_
-#define _NICKLISTWIDGET_H_
+#ifndef NICKLISTWIDGET_H_
+#define NICKLISTWIDGET_H_
 
 #include "ui_nicklistwidget.h"
+#include "abstractitemview.h"
+#include "buffermodel.h"
+
 #include "types.h"
 
 #include <QHash>
-
-#include <QPointer>
-#include <QItemSelectionModel>
-
-#include "buffermodel.h"
+#include <QDockWidget>
 
 class Buffer;
 class NickView;
+class QDockWidget;
 
-class NickListWidget : public QWidget {
+class NickListWidget : public AbstractItemView {
   Q_OBJECT
 
 public:
   NickListWidget(QWidget *parent = 0);
 
-  inline BufferModel *model() { return _bufferModel; }
-  void setModel(BufferModel *bufferModel);
+public slots:
+  void showWidget(bool visible);
 
-  inline QItemSelectionModel *selectionModel() const { return _selectionModel; }
-  void setSelectionModel(QItemSelectionModel *selectionModel);
+signals:
+  void nickSelectionChanged(const QModelIndexList &);
 
 protected:
   virtual QSize sizeHint() const;
+  virtual void hideEvent(QHideEvent *);
+  virtual void showEvent(QShowEvent *);
 
 protected slots:
-//   virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
-//   virtual void commitData(QWidget *editor);
   virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
-//   virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-//   virtual void editorDestroyed(QObject *editor);
   virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
-//   virtual void rowsInserted(const QModelIndex &parent, int start, int end);
-//   virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
 
 private slots:
   void removeBuffer(BufferId bufferId);
-  
+  void nickSelectionChanged();
+
 private:
   Ui::NickListWidget ui;
   QHash<BufferId, NickView *> nickViews;
 
-  QPointer<BufferModel> _bufferModel;
-  QPointer<QItemSelectionModel> _selectionModel;
+  QDockWidget *dock() const;
+};
+
+
+// ==============================
+//  NickList Dock
+// ==============================
+class NickListDock : public QDockWidget {
+  Q_OBJECT
+
+public:
+  NickListDock(const QString &title, QWidget *parent = 0);
+  // ~NickListDock();
+
+  // virtual bool event(QEvent *event);
 };
 
 #endif