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 ***************************************************************************/
24 #include "ui_mainwin.h"
27 #include "titlesetter.h"
28 #include "sessionsettings.h"
30 #include <QSystemTrayIcon>
33 class ActionCollection;
35 class BufferViewConfig;
36 class MsgProcessorStatusWidget;
41 # include "desktopnotifications.h"
44 //!\brief The main window of Quassel's QtUi.
45 class MainWin : public QMainWindow {
49 MainWin(QWidget *parent = 0);
54 void addBufferView(BufferViewConfig *config = 0);
56 void displayTrayIconMessage(const QString &title, const QString &message);
59 void sendDesktopNotification(const QString &title, const QString &message);
62 virtual bool event(QEvent *event);
64 void setTrayIconActivity(bool active = false);
65 void saveStateToSession(const QString &sessionId);
66 void saveStateToSessionSettings(SessionSettings &s);
69 void closeEvent(QCloseEvent *event);
70 virtual void changeEvent(QEvent *event);
73 void connectedToCore();
74 void setConnectedState();
75 void updateLagIndicator(int lag);
76 void securedConnection();
77 void disconnectedFromCore();
78 void setDisconnectedState();
79 void systrayActivated( QSystemTrayIcon::ActivationReason );
82 void addBufferView(int bufferViewConfigId);
83 void removeBufferView(int bufferViewConfigId);
84 void messagesInserted(const QModelIndex &parent, int start, int end);
85 void showChannelList(NetworkId netId = NetworkId());
86 void showCoreInfoDlg();
87 void showSettingsDlg();
88 void on_actionEditNetworks_triggered();
89 void on_actionManageViews_triggered();
90 void on_actionLockDockPositions_toggled(bool lock);
92 void on_actionDebugNetworkModel_triggered(bool);
94 void showCoreConnectionDlg(bool autoConnect = false);
96 void clientNetworkCreated(NetworkId);
97 void clientNetworkRemoved(NetworkId);
98 void clientNetworkUpdated();
99 void connectOrDisconnectFromNet();
101 void makeTrayIconBlink();
102 void saveStatusBarStatus(bool enabled);
108 void desktopNotificationClosed(uint id, uint reason);
109 void desktopNotificationInvoked(uint id, const QString & action);
113 void connectToCore(const QVariantMap &connInfo);
114 void disconnectFromCore();
120 QLabel *coreLagLabel;
122 MsgProcessorStatusWidget *msgProcessorStatusWidget;
124 TitleSetter _titleSetter;
129 void setupNickWidget();
130 void setupChatMonitor();
131 void setupInputWidget();
132 void setupTopicWidget();
133 void setupStatusBar();
136 void toggleVisibility();
139 QSystemTrayIcon *systray;
140 QIcon activeTrayIcon;
141 QIcon onlineTrayIcon;
142 QIcon offlineTrayIcon;
146 BufferId currentBuffer;
147 QString currentProfile;
149 QList<QDockWidget *> _netViews;
150 NickListWidget *nickListWidget;
152 ActionCollection *_actionCollection;
155 org::freedesktop::Notifications *desktopNotifications;
156 quint32 notificationId;