1 /***************************************************************************
2 * Copyright (C) 2005-2014 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;
41 class CoreConnectionStatusWidget;
45 class MsgProcessorStatusWidget;
48 class ChatMonitorView;
57 //!\brief The main window of Quassel's QtUi.
63 : public QMainWindow {
68 MainWin(QWidget *parent = 0);
73 void addBufferView(ClientBufferViewConfig *config);
74 BufferView *allBuffersView() const;
75 BufferView *activeBufferView() const;
77 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
78 inline SystemTray *systemTray() const { return _systemTray; }
80 bool event(QEvent *event);
82 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
83 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
85 void saveStateToSettings(UiSettings &);
86 void restoreStateFromSettings(UiSettings &);
89 void showStatusBarMessage(const QString &message);
90 void hideCurrentBuffer();
91 void nextBufferView(); //!< Activate the next bufferview
92 void previousBufferView(); //!< Activate the previous bufferview
94 void previousBuffer();
100 void closeEvent(QCloseEvent *event);
101 void moveEvent(QMoveEvent *event);
102 void resizeEvent(QResizeEvent *event);
105 void connectedToCore();
106 void setConnectedState();
107 void disconnectedFromCore();
108 void setDisconnectedState();
111 void addBufferView(int bufferViewConfigId);
112 void awayLogDestroyed();
113 void removeBufferView(int bufferViewConfigId);
114 void currentBufferChanged(BufferId);
115 void messagesInserted(const QModelIndex &parent, int start, int end);
117 void showChannelList(NetworkId netId = NetworkId());
118 void showCoreConnectionDlg();
119 void showCoreConfigWizard(const QVariantList &);
120 void showCoreInfoDlg();
122 void showSettingsDlg();
123 void showNotificationsDlg();
124 void showIgnoreList(QString newRule = QString());
125 void showShortcutsDlg();
126 void showNewTransferDlg(const ClientTransfer *transfer);
127 void onFullScreenToggled();
129 void handleCoreConnectionError(const QString &errorMsg);
130 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
131 void handleNoSslInClient(bool *accepted);
132 void handleNoSslInCore(bool *accepted);
134 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
137 void on_actionConfigureNetworks_triggered();
138 void on_actionConfigureViews_triggered();
139 void on_actionLockLayout_toggled(bool lock);
140 void on_jumpHotBuffer_triggered();
141 void on_actionDebugNetworkModel_triggered();
142 void on_actionDebugBufferViewOverlay_triggered();
143 void on_actionDebugMessageModel_triggered();
144 void on_actionDebugHotList_triggered();
145 void on_actionDebugLog_triggered();
150 void clientNetworkCreated(NetworkId);
151 void clientNetworkRemoved(NetworkId);
152 void clientNetworkUpdated();
153 void connectOrDisconnectFromNet();
155 void saveMenuBarStatus(bool enabled);
156 void saveStatusBarStatus(bool enabled);
161 void bufferViewToggled(bool enabled);
162 void bufferViewVisibilityChanged(bool visible);
163 void changeActiveBufferView(bool backwards);
164 void changeActiveBufferView(int bufferViewId);
167 void connectToCore(const QVariantMap &connInfo);
168 void disconnectFromCore();
172 KHelpMenu *_kHelpMenu;
175 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
176 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
177 SystemTray *_systemTray;
179 TitleSetter _titleSetter;
182 void setupBufferWidget();
184 void setupNickWidget();
185 void setupChatMonitor();
186 void setupInputWidget();
187 void setupTopicWidget();
188 void setupViewMenuTail();
189 void setupStatusBar();
191 void setupTitleSetter();
192 void setupToolBars();
198 QList<BufferViewDock *> _bufferViews;
199 BufferWidget *_bufferWidget;
200 NickListWidget *_nickListWidget;
201 InputWidget *_inputWidget;
202 ChatMonitorView *_chatMonitorView;
203 TopicWidget *_topicWidget;
205 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
207 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
213 QSize _normalSize; //!< Size of the non-maximized window
214 QPoint _normalPos; //!< Position of the non-maximized window
216 BufferHotListFilter *_bufferHotList;
217 QHash<int, BufferId> _jumpKeyMap;
218 int _activeBufferViewIndex;