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;
60 //!\brief The main window of Quassel's QtUi.
63 : public KMainWindow {
65 : public QMainWindow {
70 MainWin(QWidget *parent = 0);
75 void addBufferView(ClientBufferViewConfig *config);
76 BufferView *allBuffersView() const;
78 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
80 #ifndef QT_NO_SYSTEMTRAYICON
81 inline SystemTray *systemTray() const { return _systemTray; }
84 bool event(QEvent *event);
86 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
87 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
89 void saveStateToSettings(UiSettings &);
90 void restoreStateFromSettings(UiSettings &);
93 void showStatusBarMessage(const QString &message);
95 #ifndef QT_NO_SYSTEMTRAYICON
96 void toggleMinimizedToTray();
99 //! Bring window to front and focus it
100 void forceActivated();
106 void closeEvent(QCloseEvent *event);
107 void changeEvent(QEvent *event);
108 void moveEvent(QMoveEvent *event);
109 void resizeEvent(QResizeEvent *event);
112 void connectedToCore();
113 void setConnectedState();
114 void disconnectedFromCore();
115 void setDisconnectedState();
118 void addBufferView(int bufferViewConfigId);
119 void awayLogDestroyed();
120 void removeBufferView(int bufferViewConfigId);
121 void currentBufferChanged(BufferId);
122 void messagesInserted(const QModelIndex &parent, int start, int end);
124 void showChannelList(NetworkId netId = NetworkId());
125 void showCoreConnectionDlg();
126 void showCoreConfigWizard(const QVariantList &);
127 void showCoreInfoDlg();
129 void showSettingsDlg();
130 void showNotificationsDlg();
131 void showIgnoreList(QString newRule = QString());
133 void showShortcutsDlg();
135 void handleCoreConnectionError(const QString &errorMsg);
136 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
137 void handleNoSslInClient(bool *accepted);
138 void handleNoSslInCore(bool *accepted);
140 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
143 void on_actionConfigureNetworks_triggered();
144 void on_actionConfigureViews_triggered();
145 void on_actionLockLayout_toggled(bool lock);
146 void on_jumpHotBuffer_triggered();
147 void on_actionDebugNetworkModel_triggered();
148 void on_actionDebugBufferViewOverlay_triggered();
149 void on_actionDebugMessageModel_triggered();
150 void on_actionDebugHotList_triggered();
151 void on_actionDebugLog_triggered();
153 void clientNetworkCreated(NetworkId);
154 void clientNetworkRemoved(NetworkId);
155 void clientNetworkUpdated();
156 void connectOrDisconnectFromNet();
158 void saveMenuBarStatus(bool enabled);
159 void saveStatusBarStatus(bool enabled);
164 void bufferViewToggled(bool enabled);
167 void connectToCore(const QVariantMap &connInfo);
168 void disconnectFromCore();
172 KHelpMenu *_kHelpMenu;
175 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
176 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
178 TitleSetter _titleSetter;
181 void setupBufferWidget();
183 void setupNickWidget();
184 void setupChatMonitor();
185 void setupInputWidget();
186 void setupTopicWidget();
187 void setupStatusBar();
189 void setupTitleSetter();
190 void setupToolBars();
196 #ifndef QT_NO_SYSTEMTRAYICON
198 SystemTray *_systemTray;
201 QList<BufferViewDock *> _bufferViews;
202 BufferWidget *_bufferWidget;
203 NickListWidget *_nickListWidget;
204 InputWidget *_inputWidget;
205 ChatMonitorView *_chatMonitorView;
206 TopicWidget *_topicWidget;
208 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
210 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
216 QSize _normalSize; //!< Size of the non-maximized window
217 QPoint _normalPos; //!< Position of the non-maximized window
223 BufferHotListFilter *_bufferHotList;