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>
34 #include <QSystemTrayIcon>
37 #include "titlesetter.h"
38 #include "uisettings.h"
40 class ActionCollection;
41 class BufferHotListFilter;
43 class BufferViewConfig;
44 class ClientBufferViewConfig;
46 class CoreConnectionStatusWidget;
50 class MsgProcessorStatusWidget;
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 BufferWidget *bufferWidget() const { return _bufferWidget; }
80 inline SystemTray *systemTray() const;
82 bool event(QEvent *event);
84 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
85 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
87 void saveStateToSettings(UiSettings &);
88 void restoreStateFromSettings(UiSettings &);
91 void showStatusBarMessage(const QString &message);
93 void toggleMinimizedToTray();
95 //! Bring window to front and focus it
96 void forceActivated();
102 void closeEvent(QCloseEvent *event);
103 void changeEvent(QEvent *event);
104 void moveEvent(QMoveEvent *event);
105 void resizeEvent(QResizeEvent *event);
108 void connectedToCore();
109 void setConnectedState();
110 void updateLagIndicator(int lag = -1);
111 void disconnectedFromCore();
112 void setDisconnectedState();
115 void addBufferView(int bufferViewConfigId);
116 void awayLogDestroyed();
117 void removeBufferView(int bufferViewConfigId);
118 void currentBufferChanged(BufferId);
119 void messagesInserted(const QModelIndex &parent, int start, int end);
121 void showChannelList(NetworkId netId = NetworkId());
122 void startInternalCore();
123 void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage);
124 void showCoreConnectionDlg();
125 void showCoreInfoDlg();
127 void showSettingsDlg();
128 void showNotificationsDlg();
129 void showIgnoreList(QString newRule = QString());
131 void showShortcutsDlg();
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();
143 void clientNetworkCreated(NetworkId);
144 void clientNetworkRemoved(NetworkId);
145 void clientNetworkUpdated();
146 void connectOrDisconnectFromNet();
148 void saveMenuBarStatus(bool enabled);
149 void saveStatusBarStatus(bool enabled);
154 void bufferViewToggled(bool enabled);
157 void connectToCore(const QVariantMap &connInfo);
158 void disconnectFromCore();
162 KHelpMenu *_kHelpMenu;
165 QLabel *coreLagLabel;
167 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
168 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
170 TitleSetter _titleSetter;
173 void setupBufferWidget();
175 void setupNickWidget();
176 void setupChatMonitor();
177 void setupInputWidget();
178 void setupTopicWidget();
179 void setupStatusBar();
181 void setupTitleSetter();
182 void setupToolBars();
190 SystemTray *_systemTray;
192 QList<BufferViewDock *> _bufferViews;
193 BufferWidget *_bufferWidget;
194 NickListWidget *_nickListWidget;
195 InputWidget *_inputWidget;
197 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
199 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
205 QSize _normalSize; //!< Size of the non-maximized window
206 QPoint _normalPos; //!< Position of the non-maximized window
212 BufferHotListFilter *_bufferHotList;
217 SystemTray *MainWin::systemTray() const {