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;
50 //!\brief The main window of Quassel's QtUi.
53 : public KMainWindow {
55 : public QMainWindow {
60 MainWin(QWidget *parent = 0);
65 void addBufferView(BufferViewConfig *config = 0);
66 BufferView *allBuffersView() const;
68 inline QSystemTrayIcon *systemTrayIcon() const;
70 virtual bool event(QEvent *event);
72 void saveStateToSession(const QString &sessionId);
73 void saveStateToSessionSettings(SessionSettings &s);
74 void showStatusBarMessage(const QString &message);
77 void closeEvent(QCloseEvent *event);
78 virtual void changeEvent(QEvent *event);
81 void connectedToCore();
82 void setConnectedState();
83 void updateLagIndicator(int lag);
84 void securedConnection();
85 void disconnectedFromCore();
86 void setDisconnectedState();
87 void systrayActivated(QSystemTrayIcon::ActivationReason);
90 void addBufferView(int bufferViewConfigId);
91 void removeBufferView(int bufferViewConfigId);
92 void messagesInserted(const QModelIndex &parent, int start, int end);
94 void showChannelList(NetworkId netId = NetworkId());
95 void showCoreConnectionDlg(bool autoConnect = false);
96 void showCoreInfoDlg();
97 void showSettingsDlg();
98 void showNotificationsDlg();
100 void showShortcutsDlg();
102 void on_actionConfigureNetworks_triggered();
103 void on_actionConfigureViews_triggered();
104 void on_actionLockDockPositions_toggled(bool lock);
105 void on_actionDebugNetworkModel_triggered();
106 void on_actionDebugMessageModel_triggered();
107 void on_actionDebugLog_triggered();
109 void clientNetworkCreated(NetworkId);
110 void clientNetworkRemoved(NetworkId);
111 void clientNetworkUpdated();
112 void connectOrDisconnectFromNet();
114 void saveStatusBarStatus(bool enabled);
120 void connectToCore(const QVariantMap &connInfo);
121 void disconnectFromCore();
125 KHelpMenu *_kHelpMenu;
129 QLabel *coreLagLabel;
131 MsgProcessorStatusWidget *msgProcessorStatusWidget;
133 TitleSetter _titleSetter;
136 void setupBufferWidget();
139 void setupNickWidget();
140 void setupChatMonitor();
141 void setupInputWidget();
142 void setupTopicWidget();
143 void setupStatusBar();
145 void setupTitleSetter();
148 void toggleVisibility();
151 QSystemTrayIcon *_trayIcon;
153 QList<BufferViewDock *> _bufferViews;
154 BufferWidget *_bufferWidget;
155 NickListWidget *_nickListWidget;
157 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
162 QSystemTrayIcon *MainWin::systemTrayIcon() const {