YES! We finally have dynamic signals between Core and Client, meaning that arbitrary
[quassel.git] / src / qtgui / mainwin.h
index 15852a8..f522449 100644 (file)
 #ifndef _MAINWIN_H_
 #define _MAINWIN_H_
 
-#include <QtGui>
 #include "ui_mainwin.h"
 
-#include "quasselui.h"
-//#include "global.h"
-#include "message.h"
-#include "chatwidget.h"
+#include "qtgui.h"
 #include "bufferviewfilter.h"
-#include "bufferviewwidget.h"
 
 class ServerListDlg;
 class CoreConnectDlg;
-//class BufferViewDock;
 class Buffer;
-class BufferWidget;
 class SettingsDlg;
+class QtGui;
+class Message;
 
-//!\brief The main window and central object of Quassel GUI.
-/** In addition to displaying the main window including standard stuff like a menubar,
- * dockwidgets and of course the chat window, this class also stores all data it
- * receives from the core, and it maintains a list of all known nicks.
- */
-class MainWin : public QMainWindow, public AbstractUi {
+//!\brief The main window of Quassel's QtGui.
+class MainWin : public QMainWindow {
   Q_OBJECT
 
   public:
-    MainWin();
-    ~MainWin();
+    MainWin(QtGui *gui, QWidget *parent = 0);
+    virtual ~MainWin();
 
     void init();
-    void registerBufferViewDock(BufferViewDock *);
+    void addBufferView(const QString &, QAbstractItemModel *, const BufferViewFilter::Modes &, const QStringList &);
 
     AbstractUiMsg *layoutMsg(const Message &);
 
   protected:
     void closeEvent(QCloseEvent *event);
 
-    //void importOldBacklog();
+  protected slots:
+    void connectedToCore();
+    void disconnectedFromCore();
 
   private slots:
 
     void showServerList();
     void showSettingsDlg();
+    void showCoreConnectionDlg(bool autoConnect = false);
+    void coreConnectionDlgFinished(int result);
 
     void showBuffer(BufferId);
     void showBuffer(Buffer *);
@@ -71,15 +66,21 @@ class MainWin : public QMainWindow, public AbstractUi {
     void importBacklog();
 
   signals:
+    void connectToCore(const QVariantMap &connInfo);
+    void disconnectFromCore();
+    void requestBacklog(BufferId, QVariant, QVariant);
     void importOldBacklog();
 
   private:
     Ui::MainWin ui;
+    QtGui *gui;
 
     void setupMenus();
     void setupViews();
     void setupSettingsDlg();
 
+    void enableMenus();
+
     QSystemTrayIcon *systray;
 
     ServerListDlg *serverListDlg;
@@ -87,9 +88,11 @@ class MainWin : public QMainWindow, public AbstractUi {
     SettingsDlg *settingsDlg;
 
     uint currentBuffer;
+    QString currentProfile;
 
-    QList<BufferViewDock *> netViews;
+    QList<QDockWidget *> netViews;
 
+    friend class QtGui;
 };
 
 #endif