e0abdf7f49c0558414fe98546ea37e92240ec31d
[quassel.git] / src / qtui / snorenotificationbackend.h
1 /***************************************************************************
2 *   Copyright (C) 2011-2013 by Patrick von Reth                           *
3 *   vonreth@kde.org                                                       *
4 *                                                                         *
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.                                           *
9 *                                                                         *
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.                          *
14 *                                                                         *
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 ***************************************************************************/
20
21 #ifndef SNORENOTIFICATIONBACKEND_H_
22 #define SNORENOTIFICATIONBACKEND_H_
23
24 #include "abstractnotificationbackend.h"
25
26 #include "settingspage.h"
27
28 #include "ui_snorentificationconfigwidget.h"
29
30 #include <libsnore/snore.h>
31 #include <libsnore/notification/notification.h>
32
33 class SystrayNotificationBackend;
34
35 class SnoreNotificationBackend : public AbstractNotificationBackend {
36     Q_OBJECT
37 public:
38     SnoreNotificationBackend (QObject *parent);
39     ~SnoreNotificationBackend();
40
41     void notify(const Notification &);
42     void close(uint notificationId);
43
44     virtual SettingsPage *createConfigWidget() const;
45
46 signals:
47     void activated(uint notificationId = 0);
48
49 public slots:
50     void actionInvoked(Snore::Notification);
51
52 private slots:
53     void setTraybackend(const QVariant &b);
54
55 private:
56
57     class ConfigWidget;
58 #ifndef HAVE_KDE
59     SystrayNotificationBackend * m_systrayBackend = nullptr;
60 #endif
61     QHash<uint, uint> m_notificationIds;
62     Snore::Icon m_icon;
63     Snore::Application m_application;
64     Snore::Alert m_alert;
65 };
66
67 class SnoreNotificationBackend::ConfigWidget : public SettingsPage {
68     Q_OBJECT
69
70 public:
71     ConfigWidget(QWidget *parent = 0);
72
73     bool hasDefaults() const;
74     void defaults();
75     void load();
76     void save();
77 private slots:
78     void useSnnoreChanged(bool);
79
80 private:
81     Ui::SnoreNotificationConfigWidget ui;
82 };
83
84 #endif