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"
29 #include <QSystemTrayIcon>
36 class BufferViewConfig;
44 # include "desktopnotifications.h"
47 //!\brief The main window of Quassel's QtUi.
48 class MainWin : public QMainWindow {
52 MainWin(QtUi *gui, QWidget *parent = 0);
56 void addBufferView(BufferViewConfig *config = 0);
58 void displayTrayIconMessage(const QString &title, const QString &message);
61 void sendDesktopNotification(const QString &title, const QString &message);
64 virtual bool event(QEvent *event);
67 void setTrayIconActivity(bool active = false);
70 void closeEvent(QCloseEvent *event);
71 virtual void changeEvent(QEvent *event);
74 void connectedToCore();
75 void setConnectedState();
76 void updateLagIndicator(int lag);
77 void securedConnection();
78 void disconnectedFromCore();
79 void setDisconnectedState();
80 void systrayActivated( QSystemTrayIcon::ActivationReason );
83 void addBufferView(int bufferViewConfigId);
84 void removeBufferView(int bufferViewConfigId);
85 void receiveMessage(const Message &msg);
86 void showChannelList(NetworkId netId = NetworkId());
87 void showCoreInfoDlg();
88 void showSettingsDlg();
89 void on_actionEditNetworks_triggered();
90 void on_actionManageViews_triggered();
91 void on_actionLockDockPositions_toggled(bool lock);
93 void showDebugConsole();
95 void showCoreConnectionDlg(bool autoConnect = false);
96 void coreConnectionDlgFinished(int result);
98 void clientNetworkCreated(NetworkId);
99 void clientNetworkRemoved(NetworkId);
100 void clientNetworkUpdated();
101 void connectOrDisconnectFromNet();
103 void changeTopic(const QString &topic);
104 void makeTrayIconBlink();
105 void saveStatusBarStatus(bool enabled);
110 void desktopNotificationClosed(uint id, uint reason);
111 void desktopNotificationInvoked(uint id, const QString & action);
114 void connectToCore(const QVariantMap &connInfo);
115 void disconnectFromCore();
116 void requestBacklog(BufferInfo, QVariant, QVariant);
123 QLabel *coreLagLabel;
126 TitleSetter _titleSetter;
130 void setupNickWidget();
131 void setupChatMonitor();
132 void setupInputWidget();
133 void setupTopicWidget();
134 void setupStatusBar();
137 void setupSettingsDlg();
139 void toggleVisibility();
143 QSystemTrayIcon *systray;
144 QIcon activeTrayIcon;
145 QIcon onlineTrayIcon;
146 QIcon offlineTrayIcon;
150 CoreConnectDlg *coreConnectDlg;
151 ChannelListDlg *channelListDlg;
152 SettingsDlg *settingsDlg;
153 DebugConsole *debugConsole;
155 BufferId currentBuffer;
156 QString currentProfile;
158 QList<QDockWidget *> _netViews;
159 NickListWidget *nickListWidget;
161 QAction *actionEditNetworks;
162 QList<QAction *> networkActions;
165 org::freedesktop::Notifications *desktopNotifications;
166 quint32 notificationId;