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;
45 class CoreConnectionStatusWidget;
49 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;
77 BufferWidget *bufferWidget() const { return _bufferWidget; }
79 inline SystemTray *systemTray() const;
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);
92 void toggleMinimizedToTray();
94 //! Bring window to front and focus it
95 void forceActivated();
101 void closeEvent(QCloseEvent *event);
102 void changeEvent(QEvent *event);
103 void moveEvent(QMoveEvent *event);
104 void resizeEvent(QResizeEvent *event);
107 void connectedToCore();
108 void setConnectedState();
109 void updateLagIndicator(int lag = -1);
110 void disconnectedFromCore();
111 void setDisconnectedState();
114 void addBufferView(int bufferViewConfigId);
115 void awayLogDestroyed();
116 void removeBufferView(int bufferViewConfigId);
117 void currentBufferChanged(BufferId);
118 void messagesInserted(const QModelIndex &parent, int start, int end);
120 void showChannelList(NetworkId netId = NetworkId());
121 void startInternalCore();
122 void showCoreConnectionDlg();
123 void showCoreInfoDlg();
125 void showSettingsDlg();
126 void showNotificationsDlg();
127 void showIgnoreList(QString newRule = QString());
129 void showShortcutsDlg();
131 void on_actionConfigureNetworks_triggered();
132 void on_actionConfigureViews_triggered();
133 void on_actionLockLayout_toggled(bool lock);
134 void on_jumpHotBuffer_triggered();
135 void on_actionDebugNetworkModel_triggered();
136 void on_actionDebugBufferViewOverlay_triggered();
137 void on_actionDebugMessageModel_triggered();
138 void on_actionDebugHotList_triggered();
139 void on_actionDebugLog_triggered();
141 void clientNetworkCreated(NetworkId);
142 void clientNetworkRemoved(NetworkId);
143 void clientNetworkUpdated();
144 void connectOrDisconnectFromNet();
146 void saveMenuBarStatus(bool enabled);
147 void saveStatusBarStatus(bool enabled);
152 void bufferViewToggled(bool enabled);
155 void connectToCore(const QVariantMap &connInfo);
156 void disconnectFromCore();
160 KHelpMenu *_kHelpMenu;
163 QLabel *coreLagLabel;
165 MsgProcessorStatusWidget *_msgProcessorStatusWidget;
166 CoreConnectionStatusWidget *_coreConnectionStatusWidget;
168 TitleSetter _titleSetter;
171 void setupBufferWidget();
173 void setupNickWidget();
174 void setupChatMonitor();
175 void setupInputWidget();
176 void setupTopicWidget();
177 void setupStatusBar();
179 void setupTitleSetter();
180 void setupToolBars();
188 SystemTray *_systemTray;
190 QList<BufferViewDock *> _bufferViews;
191 BufferWidget *_bufferWidget;
192 NickListWidget *_nickListWidget;
193 InputWidget *_inputWidget;
195 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
197 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
203 QSize _normalSize; //!< Size of the non-maximized window
204 QPoint _normalPos; //!< Position of the non-maximized window
210 BufferHotListFilter *_bufferHotList;
215 SystemTray *MainWin::systemTray() const {