Cleanupination/Prettyfication/Refactorination of the BufferModel
[quassel.git] / src / qtui / 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 "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
36 //!\brief The main window of Quassel's QtUi.
37 class MainWin : public QMainWindow {
38   Q_OBJECT
39
40   public:
41     MainWin(QtUi *gui, QWidget *parent = 0);
42     virtual ~MainWin();
43
44     void init();
45     void addBufferView(const QString &, QAbstractItemModel *, const BufferViewFilter::Modes &, const QList<uint> &);
46
47     AbstractUiMsg *layoutMsg(const Message &);
48
49   protected:
50     void closeEvent(QCloseEvent *event);
51
52   protected slots:
53     void connectedToCore();
54     void disconnectedFromCore();
55
56   private slots:
57
58     void showServerList();
59     void showSettingsDlg();
60     void showCoreConnectionDlg(bool autoConnect = false);
61     void coreConnectionDlgFinished(int result);
62
63     void showBuffer(BufferInfo);
64     void showBuffer(Buffer *);
65
66     void importBacklog();
67
68   signals:
69     void connectToCore(const QVariantMap &connInfo);
70     void disconnectFromCore();
71     void requestBacklog(BufferInfo, QVariant, QVariant);
72     void importOldBacklog();
73
74   private:
75     Ui::MainWin ui;
76     QtUi *gui;
77
78     void setupMenus();
79     void setupViews();
80     void setupSettingsDlg();
81
82     void enableMenus();
83
84     QSystemTrayIcon *systray;
85
86     ServerListDlg *serverListDlg;
87     CoreConnectDlg *coreConnectDlg;
88     SettingsDlg *settingsDlg;
89
90     uint currentBuffer;
91     QString currentProfile;
92
93     QList<QDockWidget *> netViews;
94
95     friend class QtUi;
96 };
97
98 #endif