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 "titlesetter.h"
38 #include "uisettings.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_actionDebugMessageModel_triggered();
124 void on_actionDebugLog_triggered();
126 void clientNetworkCreated(NetworkId);
127 void clientNetworkRemoved(NetworkId);
128 void clientNetworkUpdated();
129 void connectOrDisconnectFromNet();
131 void saveStatusBarStatus(bool enabled);
137 void connectToCore(const QVariantMap &connInfo);
138 void disconnectFromCore();
142 KHelpMenu *_kHelpMenu;
145 QLabel *coreLagLabel;
147 MsgProcessorStatusWidget *msgProcessorStatusWidget;
149 TitleSetter _titleSetter;
152 void setupBufferWidget();
154 void setupNickWidget();
155 void setupChatMonitor();
156 void setupInputWidget();
157 void setupTopicWidget();
158 void setupStatusBar();
160 void setupTitleSetter();
161 void setupToolBars();
168 SystemTray *_systemTray;
170 QList<BufferViewDock *> _bufferViews;
171 BufferWidget *_bufferWidget;
172 NickListWidget *_nickListWidget;
173 InputWidget *_inputWidget;
175 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
177 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
187 SystemTray *MainWin::systemTray() const {