0559b4e08bfae85fccdab3141090ebfb711ecff2
[quassel.git] / src / qtui / mainwin.h
1 /***************************************************************************
2  *   Copyright (C) 2005-07 by the Quassel IRC 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) version 3.                                           *
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 "ui_mainwin.h"
25
26 #include "qtui.h"
27 #include "bufferviewfilter.h"
28
29 class ServerListDlg;
30 class CoreConnectDlg;
31 class Buffer;
32 class SettingsDlg;
33 class QtUi;
34 class Message;
35 class NickListWidget;
36
37 class DebugConsole;
38
39 //!\brief The main window of Quassel's QtUi.
40 class MainWin : public QMainWindow {
41   Q_OBJECT
42
43   public:
44     MainWin(QtUi *gui, QWidget *parent = 0);
45     virtual ~MainWin();
46
47     void init();
48     void addBufferView(const QString &, QAbstractItemModel *, const BufferViewFilter::Modes &, const QList<uint> &);
49
50     AbstractUiMsg *layoutMsg(const Message &);
51
52   protected:
53     void closeEvent(QCloseEvent *event);
54
55   protected slots:
56     void connectedToCore();
57     void disconnectedFromCore();
58
59   private slots:
60
61     void showServerList();
62     void showSettingsDlg();
63     void showDebugConsole();
64     void showCoreConnectionDlg(bool autoConnect = false);
65     void coreConnectionDlgFinished(int result);
66
67     void showBuffer(BufferInfo);
68     void showBuffer(Buffer *);
69
70   signals:
71     void connectToCore(const QVariantMap &connInfo);
72     void disconnectFromCore();
73     void requestBacklog(BufferInfo, QVariant, QVariant);
74
75   private:
76     Ui::MainWin ui;
77     QtUi *gui;
78
79     void setupMenus();
80     void setupViews();
81     void setupSettingsDlg();
82
83     void enableMenus();
84
85     QSystemTrayIcon *systray;
86
87     ServerListDlg *serverListDlg;
88     CoreConnectDlg *coreConnectDlg;
89     SettingsDlg *settingsDlg;
90
91     uint currentBuffer;
92     QString currentProfile;
93
94     QList<QDockWidget *> netViews;
95     QDockWidget *nickDock;
96     NickListWidget *nickListWidget;
97
98     DebugConsole *debugConsole;
99     friend class QtUi;
100 };
101
102 #endif