1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel Project *
3 * devel@quassel-irc.org *
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. *
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. *
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 ***************************************************************************/
25 # include <KMainWindow>
27 # include <QMainWindow>
30 #include <QSystemTrayIcon>
33 #include "sessionsettings.h"
34 #include "titlesetter.h"
36 class ActionCollection;
38 class BufferViewConfig;
41 class MsgProcessorStatusWidget;
48 //!\brief The main window of Quassel's QtUi.
51 : public KMainWindow {
53 : public QMainWindow {
58 MainWin(QWidget *parent = 0);
63 void addBufferView(BufferViewConfig *config = 0);
64 BufferView *allBuffersView() const;
66 inline QSystemTrayIcon *systemTrayIcon() const;
68 virtual bool event(QEvent *event);
70 void saveStateToSession(const QString &sessionId);
71 void saveStateToSessionSettings(SessionSettings &s);
72 void showStatusBarMessage(const QString &message);
75 void closeEvent(QCloseEvent *event);
76 virtual void changeEvent(QEvent *event);
79 void connectedToCore();
80 void setConnectedState();
81 void updateLagIndicator(int lag);
82 void securedConnection();
83 void disconnectedFromCore();
84 void setDisconnectedState();
85 void systrayActivated(QSystemTrayIcon::ActivationReason);
88 void addBufferView(int bufferViewConfigId);
89 void removeBufferView(int bufferViewConfigId);
90 void messagesInserted(const QModelIndex &parent, int start, int end);
92 void showChannelList(NetworkId netId = NetworkId());
93 void showCoreConnectionDlg(bool autoConnect = false);
94 void showCoreInfoDlg();
95 void showSettingsDlg();
96 void on_actionEditNetworks_triggered();
97 void on_actionManageViews_triggered();
98 void on_actionLockDockPositions_toggled(bool lock);
99 void on_actionDebugNetworkModel_triggered();
100 void on_actionDebugMessageModel_triggered();
101 void on_actionDebugLog_triggered();
103 void clientNetworkCreated(NetworkId);
104 void clientNetworkRemoved(NetworkId);
105 void clientNetworkUpdated();
106 void connectOrDisconnectFromNet();
108 void saveStatusBarStatus(bool enabled);
114 void connectToCore(const QVariantMap &connInfo);
115 void disconnectFromCore();
120 QLabel *coreLagLabel;
122 MsgProcessorStatusWidget *msgProcessorStatusWidget;
124 TitleSetter _titleSetter;
127 void setupBufferWidget();
130 void setupNickWidget();
131 void setupChatMonitor();
132 void setupInputWidget();
133 void setupTopicWidget();
134 void setupStatusBar();
136 void setupTitleSetter();
139 void toggleVisibility();
142 QSystemTrayIcon *_trayIcon;
144 QList<BufferViewDock *> _bufferViews;
145 BufferWidget *_bufferWidget;
146 NickListWidget *_nickListWidget;
148 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
153 QSystemTrayIcon *MainWin::systemTrayIcon() const {