Still working on the authentification stuff. Technically, now even in the monolithic...
[quassel.git] / src / qtgui / mainwin.h
1 /***************************************************************************
2  *   Copyright (C) 2005-07 by The Quassel Team                             *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #ifndef _MAINWIN_H_
22 #define _MAINWIN_H_
23
24 #include <QtGui>
25 #include "ui_mainwin.h"
26
27 //#include "global.h"
28 #include "message.h"
29 #include "chatwidget.h"
30 #include "bufferviewfilter.h"
31 #include "bufferview.h"
32
33 class ServerListDlg;
34 class CoreConnectDlg;
35 class Buffer;
36 class SettingsDlg;
37 class MainWin;
38
39 class QtGui : public AbstractUi {
40   Q_OBJECT
41
42   public:
43     QtGui();
44     ~QtGui();
45     void init();
46     AbstractUiMsg *layoutMsg(const Message &);
47
48   protected slots:
49     void connectedToCore();
50     void disconnectedFromCore();
51
52   private:
53     MainWin *mainWin;
54 };
55
56
57 //!\brief The main window of Quassel's QtGui.
58 class MainWin : public QMainWindow {
59   Q_OBJECT
60
61   public:
62     MainWin(QtGui *gui, QWidget *parent = 0);
63     virtual ~MainWin();
64
65     void init();
66     void addBufferView(const QString &, QAbstractItemModel *, const BufferViewFilter::Modes &, const QStringList &);
67
68     AbstractUiMsg *layoutMsg(const Message &);
69
70   protected:
71     void closeEvent(QCloseEvent *event);
72
73   protected slots:
74     void connectedToCore();
75     void disconnectedFromCore();
76
77   private slots:
78
79     void showServerList();
80     void showSettingsDlg();
81
82     void showBuffer(BufferId);
83     void showBuffer(Buffer *);
84
85     void importBacklog();
86
87   signals:
88     void connectToCore(const VarMap &connInfo);
89     void disconnectFromCore();
90     void requestBacklog(BufferId, QVariant, QVariant);
91     void importOldBacklog();
92
93   private:
94     Ui::MainWin ui;
95     QtGui *gui;
96
97     void setupMenus();
98     void setupViews();
99     void setupSettingsDlg();
100
101     void enableMenus();
102
103     QSystemTrayIcon *systray;
104
105     ServerListDlg *serverListDlg;
106     CoreConnectDlg *coreConnectDlg;
107     SettingsDlg *settingsDlg;
108
109     uint currentBuffer;
110
111     QList<QDockWidget *> netViews;
112
113     friend class QtGui;
114 };
115
116 #endif