clean apply of the whole snore patches
[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 namespace Snore{
31 class SnoreCore;
32 class Icon;
33 }
34 class SystrayNotificationBackend;
35
36 #include <snore/core/notification/notification.h>
37
38 class SnoreNotificationBackend : public AbstractNotificationBackend {
39     Q_OBJECT
40 public:
41     SnoreNotificationBackend (QObject *parent);
42     ~SnoreNotificationBackend();
43
44     void notify(const Notification &);
45     void close(uint notificationId);
46
47     virtual SettingsPage *createConfigWidget()const;
48
49 signals:
50     void activated(uint notificationId = 0);
51
52 public slots:
53     void actionInvoked(Snore::Notification);
54 private slots:
55   void backendChanged(const QVariant &);
56   void timeoutChanged(const QVariant &);
57
58 private:
59     class ConfigWidget;
60     SystrayNotificationBackend * m_systrayBackend;
61     Snore::SnoreCore *m_snore;
62     QHash<uint,uint> m_notificationIds;
63     Snore::Icon m_icon;
64     int m_timeout;
65 };
66
67 class SnoreNotificationBackend::ConfigWidget : public SettingsPage {
68     Q_OBJECT
69
70 public:
71     ConfigWidget(Snore::SnoreCore *snore,QWidget *parent = 0);
72     void save();
73     void load();
74     bool hasDefaults() const;
75     void defaults();
76
77 private slots:
78     void backendChanged(const QString&);
79     void timeoutChanged(int);
80
81 private:
82     Ui::SnoreNotificationConfigWidget ui;
83     Snore::SnoreCore *m_snore;
84
85     //  QSpinBox *timeoutBox;
86
87     //  bool enabled;
88     //  int timeout;
89 };
90
91 #endif