1 /***************************************************************************
2 * Copyright (C) 2005-08 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>
30 #include <QSystemTrayIcon>
33 #include "sessionsettings.h"
34 #include "titlesetter.h"
36 class ActionCollection;
38 class BufferViewConfig;
42 class MsgProcessorStatusWidget;
51 //!\brief The main window of Quassel's QtUi.
54 : public KMainWindow {
56 : public QMainWindow {
61 MainWin(QWidget *parent = 0);
66 void addBufferView(BufferViewConfig *config);
67 BufferView *allBuffersView() const;
69 inline QSystemTrayIcon *systemTrayIcon() const;
71 virtual bool event(QEvent *event);
73 static void flagRemoteCoreOnly(QObject *object) { object->setProperty("REMOTE_CORE_ONLY", true); }
74 static bool isRemoteCoreOnly(QObject *object) { return object->property("REMOTE_CORE_ONLY").toBool(); }
77 void saveStateToSession(const QString &sessionId);
78 void saveStateToSessionSettings(SessionSettings &s);
79 void showStatusBarMessage(const QString &message);
82 void closeEvent(QCloseEvent *event);
83 virtual void changeEvent(QEvent *event);
86 void connectedToCore();
87 void setConnectedState();
88 void updateLagIndicator(int lag = -1);
89 void securedConnection();
90 void disconnectedFromCore();
91 void setDisconnectedState();
92 void systrayActivated(QSystemTrayIcon::ActivationReason);
95 void addBufferView(int bufferViewConfigId);
96 void removeBufferView(int bufferViewConfigId);
97 void messagesInserted(const QModelIndex &parent, int start, int end);
99 void showChannelList(NetworkId netId = NetworkId());
100 void startInternalCore();
101 void showCoreConnectionDlg(bool autoConnect = false);
102 void showCoreInfoDlg();
103 void showSettingsDlg();
104 void showNotificationsDlg();
106 void showShortcutsDlg();
108 void on_actionConfigureNetworks_triggered();
109 void on_actionConfigureViews_triggered();
110 void on_actionLockDockPositions_toggled(bool lock);
111 void on_actionDebugNetworkModel_triggered();
112 void on_actionDebugMessageModel_triggered();
113 void on_actionDebugLog_triggered();
115 void clientNetworkCreated(NetworkId);
116 void clientNetworkRemoved(NetworkId);
117 void clientNetworkUpdated();
118 void connectOrDisconnectFromNet();
120 void saveStatusBarStatus(bool enabled);
126 void connectToCore(const QVariantMap &connInfo);
127 void disconnectFromCore();
131 KHelpMenu *_kHelpMenu;
135 QLabel *coreLagLabel;
137 MsgProcessorStatusWidget *msgProcessorStatusWidget;
139 TitleSetter _titleSetter;
142 void setupBufferWidget();
144 void setupNickWidget();
145 void setupChatMonitor();
146 void setupInputWidget();
147 void setupTopicWidget();
148 void setupStatusBar();
150 void setupTitleSetter();
153 void toggleVisibility();
156 QSystemTrayIcon *_trayIcon;
158 QList<BufferViewDock *> _bufferViews;
159 BufferWidget *_bufferWidget;
160 NickListWidget *_nickListWidget;
161 InputWidget *_inputWidget;
163 QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
168 QSystemTrayIcon *MainWin::systemTrayIcon() const {