File: growl.cpp

package info (click to toggle)
esperanza 0.2.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 600 kB
  • ctags: 536
  • sloc: cpp: 4,533; sh: 63; makefile: 4
file content (56 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#include "growl.h"
#include "qtmd5.h"

#include "mac_growl.h"

#include <QDataStream>
#include <QByteArray>
#include <QIODevice>
#include <QHash>
#include <QVariant>
#include <QPixmap>

GrowlNotifier::GrowlNotifier (QObject *parent,
							  const QString &appname,
							  const QStringList &notifications) :
	QObject (parent)
{
	m_appname = appname.toUtf8 ();
	m_notifications = notifications;
}

void
GrowlNotifier::do_notification (const QString &notif,
								const QString &title,
								const QString &desc,
								const QPixmap &img)
{
	QHash<QString, QVariant> note;

	note["ApplicationName"] = QVariant (QString (m_appname));
	note["NotificationName"] = QVariant (notif);
	note["NotificationTitle"] = QVariant (title);
	note["NotificationDescription"] = QVariant (desc);
	note["NotificationIcon"] = QVariant (img);

#ifdef Q_OS_MACX
	mac_growl_post_notification ("GrowlNotification", note);
#endif
}

void
GrowlNotifier::do_registration ()
{
	QHash<QString, QVariant> note;

	note["ApplicationName"] = QVariant (QString (m_appname));
	note["AllNotifications"] = QVariant (m_notifications);
	note["DefaultNotifications"] = QVariant (m_notifications);
//	note["ApplicationIcon"] = QVariant (QImage (":images/test.jpg"));

#ifdef Q_OS_MACX
	mac_growl_post_notification ("GrowlApplicationRegistrationNotification", note);
#endif
}