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>
34 #include <QSystemTrayIcon>
37 #include "sessionsettings.h"
38 #include "titlesetter.h"
40 class ActionCollection;
42 class BufferViewConfig;
43 class ClientBufferViewConfig;
47 class MsgProcessorStatusWidget;
57 //!\brief The main window of Quassel's QtUi.
60 : public KMainWindow {
62 : public QMainWindow {
67 MainWin(QWidget *parent = 0);
72 void addBufferView(ClientBufferViewConfig *config);
73 BufferView *allBuffersView() const;
75 inline SystemTray *systemTray() const;
77 bool event(QEvent *event);
79 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
80 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
83 void saveStateToSession(const QString &sessionId);
84 void saveStateToSessionSettings(SessionSettings &s);
85 void showStatusBarMessage(const QString &message);
87 void toggleMinimizedToTray();
89 //! Bring window to front and focus it
90 void forceActivated();
93 void closeEvent(QCloseEvent *event);
94 void changeEvent(QEvent *event);
97 void connectedToCore();
98 void setConnectedState();
99 void updateLagIndicator(int lag = -1);
100 void disconnectedFromCore();
101 void setDisconnectedState();
104 void addBufferView(int bufferViewConfigId);
105 void awayLogDestroyed();
106 void removeBufferView(int bufferViewConfigId);
107 void messagesInserted(const QModelIndex &parent, int start, int end);
109 void showChannelList(NetworkId netId = NetworkId());
110 void startInternalCore();
111 void showCoreConnectionDlg(bool autoConnect = false);
112 void showCoreInfoDlg();
114 void showSettingsDlg();
115 void showNotificationsDlg();
117 void showShortcutsDlg();
119 void on_actionConfigureNetworks_triggered();
120 void on_actionConfigureViews_triggered();
121 void on_actionLockLayout_toggled(bool lock);
122 void on_actionDebugNetworkModel_triggered();
123 void on_actionDebugBufferViewOverlay_triggered();
124 void on_actionDebugMessageModel_triggered();
125 void on_actionDebugLog_triggered();
127 void clientNetworkCreated(NetworkId);
128 void clientNetworkRemoved(NetworkId);
129 void clientNetworkUpdated();
130 void connectOrDisconnectFromNet();
132 void saveStatusBarStatus(bool enabled);
137 void bufferViewToggled(bool enabled);
140 void connectToCore(const QVariantMap &connInfo);
141 void disconnectFromCore();
145 KHelpMenu *_kHelpMenu;
148 QLabel *coreLagLabel;
150 MsgProcessorStatusWidget *msgProcessorStatusWidget;
152 TitleSetter _titleSetter;
155 void setupBufferWidget();
157 void setupNickWidget();
158 void setupChatMonitor();
159 void setupInputWidget();
160 void setupTopicWidget();
161 void setupStatusBar();
163 void setupTitleSetter();
164 void setupToolBars();
171 SystemTray *_systemTray;
173 QList<BufferViewDock *> _bufferViews;
174 BufferWidget *_bufferWidget;
175 NickListWidget *_nickListWidget;
176 InputWidget *_inputWidget;
178 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
180 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
190 SystemTray *MainWin::systemTray() const {