1 /***************************************************************************
2 * Copyright (C) 2005-2013 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
25 # include <KMainWindow>
27 # include <QMainWindow>
31 #include "titlesetter.h"
32 #include "uisettings.h"
34 class ActionCollection;
35 class BufferHotListFilter;
37 class BufferViewConfig;
38 class ClientBufferViewConfig;
40 class CoreConnectionStatusWidget;
44 class MsgProcessorStatusWidget;
47 class ChatMonitorView;
56 //!\brief The main window of Quassel's QtUi.
62 : public QMainWindow {
67 MainWin(QWidget *parent = 0);
72 void addBufferView(ClientBufferViewConfig *config);
73 BufferView *allBuffersView() const;
74 BufferView *activeBufferView() const;
76 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
77 inline SystemTray *systemTray() const { return _systemTray; }
79 bool event(QEvent *event);
81 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
82 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
84 void saveStateToSettings(UiSettings &);
85 void restoreStateFromSettings(UiSettings &);
88 void showStatusBarMessage(const QString &message);
89 void hideCurrentBuffer();
90 void nextBufferView(); //!< Activate the next bufferview
91 void previousBufferView(); //!< Activate the previous bufferview
93 void previousBuffer();
99 void closeEvent(QCloseEvent *event);
100 void moveEvent(QMoveEvent *event);
101 void resizeEvent(QResizeEvent *event);
104 void connectedToCore();
105 void setConnectedState();
106 void disconnectedFromCore();
107 void setDisconnectedState();
110 void addBufferView(int bufferViewConfigId);
111 void awayLogDestroyed();
112 void removeBufferView(int bufferViewConfigId);
113 void currentBufferChanged(BufferId);
114 void messagesInserted(const QModelIndex &parent, int start, int end);
116 void showChannelList(NetworkId netId = NetworkId());
117 void showCoreConnectionDlg();
118 void showCoreConfigWizard(const QVariantList &);
119 void showCoreInfoDlg();
121 void showSettingsDlg();
122 void showNotificationsDlg();
123 void showIgnoreList(QString newRule = QString());
124 void showShortcutsDlg();
125 void toggleFullscreen();
127 void handleCoreConnectionError(const QString &errorMsg);
128 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
129 void handleNoSslInClient(bool *accepted);
130 void handleNoSslInCore(bool *accepted);
132 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
135 void on_actionConfigureNetworks_triggered();
136 void on_actionConfigureViews_triggered();
137 void on_actionLockLayout_toggled(bool lock);
138 void on_jumpHotBuffer_triggered();
139 void on_actionDebugNetworkModel_triggered();
140 void on_actionDebugBufferViewOverlay_triggered();
141 void on_actionDebugMessageModel_triggered();
142 void on_actionDebugHotList_triggered();
143 void on_actionDebugLog_triggered();
148 void clientNetworkCreated(NetworkId);
149 void clientNetworkRemoved(NetworkId);
150 void clientNetworkUpdated();
151 void connectOrDisconnectFromNet();
153 void saveMenuBarStatus(bool enabled);
154 void saveStatusBarStatus(bool enabled);
159 void bufferViewToggled(bool enabled);
160 void bufferViewVisibilityChanged(bool visible);
161 void changeActiveBufferView(bool backwards);
162 void changeActiveBufferView(int bufferViewId);
165 void connectToCore(const QVariantMap &connInfo);
166 void disconnectFromCore();
170 KHelpMenu *_kHelpMenu;
173 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
174 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
175 SystemTray *_systemTray;
177 TitleSetter _titleSetter;
180 void setupBufferWidget();
182 void setupNickWidget();
183 void setupChatMonitor();
184 void setupInputWidget();
185 void setupTopicWidget();
186 void setupViewMenuTail();
187 void setupStatusBar();
189 void setupTitleSetter();
190 void setupToolBars();
196 QList<BufferViewDock *> _bufferViews;
197 BufferWidget *_bufferWidget;
198 NickListWidget *_nickListWidget;
199 InputWidget *_inputWidget;
200 ChatMonitorView *_chatMonitorView;
201 TopicWidget *_topicWidget;
203 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
205 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
211 QSize _normalSize; //!< Size of the non-maximized window
212 QPoint _normalPos; //!< Position of the non-maximized window
214 BufferHotListFilter *_bufferHotList;
215 QHash<int, BufferId> _jumpKeyMap;
216 int _activeBufferViewIndex;