Removing deprecated notification cruft from MainWin
[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 "ui_mainwin.h"
25
26 #include "qtui.h"
27 #include "titlesetter.h"
28 #include "sessionsettings.h"
29
30 #include <QPixmap>
31 #include <QSystemTrayIcon>
32 #include <QTimer>
33
34 class ActionCollection;
35 class Buffer;
36 class BufferViewConfig;
37 class MsgProcessorStatusWidget;
38 class Message;
39 class NickListWidget;
40 class SystemTrayIcon;
41
42 //!\brief The main window of Quassel's QtUi.
43 class MainWin : public QMainWindow {
44   Q_OBJECT
45
46   public:
47     MainWin(QWidget *parent = 0);
48     virtual ~MainWin();
49
50     void init();
51
52     void addBufferView(BufferViewConfig *config = 0);
53
54     inline QSystemTrayIcon *systemTrayIcon() const;
55
56     virtual bool event(QEvent *event);
57   public slots:
58     void saveStateToSession(const QString &sessionId);
59     void saveStateToSessionSettings(SessionSettings &s);
60
61   protected:
62     void closeEvent(QCloseEvent *event);
63     virtual void changeEvent(QEvent *event);
64
65   protected slots:
66     void connectedToCore();
67     void setConnectedState();
68     void updateLagIndicator(int lag);
69     void securedConnection();
70     void disconnectedFromCore();
71     void setDisconnectedState();
72     void systrayActivated(QSystemTrayIcon::ActivationReason);
73
74   private slots:
75     void addBufferView(int bufferViewConfigId);
76     void removeBufferView(int bufferViewConfigId);
77     void messagesInserted(const QModelIndex &parent, int start, int end);
78     void showAboutDlg();
79     void showChannelList(NetworkId netId = NetworkId());
80     void showCoreConnectionDlg(bool autoConnect = false);
81     void showCoreInfoDlg();
82     void showSettingsDlg();
83     void on_actionEditNetworks_triggered();
84     void on_actionManageViews_triggered();
85     void on_actionLockDockPositions_toggled(bool lock);
86     void on_actionDebugNetworkModel_triggered(bool);
87
88     void clientNetworkCreated(NetworkId);
89     void clientNetworkRemoved(NetworkId);
90     void clientNetworkUpdated();
91     void connectOrDisconnectFromNet();
92
93     void saveStatusBarStatus(bool enabled);
94
95     void loadLayout();
96     void saveLayout();
97
98   signals:
99     void connectToCore(const QVariantMap &connInfo);
100     void disconnectFromCore();
101
102   private:
103     Ui::MainWin ui;
104
105     QMenu *systrayMenu;
106     QLabel *coreLagLabel;
107     QLabel *sslLabel;
108     MsgProcessorStatusWidget *msgProcessorStatusWidget;
109
110     TitleSetter _titleSetter;
111
112     void setupActions();
113     void setupMenus();
114     void setupViews();
115     void setupNickWidget();
116     void setupChatMonitor();
117     void setupInputWidget();
118     void setupTopicWidget();
119     void setupStatusBar();
120     void setupSystray();
121
122     void toggleVisibility();
123     void enableMenus();
124
125     QSystemTrayIcon *_trayIcon;
126     QPixmap activeTrayIcon;
127     QPixmap onlineTrayIcon;
128     QPixmap offlineTrayIcon;
129
130     BufferId currentBuffer;
131     QString currentProfile;
132
133     QList<QDockWidget *> _netViews;
134     NickListWidget *nickListWidget;
135
136     ActionCollection *_actionCollection;
137
138     friend class QtUi;
139 };
140
141 QSystemTrayIcon *MainWin::systemTrayIcon() const {
142   return _trayIcon;
143 }
144
145 #endif