Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* This file is part of the KDE libraries
2 Copyright 2014 by Martin Klapetek <mklapetek@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), which shall
10 act as a proxy defined in Section 6 of version 3 of the license.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22
23#ifndef NOTIFYBYAUDIO_H
24#define NOTIFYBYAUDIO_H
25
26#include "knotificationplugin.h"
27
28#include <QHash>
29#include <QUrl>
30
31class KNotification;
32
33struct ca_context;
34
35class NotifyByAudio : public KNotificationPlugin
36{
37 Q_OBJECT
38
39public:
40 explicit NotifyByAudio(QObject *parent = nullptr);
41 ~NotifyByAudio() override;
42
43 QString optionName() override { return QStringLiteral("Sound"); }
44 void notify(KNotification *notification, KNotifyConfig *config) override;
45 void close(KNotification *notification) override;
46
47private Q_SLOTS:
48 void finishCallback(uint32_t id,
49 int error_code);
50
51private:
52 static void ca_finish_callback(ca_context *c,
53 uint32_t id,
54 int error_code,
55 void *userdata);
56
57 void finishNotification(KNotification *notification, quint32 id);
58
59 bool playSound(quint32 id, const QUrl &url);
60
61 ca_context *m_context = nullptr;
62 quint32 m_currentId = 0;
63 QHash<quint32, KNotification*> m_notifications;
64 // in case we loop we store the URL for the notification to be able to replay it
65 QHash<quint32, QUrl> m_loopSoundUrls;
66};
67
68#endif
69

Warning: That file was not part of the compilation database. It may have many parsing errors.