modernize: Reformat ALL the source... again!
[quassel.git] / src / qtui / snorenotificationbackend.h
1 /***************************************************************************
2  *   Copyright (C) 2011-2018 by Hannah 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 <libsnore/notification/notification.h>
25 #include <libsnore/snore.h>
26
27 #include "abstractnotificationbackend.h"
28 #include "settingspage.h"
29
30 #include "ui_snorentificationconfigwidget.h"
31
32 class SystrayNotificationBackend;
33
34 class SnoreNotificationBackend : public AbstractNotificationBackend
35 {
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 public slots:
47     void actionInvoked(Snore::Notification);
48
49 private slots:
50     void setTraybackend(const QVariant& b);
51
52 private:
53     class ConfigWidget;
54 #ifndef HAVE_KDE
55     SystrayNotificationBackend* m_systrayBackend = nullptr;
56 #endif
57     QHash<uint, uint> m_notificationIds;
58     Snore::Icon m_icon;
59     Snore::Application m_application;
60     Snore::Alert m_alert;
61 };
62
63 class SnoreNotificationBackend::ConfigWidget : public SettingsPage
64 {
65     Q_OBJECT
66
67 public:
68     ConfigWidget(QWidget* parent = 0);
69
70     bool hasDefaults() const;
71     void defaults();
72     void load();
73     void save();
74 private slots:
75     void useSnoreChanged(bool);
76
77 private:
78     Ui::SnoreNotificationConfigWidget ui;
79 };
80
81 #endif