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>
33 class BufferViewConfig;
34 class MsgProcessorStatusWidget;
39 # include "desktopnotifications.h"
42 //!\brief The main window of Quassel's QtUi.
43 class MainWin : public QMainWindow {
47 MainWin(QWidget *parent = 0);
51 void addBufferView(BufferViewConfig *config = 0);
53 void displayTrayIconMessage(const QString &title, const QString &message);
56 void sendDesktopNotification(const QString &title, const QString &message);
59 virtual bool event(QEvent *event);
62 void setTrayIconActivity(bool active = false);
65 void closeEvent(QCloseEvent *event);
66 virtual void changeEvent(QEvent *event);
69 void connectedToCore();
70 void setConnectedState();
71 void updateLagIndicator(int lag);
72 void securedConnection();
73 void disconnectedFromCore();
74 void setDisconnectedState();
75 void systrayActivated( QSystemTrayIcon::ActivationReason );
78 void addBufferView(int bufferViewConfigId);
79 void removeBufferView(int bufferViewConfigId);
80 void messagesInserted(const QModelIndex &parent, int start, int end);
81 void showChannelList(NetworkId netId = NetworkId());
82 void showCoreInfoDlg();
83 void showSettingsDlg();
84 void on_actionEditNetworks_triggered();
85 void on_actionManageViews_triggered();
86 void on_actionLockDockPositions_toggled(bool lock);
88 void on_actionDebugNetworkModel_triggered(bool);
90 void showCoreConnectionDlg(bool autoConnect = false);
92 void clientNetworkCreated(NetworkId);
93 void clientNetworkRemoved(NetworkId);
94 void clientNetworkUpdated();
95 void connectOrDisconnectFromNet();
97 void makeTrayIconBlink();
98 void saveStatusBarStatus(bool enabled);
104 void desktopNotificationClosed(uint id, uint reason);
105 void desktopNotificationInvoked(uint id, const QString & action);
109 void connectToCore(const QVariantMap &connInfo);
110 void disconnectFromCore();
111 void requestBacklog(BufferInfo, QVariant, QVariant);
117 QLabel *coreLagLabel;
119 MsgProcessorStatusWidget *msgProcessorStatusWidget;
121 TitleSetter _titleSetter;
125 void setupNickWidget();
126 void setupChatMonitor();
127 void setupInputWidget();
128 void setupTopicWidget();
129 void setupStatusBar();
132 void toggleVisibility();
136 QSystemTrayIcon *systray;
137 QIcon activeTrayIcon;
138 QIcon onlineTrayIcon;
139 QIcon offlineTrayIcon;
143 BufferId currentBuffer;
144 QString currentProfile;
146 QList<QDockWidget *> _netViews;
147 NickListWidget *nickListWidget;
150 org::freedesktop::Notifications *desktopNotifications;
151 quint32 notificationId;