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;
42 class BufferViewConfig;
43 class ClientBufferViewConfig;
47 class MsgProcessorStatusWidget;
57 //!\brief The main window of Quassel's QtUi.
60 : public KMainWindow {
62 : public QMainWindow {
67 MainWin(QWidget *parent = 0);
72 void addBufferView(ClientBufferViewConfig *config);
73 BufferView *allBuffersView() const;
75 inline SystemTray *systemTray() const;
77 bool event(QEvent *event);
79 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
80 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
82 void saveStateToSettings(UiSettings &);
83 void restoreStateFromSettings(UiSettings &);
86 void saveStateToSession(const QString &sessionId);
87 void saveStateToSessionSettings(SessionSettings &s);
88 void showStatusBarMessage(const QString &message);
90 void toggleMinimizedToTray();
92 //! Bring window to front and focus it
93 void forceActivated();
96 void closeEvent(QCloseEvent *event);
97 void changeEvent(QEvent *event);
98 void moveEvent(QMoveEvent *event);
99 void resizeEvent(QResizeEvent *event);
102 void connectedToCore();
103 void setConnectedState();
104 void updateLagIndicator(int lag = -1);
105 void disconnectedFromCore();
106 void setDisconnectedState();
109 void addBufferView(int bufferViewConfigId);
110 void awayLogDestroyed();
111 void removeBufferView(int bufferViewConfigId);
112 void messagesInserted(const QModelIndex &parent, int start, int end);
114 void showChannelList(NetworkId netId = NetworkId());
115 void startInternalCore();
116 void showCoreConnectionDlg(bool autoConnect = false);
117 void showCoreInfoDlg();
119 void showSettingsDlg();
120 void showNotificationsDlg();
122 void showShortcutsDlg();
124 void on_actionConfigureNetworks_triggered();
125 void on_actionConfigureViews_triggered();
126 void on_actionLockLayout_toggled(bool lock);
127 void on_actionDebugNetworkModel_triggered();
128 void on_actionDebugMessageModel_triggered();
129 void on_actionDebugLog_triggered();
131 void clientNetworkCreated(NetworkId);
132 void clientNetworkRemoved(NetworkId);
133 void clientNetworkUpdated();
134 void connectOrDisconnectFromNet();
136 void saveStatusBarStatus(bool enabled);
143 void connectToCore(const QVariantMap &connInfo);
144 void disconnectFromCore();
148 KHelpMenu *_kHelpMenu;
151 QLabel *coreLagLabel;
153 MsgProcessorStatusWidget *msgProcessorStatusWidget;
155 TitleSetter _titleSetter;
158 void setupBufferWidget();
160 void setupNickWidget();
161 void setupChatMonitor();
162 void setupInputWidget();
163 void setupTopicWidget();
164 void setupStatusBar();
166 void setupTitleSetter();
167 void setupToolBars();
174 SystemTray *_systemTray;
176 QList<BufferViewDock *> _bufferViews;
177 BufferWidget *_bufferWidget;
178 NickListWidget *_nickListWidget;
179 InputWidget *_inputWidget;
181 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
183 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
187 QSize _normalSize; //!< Size of the non-maximized window
188 QPoint _normalPos; //!< Position of the non-maximized window
198 SystemTray *MainWin::systemTray() const {