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;
37 class MsgProcessorStatusWidget;
45 # include "desktopnotifications.h"
48 //!\brief The main window of Quassel's QtUi.
49 class MainWin : public QMainWindow {
53 MainWin(QtUi *gui, QWidget *parent = 0);
57 void addBufferView(BufferViewConfig *config = 0);
59 void displayTrayIconMessage(const QString &title, const QString &message);
62 void sendDesktopNotification(const QString &title, const QString &message);
65 virtual bool event(QEvent *event);
68 void setTrayIconActivity(bool active = false);
71 void closeEvent(QCloseEvent *event);
72 virtual void changeEvent(QEvent *event);
75 void connectedToCore();
76 void setConnectedState();
77 void updateLagIndicator(int lag);
78 void securedConnection();
79 void disconnectedFromCore();
80 void setDisconnectedState();
81 void systrayActivated( QSystemTrayIcon::ActivationReason );
84 void addBufferView(int bufferViewConfigId);
85 void removeBufferView(int bufferViewConfigId);
86 void messagesInserted(const QModelIndex &parent, int start, int end);
87 void showChannelList(NetworkId netId = NetworkId());
88 void showCoreInfoDlg();
89 void showSettingsDlg();
90 void on_actionEditNetworks_triggered();
91 void on_actionManageViews_triggered();
92 void on_actionLockDockPositions_toggled(bool lock);
94 void showDebugConsole();
95 void on_actionDebugNetworkModel_triggered(bool);
97 void showCoreConnectionDlg(bool autoConnect = false);
98 void coreConnectionDlgFinished(int result);
100 void clientNetworkCreated(NetworkId);
101 void clientNetworkRemoved(NetworkId);
102 void clientNetworkUpdated();
103 void connectOrDisconnectFromNet();
105 void changeTopic(const QString &topic);
106 void makeTrayIconBlink();
107 void saveStatusBarStatus(bool enabled);
113 void desktopNotificationClosed(uint id, uint reason);
114 void desktopNotificationInvoked(uint id, const QString & action);
118 void connectToCore(const QVariantMap &connInfo);
119 void disconnectFromCore();
120 void requestBacklog(BufferInfo, QVariant, QVariant);
127 QLabel *coreLagLabel;
129 MsgProcessorStatusWidget *msgProcessorStatusWidget;
131 TitleSetter _titleSetter;
135 void setupNickWidget();
136 void setupChatMonitor();
137 void setupInputWidget();
138 void setupTopicWidget();
139 void setupStatusBar();
142 void setupSettingsDlg();
144 void toggleVisibility();
148 QSystemTrayIcon *systray;
149 QIcon activeTrayIcon;
150 QIcon onlineTrayIcon;
151 QIcon offlineTrayIcon;
155 CoreConnectDlg *coreConnectDlg;
156 ChannelListDlg *channelListDlg;
157 SettingsDlg *settingsDlg;
158 DebugConsole *debugConsole;
160 BufferId currentBuffer;
161 QString currentProfile;
163 QList<QDockWidget *> _netViews;
164 NickListWidget *nickListWidget;
167 org::freedesktop::Notifications *desktopNotifications;
168 quint32 notificationId;