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;
58 //!\brief The main window of Quassel's QtUi.
61 : public KMainWindow {
63 : public QMainWindow {
68 MainWin(QWidget *parent = 0);
73 void addBufferView(ClientBufferViewConfig *config);
74 BufferView *allBuffersView() const;
76 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
78 #ifndef QT_NO_SYSTEMTRAYICON
79 inline SystemTray *systemTray() const { return _systemTray; }
82 bool event(QEvent *event);
84 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
85 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
87 void saveStateToSettings(UiSettings &);
88 void restoreStateFromSettings(UiSettings &);
91 void showStatusBarMessage(const QString &message);
93 #ifndef QT_NO_SYSTEMTRAYICON
94 void toggleMinimizedToTray();
97 //! Bring window to front and focus it
98 void forceActivated();
104 void closeEvent(QCloseEvent *event);
105 void changeEvent(QEvent *event);
106 void moveEvent(QMoveEvent *event);
107 void resizeEvent(QResizeEvent *event);
110 void connectedToCore();
111 void setConnectedState();
112 void disconnectedFromCore();
113 void setDisconnectedState();
116 void addBufferView(int bufferViewConfigId);
117 void awayLogDestroyed();
118 void removeBufferView(int bufferViewConfigId);
119 void currentBufferChanged(BufferId);
120 void messagesInserted(const QModelIndex &parent, int start, int end);
122 void showChannelList(NetworkId netId = NetworkId());
123 void showCoreConnectionDlg();
124 void showCoreConfigWizard(const QVariantList &);
125 void showCoreInfoDlg();
127 void showSettingsDlg();
128 void showNotificationsDlg();
129 void showIgnoreList(QString newRule = QString());
131 void showShortcutsDlg();
133 void handleCoreConnectionError(const QString &errorMsg);
134 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
135 void handleNoSslInClient(bool *accepted);
136 void handleNoSslInCore(bool *accepted);
138 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
141 void on_actionConfigureNetworks_triggered();
142 void on_actionConfigureViews_triggered();
143 void on_actionLockLayout_toggled(bool lock);
144 void on_jumpHotBuffer_triggered();
145 void on_actionDebugNetworkModel_triggered();
146 void on_actionDebugBufferViewOverlay_triggered();
147 void on_actionDebugMessageModel_triggered();
148 void on_actionDebugHotList_triggered();
149 void on_actionDebugLog_triggered();
151 void clientNetworkCreated(NetworkId);
152 void clientNetworkRemoved(NetworkId);
153 void clientNetworkUpdated();
154 void connectOrDisconnectFromNet();
156 void saveMenuBarStatus(bool enabled);
157 void saveStatusBarStatus(bool enabled);
162 void bufferViewToggled(bool enabled);
165 void connectToCore(const QVariantMap &connInfo);
166 void disconnectFromCore();
170 KHelpMenu *_kHelpMenu;
173 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
174 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
176 TitleSetter _titleSetter;
179 void setupBufferWidget();
181 void setupNickWidget();
182 void setupChatMonitor();
183 void setupInputWidget();
184 void setupTopicWidget();
185 void setupStatusBar();
187 void setupTitleSetter();
188 void setupToolBars();
194 #ifndef QT_NO_SYSTEMTRAYICON
196 SystemTray *_systemTray;
199 QList<BufferViewDock *> _bufferViews;
200 BufferWidget *_bufferWidget;
201 NickListWidget *_nickListWidget;
202 InputWidget *_inputWidget;
204 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
206 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
212 QSize _normalSize; //!< Size of the non-maximized window
213 QPoint _normalPos; //!< Position of the non-maximized window
219 BufferHotListFilter *_bufferHotList;