1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2008-09-14
7  * Description : a presentation tool.
8  *
9  * Copyright (C) 2008-2009 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com>
10  * Copyright (C) 2009      by Andi Clemens <andi dot clemens at googlemail dot com>
11  * Copyright (C) 2012-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_PRESENTATION_AUDIO_WIDGET_H
26 #define DIGIKAM_PRESENTATION_AUDIO_WIDGET_H
27 
28 // Qt includes
29 
30 #include <QUrl>
31 #include <QKeyEvent>
32 
33 // QtAV includes
34 
35 #include <QtAV/AVError.h>  // krazy:exclude=includes
36 #include <QtAV/AVPlayer.h> // krazy:exclude=includes
37 
38 // Local includes
39 
40 #include "ui_presentationaudiowidget.h"
41 
42 namespace DigikamGenericPresentationPlugin
43 {
44 
45 class PresentationContainer;
46 
47 class PresentationAudioWidget : public QWidget,
48                                 public Ui::PresentationAudioWidget
49 {
50     Q_OBJECT
51 
52 public:
53 
54     explicit PresentationAudioWidget(QWidget* const,
55                                      const QList<QUrl>&,
56                                      PresentationContainer* const);
57     ~PresentationAudioWidget() override;
58 
59     void enqueue(const QList<QUrl>&);
60     bool canHide() const;
61     bool isPaused() const;
62     void setPaused(bool);
63     void keyPressEvent(QKeyEvent*) override;
64 
65 public Q_SLOTS:
66 
67     void slotPlay();
68     void slotStop();
69 
70 Q_SIGNALS:
71 
72     void signalPlay();
73     void signalPause();
74 
75 private Q_SLOTS:
76 
77     void slotPrev();
78     void slotNext();
79     void slotTimeUpdaterTimeout();
80     void slotError();
81     void slotSetVolume(int);
82     void slotMediaStateChanged(QtAV::MediaStatus);
83     void slotPlayerStateChanged(QtAV::AVPlayer::State);
84     void slotPlayerError(const QtAV::AVError&);
85 
86 private:
87 
88     void checkSkip();
89     void setZeroTime();
90 
91 private:
92 
93     class Private;
94     Private* const d;
95 };
96 
97 } // namespace DigikamGenericPresentationPlugin
98 
99 #endif // DIGIKAM_PRESENTATION_AUDIO_WIDGET_H
100