adding tons of ifdefs so quassel will build again without ssl support
[quassel.git] / src / qtui / mainwin.h
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel Project                          *
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 <QMainWindow>
25 #include <QSystemTrayIcon>
26
27 #include "qtui.h"
28 #include "sessionsettings.h"
29 #include "titlesetter.h"
30
31 class ActionCollection;
32 class BufferView;
33 class BufferViewConfig;
34 class BufferViewDock;
35 class BufferWidget;
36 class MsgProcessorStatusWidget;
37 class NickListWidget;
38 class SystemTrayIcon;
39
40 class QMenu;
41 class QLabel;
42
43 //!\brief The main window of Quassel's QtUi.
44 class MainWin : public QMainWindow {
45   Q_OBJECT
46
47   public:
48     MainWin(QWidget *parent = 0);
49     virtual ~MainWin();
50
51     void init();
52
53     void addBufferView(BufferViewConfig *config = 0);
54     BufferView *allBuffersView() const;
55
56     inline QSystemTrayIcon *systemTrayIcon() const;
57
58     virtual bool event(QEvent *event);
59   public slots:
60     void saveStateToSession(const QString &sessionId);
61     void saveStateToSessionSettings(SessionSettings &s);
62     void showStatusBarMessage(const QString &message);
63
64   protected:
65     void closeEvent(QCloseEvent *event);
66     virtual void changeEvent(QEvent *event);
67
68   protected slots:
69     void connectedToCore();
70     void setConnectedState();
71     void updateLagIndicator(int lag);
72     void securedConnection();
73     void disconnectedFromCore();
74     void setDisconnectedState();
75     void systrayActivated(QSystemTrayIcon::ActivationReason);
76
77   private slots:
78     void addBufferView(int bufferViewConfigId);
79     void removeBufferView(int bufferViewConfigId);
80     void messagesInserted(const QModelIndex &parent, int start, int end);
81     void showAboutDlg();
82     void showChannelList(NetworkId netId = NetworkId());
83     void showCoreConnectionDlg(bool autoConnect = false);
84     void showCoreInfoDlg();
85     void showSettingsDlg();
86     void on_actionEditNetworks_triggered();
87     void on_actionManageViews_triggered();
88     void on_actionLockDockPositions_toggled(bool lock);
89     void on_actionDebugNetworkModel_triggered();
90     void on_actionDebugMessageModel_triggered();
91     void on_actionDebugLog_triggered();
92
93     void clientNetworkCreated(NetworkId);
94     void clientNetworkRemoved(NetworkId);
95     void clientNetworkUpdated();
96     void connectOrDisconnectFromNet();
97
98     void saveStatusBarStatus(bool enabled);
99
100     void loadLayout();
101     void saveLayout();
102
103   signals:
104     void connectToCore(const QVariantMap &connInfo);
105     void disconnectFromCore();
106
107   private:
108
109     QMenu *systrayMenu;
110     QLabel *coreLagLabel;
111     QLabel *sslLabel;
112     MsgProcessorStatusWidget *msgProcessorStatusWidget;
113
114     TitleSetter _titleSetter;
115
116     void setupActions();
117     void setupBufferWidget();
118     void setupMenus();
119     void setupViews();
120     void setupNickWidget();
121     void setupChatMonitor();
122     void setupInputWidget();
123     void setupTopicWidget();
124     void setupStatusBar();
125     void setupSystray();
126     void setupTitleSetter();
127
128     void updateIcon();
129     void toggleVisibility();
130     void enableMenus();
131
132     QSystemTrayIcon *_trayIcon;
133
134     QList<BufferViewDock *> _bufferViews;
135     BufferWidget *_bufferWidget;
136     NickListWidget *_nickListWidget;
137
138     QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
139
140     friend class QtUi;
141 };
142
143 QSystemTrayIcon *MainWin::systemTrayIcon() const {
144   return _trayIcon;
145 }
146
147 #endif