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;
40 # include "desktopnotifications.h"
43 //!\brief The main window of Quassel's QtUi.
44 class MainWin : public QMainWindow {
48 MainWin(QWidget *parent = 0);
52 void addBufferView(BufferViewConfig *config = 0);
54 void displayTrayIconMessage(const QString &title, const QString &message);
57 void sendDesktopNotification(const QString &title, const QString &message);
60 virtual bool event(QEvent *event);
63 void setTrayIconActivity(bool active = false);
66 void closeEvent(QCloseEvent *event);
67 virtual void changeEvent(QEvent *event);
70 void connectedToCore();
71 void setConnectedState();
72 void updateLagIndicator(int lag);
73 void securedConnection();
74 void disconnectedFromCore();
75 void setDisconnectedState();
76 void systrayActivated( QSystemTrayIcon::ActivationReason );
79 void addBufferView(int bufferViewConfigId);
80 void removeBufferView(int bufferViewConfigId);
81 void messagesInserted(const QModelIndex &parent, int start, int end);
82 void showChannelList(NetworkId netId = NetworkId());
83 void showCoreInfoDlg();
84 void showSettingsDlg();
85 void on_actionEditNetworks_triggered();
86 void on_actionManageViews_triggered();
87 void on_actionLockDockPositions_toggled(bool lock);
89 void on_actionDebugNetworkModel_triggered(bool);
91 void showCoreConnectionDlg(bool autoConnect = false);
93 void clientNetworkCreated(NetworkId);
94 void clientNetworkRemoved(NetworkId);
95 void clientNetworkUpdated();
96 void connectOrDisconnectFromNet();
98 void makeTrayIconBlink();
99 void saveStatusBarStatus(bool enabled);
105 void desktopNotificationClosed(uint id, uint reason);
106 void desktopNotificationInvoked(uint id, const QString & action);
110 void connectToCore(const QVariantMap &connInfo);
111 void disconnectFromCore();
112 void requestBacklog(BufferInfo, QVariant, QVariant);
118 QLabel *coreLagLabel;
120 MsgProcessorStatusWidget *msgProcessorStatusWidget;
122 TitleSetter _titleSetter;
126 void setupNickWidget();
127 void setupChatMonitor();
128 void setupInputWidget();
129 void setupTopicWidget();
130 void setupStatusBar();
133 void toggleVisibility();
137 QSystemTrayIcon *systray;
138 QIcon activeTrayIcon;
139 QIcon onlineTrayIcon;
140 QIcon offlineTrayIcon;
144 BufferId currentBuffer;
145 QString currentProfile;
147 QList<QDockWidget *> _netViews;
148 NickListWidget *nickListWidget;
151 org::freedesktop::Notifications *desktopNotifications;
152 quint32 notificationId;