1 /***************************************************************************
2 * Copyright (C) 2005-2016 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 ***************************************************************************/
26 # include <KMainWindow>
27 #elif defined HAVE_KF5
28 # include <KXmlGui/KMainWindow>
30 # include <QMainWindow>
34 #include "titlesetter.h"
35 #include "uisettings.h"
37 class ActionCollection;
38 class BufferHotListFilter;
40 class BufferViewConfig;
41 class ChatMonitorView;
42 class ClientBufferViewConfig;
44 class CoreConnectionStatusWidget;
48 class MsgProcessorStatusWidget;
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;
76 BufferView *activeBufferView() const;
78 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
79 inline SystemTray *systemTray() const { return _systemTray; }
81 bool event(QEvent *event);
83 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
84 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
86 void saveStateToSettings(UiSettings &);
87 void restoreStateFromSettings(UiSettings &);
90 void showStatusBarMessage(const QString &message);
91 void hideCurrentBuffer();
92 void nextBufferView(); //!< Activate the next bufferview
93 void previousBufferView(); //!< Activate the previous bufferview
95 void previousBuffer();
101 void closeEvent(QCloseEvent *event);
102 void moveEvent(QMoveEvent *event);
103 void resizeEvent(QResizeEvent *event);
106 void connectedToCore();
107 void setConnectedState();
108 void disconnectedFromCore();
109 void setDisconnectedState();
112 void addBufferView(int bufferViewConfigId);
113 void awayLogDestroyed();
114 void removeBufferView(int bufferViewConfigId);
115 void currentBufferChanged(BufferId);
116 void messagesInserted(const QModelIndex &parent, int start, int end);
118 void showChannelList(NetworkId netId = NetworkId());
119 void showCoreConnectionDlg();
120 void showCoreConfigWizard(const QVariantList &);
121 void showCoreInfoDlg();
123 void showSettingsDlg();
124 void showNotificationsDlg();
125 void showIgnoreList(QString newRule = QString());
126 void showShortcutsDlg();
127 void showPasswordChangeDlg();
128 void showNewTransferDlg(const QUuid &transferId);
129 void onFullScreenToggled();
131 void handleCoreConnectionError(const QString &errorMsg);
132 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
133 void handleNoSslInClient(bool *accepted);
134 void handleNoSslInCore(bool *accepted);
136 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
139 void on_actionConfigureNetworks_triggered();
140 void on_actionConfigureViews_triggered();
141 void on_actionLockLayout_toggled(bool lock);
142 void on_jumpHotBuffer_triggered();
143 void on_actionDebugNetworkModel_triggered();
144 void on_actionDebugBufferViewOverlay_triggered();
145 void on_actionDebugMessageModel_triggered();
146 void on_actionDebugHotList_triggered();
147 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);
159 void saveMainToolBarStatus(bool enabled);
164 void bufferViewToggled(bool enabled);
165 void bufferViewVisibilityChanged(bool visible);
166 void changeActiveBufferView(bool backwards);
167 void changeActiveBufferView(int bufferViewId);
170 void connectToCore(const QVariantMap &connInfo);
171 void disconnectFromCore();
175 KHelpMenu *_kHelpMenu;
178 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
179 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
180 SystemTray *_systemTray;
182 TitleSetter _titleSetter;
185 void setupBufferWidget();
187 void setupNickWidget();
188 void setupChatMonitor();
189 void setupInputWidget();
190 void setupTopicWidget();
191 void setupViewMenuTail();
192 void setupStatusBar();
194 void setupTitleSetter();
195 void setupToolBars();
201 QList<BufferViewDock *> _bufferViews;
202 BufferWidget *_bufferWidget;
203 NickListWidget *_nickListWidget;
204 InputWidget *_inputWidget;
205 ChatMonitorView *_chatMonitorView;
206 TopicWidget *_topicWidget;
208 QAction *_fullScreenAction;
209 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
211 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
217 QSize _normalSize; //!< Size of the non-maximized window
218 QPoint _normalPos; //!< Position of the non-maximized window
220 BufferHotListFilter *_bufferHotList;
221 QHash<int, BufferId> _jumpKeyMap;
222 int _activeBufferViewIndex;