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;
42 class MsgProcessorStatusWidget;
51 //!\brief The main window of Quassel's QtUi.
54 : public KMainWindow {
56 : public QMainWindow {
61 MainWin(QWidget *parent = 0);
66 void addBufferView(BufferViewConfig *config);
67 BufferView *allBuffersView() const;
69 inline QSystemTrayIcon *systemTrayIcon() const;
70 inline BufferWidget *bufferWidget() const;
72 virtual bool event(QEvent *event);
74 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
75 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
78 void saveStateToSession(const QString &sessionId);
79 void saveStateToSessionSettings(SessionSettings &s);
80 void showStatusBarMessage(const QString &message);
83 void closeEvent(QCloseEvent *event);
84 virtual void changeEvent(QEvent *event);
87 void connectedToCore();
88 void setConnectedState();
89 void updateLagIndicator(int lag);
90 void securedConnection();
91 void disconnectedFromCore();
92 void setDisconnectedState();
93 void systrayActivated(QSystemTrayIcon::ActivationReason);
96 void addBufferView(int bufferViewConfigId);
97 void removeBufferView(int bufferViewConfigId);
98 void messagesInserted(const QModelIndex &parent, int start, int end);
100 void showChannelList(NetworkId netId = NetworkId());
101 void startInternalCore();
102 void showCoreConnectionDlg(bool autoConnect = false);
103 void showCoreInfoDlg();
104 void showSettingsDlg();
105 void showNotificationsDlg();
107 void showShortcutsDlg();
109 void on_actionConfigureNetworks_triggered();
110 void on_actionConfigureViews_triggered();
111 void on_actionLockDockPositions_toggled(bool lock);
112 void on_actionDebugNetworkModel_triggered();
113 void on_actionDebugMessageModel_triggered();
114 void on_actionDebugLog_triggered();
116 void clientNetworkCreated(NetworkId);
117 void clientNetworkRemoved(NetworkId);
118 void clientNetworkUpdated();
119 void connectOrDisconnectFromNet();
121 void saveStatusBarStatus(bool enabled);
127 void connectToCore(const QVariantMap &connInfo);
128 void disconnectFromCore();
132 KHelpMenu *_kHelpMenu;
136 QLabel *coreLagLabel;
138 MsgProcessorStatusWidget *msgProcessorStatusWidget;
140 TitleSetter _titleSetter;
143 void setupBufferWidget();
145 void setupNickWidget();
146 void setupChatMonitor();
147 void setupInputWidget();
148 void setupTopicWidget();
149 void setupStatusBar();
151 void setupTitleSetter();
154 void toggleVisibility();
157 QSystemTrayIcon *_trayIcon;
159 QList<BufferViewDock *> _bufferViews;
160 BufferWidget *_bufferWidget;
161 NickListWidget *_nickListWidget;
162 InputWidget *_inputWidget;
164 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
169 QSystemTrayIcon *MainWin::systemTrayIcon() const {
173 BufferWidget *MainWin::bufferWidget() const {
174 return _bufferWidget;