1 /***************************************************************************
2 * Copyright (C) 2005-09 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;
39 class ClientBufferViewConfig;
43 class MsgProcessorStatusWidget;
53 //!\brief The main window of Quassel's QtUi.
56 : public KMainWindow {
58 : public QMainWindow {
63 MainWin(QWidget *parent = 0);
68 void addBufferView(ClientBufferViewConfig *config);
69 BufferView *allBuffersView() const;
71 inline SystemTray *systemTray() const;
73 virtual bool event(QEvent *event);
75 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
76 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
79 void saveStateToSession(const QString &sessionId);
80 void saveStateToSessionSettings(SessionSettings &s);
81 void showStatusBarMessage(const QString &message);
84 void closeEvent(QCloseEvent *event);
85 virtual void changeEvent(QEvent *event);
88 void connectedToCore();
89 void setConnectedState();
90 void updateLagIndicator(int lag = -1);
91 void disconnectedFromCore();
92 void setDisconnectedState();
93 void systrayActivated(QSystemTrayIcon::ActivationReason);
96 void addBufferView(int bufferViewConfigId);
97 void awayLogDestroyed();
98 void removeBufferView(int bufferViewConfigId);
99 void messagesInserted(const QModelIndex &parent, int start, int end);
101 void showChannelList(NetworkId netId = NetworkId());
102 void startInternalCore();
103 void showCoreConnectionDlg(bool autoConnect = false);
104 void showCoreInfoDlg();
106 void showSettingsDlg();
107 void showNotificationsDlg();
109 void showShortcutsDlg();
111 void on_actionConfigureNetworks_triggered();
112 void on_actionConfigureViews_triggered();
113 void on_actionLockLayout_toggled(bool lock);
114 void on_actionDebugNetworkModel_triggered();
115 void on_actionDebugMessageModel_triggered();
116 void on_actionDebugLog_triggered();
118 void clientNetworkCreated(NetworkId);
119 void clientNetworkRemoved(NetworkId);
120 void clientNetworkUpdated();
121 void connectOrDisconnectFromNet();
123 void saveStatusBarStatus(bool enabled);
129 void connectToCore(const QVariantMap &connInfo);
130 void disconnectFromCore();
134 KHelpMenu *_kHelpMenu;
137 QLabel *coreLagLabel;
139 MsgProcessorStatusWidget *msgProcessorStatusWidget;
141 TitleSetter _titleSetter;
144 void setupBufferWidget();
146 void setupNickWidget();
147 void setupChatMonitor();
148 void setupInputWidget();
149 void setupTopicWidget();
150 void setupStatusBar();
152 void setupTitleSetter();
153 void setupToolBars();
157 void toggleMinimizedToTray();
160 SystemTray *_systemTray;
162 QList<BufferViewDock *> _bufferViews;
163 BufferWidget *_bufferWidget;
164 NickListWidget *_nickListWidget;
165 InputWidget *_inputWidget;
167 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
169 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
175 SystemTray *MainWin::systemTray() const {