blob: 49c08129e4203e5bd00e91ef4a303d3cb2001851 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  | 
/*
 * Copyright (c) 2010 Kevin Smith
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */
#include "Swift/QtUI/QtSystemTray.h"
#include <QIcon>
#include <QPixmap>
#include <QResource>
namespace Swift {
QtSystemTray::QtSystemTray() : QObject(), standardIcon_(":icons/tray-standard.png"), newMessageIcon_(":icons/new-chat.png") {
	trayIcon_ = new QSystemTrayIcon(standardIcon_);
	connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));
	trayIcon_->show();
}
QtSystemTray::~QtSystemTray() {
	delete trayIcon_;
}
void QtSystemTray::setUnreadMessages(bool some) {
	trayIcon_->setIcon(some ? newMessageIcon_ : standardIcon_);
}
void QtSystemTray::handleIconActivated(QSystemTrayIcon::ActivationReason reason) {
	if (reason == QSystemTrayIcon::Trigger) {
		emit clicked();
	}
}
}
  |