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; }
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 toggleMinimizedToTray();
93 //! Bring window to front and focus it
94 void forceActivated();
100 void closeEvent(QCloseEvent *event);
101 void changeEvent(QEvent *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());
127 void showShortcutsDlg();
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();
147 void clientNetworkCreated(NetworkId);
148 void clientNetworkRemoved(NetworkId);
149 void clientNetworkUpdated();
150 void connectOrDisconnectFromNet();
152 void saveMenuBarStatus(bool enabled);
153 void saveStatusBarStatus(bool enabled);
158 void bufferViewToggled(bool enabled);
161 void connectToCore(const QVariantMap &connInfo);
162 void disconnectFromCore();
166 KHelpMenu *_kHelpMenu;
169 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
170 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
171 SystemTray *_systemTray;
173 TitleSetter _titleSetter;
176 void setupBufferWidget();
178 void setupNickWidget();
179 void setupChatMonitor();
180 void setupInputWidget();
181 void setupTopicWidget();
182 void setupStatusBar();
184 void setupTitleSetter();
185 void setupToolBars();
193 QList<BufferViewDock *> _bufferViews;
194 BufferWidget *_bufferWidget;
195 NickListWidget *_nickListWidget;
196 InputWidget *_inputWidget;
197 ChatMonitorView *_chatMonitorView;
198 TopicWidget *_topicWidget;
200 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
202 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
208 QSize _normalSize; //!< Size of the non-maximized window
209 QPoint _normalPos; //!< Position of the non-maximized window
215 BufferHotListFilter *_bufferHotList;