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>
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.
59 : public KMainWindow {
61 : public QMainWindow {
66 MainWin(QWidget *parent = 0);
71 void addBufferView(ClientBufferViewConfig *config);
72 BufferView *allBuffersView() const;
73 BufferView *activeBufferView() const;
75 inline BufferWidget *bufferWidget() const { return _bufferWidget; }
76 inline SystemTray *systemTray() const { return _systemTray; }
78 bool event(QEvent *event);
80 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
81 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
83 void saveStateToSettings(UiSettings &);
84 void restoreStateFromSettings(UiSettings &);
87 void showStatusBarMessage(const QString &message);
88 void nextBufferView(); //!< Activate the next bufferview
89 void previousBufferView(); //!< Activate the previous bufferview
91 void previousBuffer();
97 void closeEvent(QCloseEvent *event);
98 void moveEvent(QMoveEvent *event);
99 void resizeEvent(QResizeEvent *event);
102 void connectedToCore();
103 void setConnectedState();
104 void disconnectedFromCore();
105 void setDisconnectedState();
108 void addBufferView(int bufferViewConfigId);
109 void awayLogDestroyed();
110 void removeBufferView(int bufferViewConfigId);
111 void currentBufferChanged(BufferId);
112 void messagesInserted(const QModelIndex &parent, int start, int end);
114 void showChannelList(NetworkId netId = NetworkId());
115 void showCoreConnectionDlg();
116 void showCoreConfigWizard(const QVariantList &);
117 void showCoreInfoDlg();
119 void showSettingsDlg();
120 void showNotificationsDlg();
121 void showIgnoreList(QString newRule = QString());
122 void showShortcutsDlg();
123 void toggleFullscreen();
125 void handleCoreConnectionError(const QString &errorMsg);
126 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
127 void handleNoSslInClient(bool *accepted);
128 void handleNoSslInCore(bool *accepted);
130 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
133 void on_actionConfigureNetworks_triggered();
134 void on_actionConfigureViews_triggered();
135 void on_actionLockLayout_toggled(bool lock);
136 void on_jumpHotBuffer_triggered();
137 void on_actionDebugNetworkModel_triggered();
138 void on_actionDebugBufferViewOverlay_triggered();
139 void on_actionDebugMessageModel_triggered();
140 void on_actionDebugHotList_triggered();
141 void on_actionDebugLog_triggered();
146 void clientNetworkCreated(NetworkId);
147 void clientNetworkRemoved(NetworkId);
148 void clientNetworkUpdated();
149 void connectOrDisconnectFromNet();
151 void saveMenuBarStatus(bool enabled);
152 void saveStatusBarStatus(bool enabled);
157 void bufferViewToggled(bool enabled);
158 void bufferViewVisibilityChanged(bool visible);
159 void changeActiveBufferView(bool backwards);
160 void changeActiveBufferView(int bufferViewId);
163 void connectToCore(const QVariantMap &connInfo);
164 void disconnectFromCore();
168 KHelpMenu *_kHelpMenu;
171 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
172 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
173 SystemTray *_systemTray;
175 TitleSetter _titleSetter;
178 void setupBufferWidget();
180 void setupNickWidget();
181 void setupChatMonitor();
182 void setupInputWidget();
183 void setupTopicWidget();
184 void setupViewMenuTail();
185 void setupStatusBar();
187 void setupTitleSetter();
188 void setupToolBars();
194 QList<BufferViewDock *> _bufferViews;
195 BufferWidget *_bufferWidget;
196 NickListWidget *_nickListWidget;
197 InputWidget *_inputWidget;
198 ChatMonitorView *_chatMonitorView;
199 TopicWidget *_topicWidget;
201 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
203 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
209 QSize _normalSize; //!< Size of the non-maximized window
210 QPoint _normalPos; //!< Position of the non-maximized window
212 BufferHotListFilter *_bufferHotList;
213 QHash<int, BufferId> _jumpKeyMap;
214 int _activeBufferViewIndex;