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;
48 class MsgProcessorStatusWidget;
58 //!\brief The main window of Quassel's QtUi.
61 : public KMainWindow {
63 : public QMainWindow {
68 MainWin(QWidget *parent = 0);
73 void addBufferView(ClientBufferViewConfig *config);
74 BufferView *allBuffersView() const;
76 BufferWidget *bufferWidget() const { return _bufferWidget; }
78 inline SystemTray *systemTray() const;
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);
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 updateLagIndicator(int lag = -1);
109 void disconnectedFromCore();
110 void setDisconnectedState();
113 void addBufferView(int bufferViewConfigId);
114 void awayLogDestroyed();
115 void removeBufferView(int bufferViewConfigId);
116 void currentBufferChanged(BufferId);
117 void messagesInserted(const QModelIndex &parent, int start, int end);
119 void showChannelList(NetworkId netId = NetworkId());
120 void startInternalCore();
121 void showCoreConnectionDlg(bool autoConnect = false);
122 void showCoreInfoDlg();
124 void showSettingsDlg();
125 void showNotificationsDlg();
126 void showIgnoreList(QString newRule = QString());
128 void showShortcutsDlg();
130 void on_actionConfigureNetworks_triggered();
131 void on_actionConfigureViews_triggered();
132 void on_actionLockLayout_toggled(bool lock);
133 void on_jumpHotBuffer_triggered();
134 void on_actionDebugNetworkModel_triggered();
135 void on_actionDebugBufferViewOverlay_triggered();
136 void on_actionDebugMessageModel_triggered();
137 void on_actionDebugHotList_triggered();
138 void on_actionDebugLog_triggered();
140 void clientNetworkCreated(NetworkId);
141 void clientNetworkRemoved(NetworkId);
142 void clientNetworkUpdated();
143 void connectOrDisconnectFromNet();
145 void saveMenuBarStatus(bool enabled);
146 void saveStatusBarStatus(bool enabled);
151 void bufferViewToggled(bool enabled);
154 void connectToCore(const QVariantMap &connInfo);
155 void disconnectFromCore();
159 KHelpMenu *_kHelpMenu;
162 QLabel *coreLagLabel;
164 MsgProcessorStatusWidget *msgProcessorStatusWidget;
166 TitleSetter _titleSetter;
169 void setupBufferWidget();
171 void setupNickWidget();
172 void setupChatMonitor();
173 void setupInputWidget();
174 void setupTopicWidget();
175 void setupStatusBar();
177 void setupTitleSetter();
178 void setupToolBars();
186 SystemTray *_systemTray;
188 QList<BufferViewDock *> _bufferViews;
189 BufferWidget *_bufferWidget;
190 NickListWidget *_nickListWidget;
191 InputWidget *_inputWidget;
193 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
195 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
199 QSize _normalSize; //!< Size of the non-maximized window
200 QPoint _normalPos; //!< Position of the non-maximized window
206 BufferHotListFilter *_bufferHotList;
211 SystemTray *MainWin::systemTray() const {