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 showStatusBarMessage(const QString &message);
88 void toggleMinimizedToTray();
90 //! Bring window to front and focus it
91 void forceActivated();
94 void closeEvent(QCloseEvent *event);
95 void changeEvent(QEvent *event);
96 void moveEvent(QMoveEvent *event);
97 void resizeEvent(QResizeEvent *event);
100 void connectedToCore();
101 void setConnectedState();
102 void updateLagIndicator(int lag = -1);
103 void disconnectedFromCore();
104 void setDisconnectedState();
107 void addBufferView(int bufferViewConfigId);
108 void awayLogDestroyed();
109 void removeBufferView(int bufferViewConfigId);
110 void messagesInserted(const QModelIndex &parent, int start, int end);
112 void showChannelList(NetworkId netId = NetworkId());
113 void startInternalCore();
114 void showCoreConnectionDlg(bool autoConnect = false);
115 void showCoreInfoDlg();
117 void showSettingsDlg();
118 void showNotificationsDlg();
120 void showShortcutsDlg();
122 void on_actionConfigureNetworks_triggered();
123 void on_actionConfigureViews_triggered();
124 void on_actionLockLayout_toggled(bool lock);
125 void on_actionDebugNetworkModel_triggered();
126 void on_actionDebugMessageModel_triggered();
127 void on_actionDebugLog_triggered();
129 void clientNetworkCreated(NetworkId);
130 void clientNetworkRemoved(NetworkId);
131 void clientNetworkUpdated();
132 void connectOrDisconnectFromNet();
134 void saveStatusBarStatus(bool enabled);
141 void connectToCore(const QVariantMap &connInfo);
142 void disconnectFromCore();
146 KHelpMenu *_kHelpMenu;
149 QLabel *coreLagLabel;
151 MsgProcessorStatusWidget *msgProcessorStatusWidget;
153 TitleSetter _titleSetter;
156 void setupBufferWidget();
158 void setupNickWidget();
159 void setupChatMonitor();
160 void setupInputWidget();
161 void setupTopicWidget();
162 void setupStatusBar();
164 void setupTitleSetter();
165 void setupToolBars();
172 SystemTray *_systemTray;
174 QList<BufferViewDock *> _bufferViews;
175 BufferWidget *_bufferWidget;
176 NickListWidget *_nickListWidget;
177 InputWidget *_inputWidget;
179 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
181 QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
185 QSize _normalSize; //!< Size of the non-maximized window
186 QPoint _normalPos; //!< Position of the non-maximized window
196 SystemTray *MainWin::systemTray() const {