Okular

audioplayer.h
1/*
2 SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef _OKULAR_AUDIOPLAYER_H_
8#define _OKULAR_AUDIOPLAYER_H_
9
10#include "okularcore_export.h"
11
12#include <QObject>
13
14namespace Okular
15{
16class AudioPlayerPrivate;
17class Document;
18class Sound;
19class SoundAction;
20
21/**
22 * @short An audio player.
23 *
24 * Singleton utility class to play sounds in documents using the KDE sound
25 * system.
26 */
27class OKULARCORE_EXPORT AudioPlayer : public QObject
28{
29 Q_OBJECT
30
31public:
32 /**
33 * The state of AudioPlayer
34 * @since 0.19 (KDE 4.13)
35 */
36 enum State {
37 /**
38 * The AudioPlayer is playing a audio file.
39 */
41 /**
42 * The AudioPlayer isn't playing a audio file.
43 */
44 StoppedState
45 };
46
47 ~AudioPlayer() override;
48
49 /**
50 * Gets the instance of the audio player.
51 */
52 static AudioPlayer *instance();
53
54 /**
55 * Enqueue the specified @p sound for playing, optionally taking more
56 * information about the playing from the @p soundlink .
57 */
58 void playSound(const Sound *sound, const SoundAction *linksound = nullptr);
59
60 /**
61 * Tell the AudioPlayer to stop all the playbacks.
62 */
63 void stopPlaybacks();
64
65 /**
66 * Return state of sound (playing/stopped)
67 * @since 0.19 (KDE 4.13)
68 */
69 State state() const;
70
71private:
73 void resetDocument();
74 void setDocument(const QUrl &url, Document *document);
75
76 friend class AudioPlayerPrivate;
77 AudioPlayerPrivate *const d;
78 friend class Document;
79
80 Q_DISABLE_COPY(AudioPlayer)
81};
82
83}
84
85#endif
An audio player.
Definition audioplayer.h:28
@ PlayingState
The AudioPlayer is playing a audio file.
Definition audioplayer.h:40
The Document.
Definition document.h:192
The Sound action plays a sound on activation.
Definition action.h:359
Contains information about a sound object.
Definition sound.h:24
global.h
Definition action.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.