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>
35 #include "titlesetter.h"
36 #include "uisettings.h"
38 class ActionCollection;
39 class BufferHotListFilter;
41 class BufferViewConfig;
42 class ClientBufferViewConfig;
44 class CoreConnectionStatusWidget;
48 class MsgProcessorStatusWidget;
51 class ChatMonitorView;
59 //!\brief The main window of Quassel's QtUi.
62 : public KMainWindow {
64 : public QMainWindow {
69 MainWin(QWidget *parent = 0);
74 void addBufferView(ClientBufferViewConfig *config);
75 BufferView *allBuffersView() const;
77 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
79 #ifndef QT_NO_SYSTEMTRAYICON
80 inline SystemTray *systemTray() const { return _systemTray; }
83 bool event(QEvent *event);
85 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
86 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
88 void saveStateToSettings(UiSettings &);
89 void restoreStateFromSettings(UiSettings &);
92 void showStatusBarMessage(const QString &message);
94 #ifndef QT_NO_SYSTEMTRAYICON
95 void toggleMinimizedToTray();
98 //! Bring window to front and focus it
99 void forceActivated();
105 void closeEvent(QCloseEvent *event);
106 void changeEvent(QEvent *event);
107 void moveEvent(QMoveEvent *event);
108 void resizeEvent(QResizeEvent *event);
111 void connectedToCore();
112 void setConnectedState();
113 void disconnectedFromCore();
114 void setDisconnectedState();
117 void addBufferView(int bufferViewConfigId);
118 void awayLogDestroyed();
119 void removeBufferView(int bufferViewConfigId);
120 void currentBufferChanged(BufferId);
121 void messagesInserted(const QModelIndex &parent, int start, int end);
123 void showChannelList(NetworkId netId = NetworkId());
124 void showCoreConnectionDlg();
125 void showCoreConfigWizard(const QVariantList &);
126 void showCoreInfoDlg();
128 void showSettingsDlg();
129 void showNotificationsDlg();
130 void showIgnoreList(QString newRule = QString());
132 void showShortcutsDlg();
134 void handleCoreConnectionError(const QString &errorMsg);
135 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
136 void handleNoSslInClient(bool *accepted);
137 void handleNoSslInCore(bool *accepted);
139 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
142 void on_actionConfigureNetworks_triggered();
143 void on_actionConfigureViews_triggered();
144 void on_actionLockLayout_toggled(bool lock);
145 void on_jumpHotBuffer_triggered();
146 void on_actionDebugNetworkModel_triggered();
147 void on_actionDebugBufferViewOverlay_triggered();
148 void on_actionDebugMessageModel_triggered();
149 void on_actionDebugHotList_triggered();
150 void on_actionDebugLog_triggered();
152 void clientNetworkCreated(NetworkId);
153 void clientNetworkRemoved(NetworkId);
154 void clientNetworkUpdated();
155 void connectOrDisconnectFromNet();
157 void saveMenuBarStatus(bool enabled);
158 void saveStatusBarStatus(bool enabled);
163 void bufferViewToggled(bool enabled);
166 void connectToCore(const QVariantMap &connInfo);
167 void disconnectFromCore();
171 KHelpMenu *_kHelpMenu;
174 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
175 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
177 TitleSetter _titleSetter;
180 void setupBufferWidget();
182 void setupNickWidget();
183 void setupChatMonitor();
184 void setupInputWidget();
185 void setupTopicWidget();
186 void setupStatusBar();
188 void setupTitleSetter();
189 void setupToolBars();
195 #ifndef QT_NO_SYSTEMTRAYICON
197 SystemTray *_systemTray;
200 QList<BufferViewDock *> _bufferViews;
201 BufferWidget *_bufferWidget;
202 NickListWidget *_nickListWidget;
203 InputWidget *_inputWidget;
204 ChatMonitorView *_chatMonitorView;
206 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
208 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
214 QSize _normalSize; //!< Size of the non-maximized window
215 QPoint _normalPos; //!< Position of the non-maximized window
221 BufferHotListFilter *_bufferHotList;