digiKam
presentationaudiolist.h
Go to the documentation of this file.
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-2022 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_LIST_H
26 #define DIGIKAM_PRESENTATION_AUDIO_LIST_H
27 
28 // Qt includes
29 
30 #include <QTime>
31 #include <QWidget>
32 #include <QString>
33 #include <QDropEvent>
34 #include <QDragMoveEvent>
35 #include <QDragEnterEvent>
36 #include <QListWidget>
37 #include <QListWidgetItem>
38 #include <QUrl>
39 
40 // QtAV includes
41 
42 #include <QtAV/AVError.h> // krazy:exclude=includes
43 
45 {
46 
47 class PresentationAudioListItem : public QObject, public QListWidgetItem
48 {
49  Q_OBJECT
50 
51 public:
52 
53  explicit PresentationAudioListItem(QListWidget* const parent,
54  const QUrl& url);
55  ~PresentationAudioListItem() override;
56 
57  QUrl url() const;
58  QString artist() const;
59  QString title() const;
60  QTime totalTime() const;
61  void setName(const QString& text);
62 
63 Q_SIGNALS:
64 
65  void signalTotalTimeReady(const QUrl&, const QTime&);
66 
67 private Q_SLOTS:
68 
69  void slotMediaStateChanged(QtAV::MediaStatus);
70  void slotPlayerError(const QtAV::AVError&);
71 
72 private:
73 
74  void showErrorDialog(const QString& err);
75 
76 private:
77 
78  class Private;
79  Private* const d;
80 };
81 
82 // --------------------------------------------------------------------
83 
84 class PresentationAudioList : public QListWidget
85 {
86  Q_OBJECT
87 
88 public:
89 
90  explicit PresentationAudioList(QWidget* const parent = nullptr);
91 
92 public:
93 
95 
96 Q_SIGNALS:
97 
98  void signalAddedDropItems(const QList<QUrl>& filesUrl);
99 
100 protected:
101 
102  void dragEnterEvent(QDragEnterEvent*) override;
103  void dragMoveEvent(QDragMoveEvent*) override;
104  void dropEvent(QDropEvent*) override;
105 };
106 
107 } // namespace DigikamGenericPresentationPlugin
108 
109 #endif // DIGIKAM_PRESENTATION_AUDIO_LIST_H
QString artist() const
Definition: presentationaudiolist.cpp:113
QString title() const
Definition: presentationaudiolist.cpp:118
void setName(const QString &text)
Definition: presentationaudiolist.cpp:108
QUrl url() const
Definition: presentationaudiolist.cpp:103
~PresentationAudioListItem() override
Definition: presentationaudiolist.cpp:98
void signalTotalTimeReady(const QUrl &, const QTime &)
PresentationAudioListItem(QListWidget *const parent, const QUrl &url)
Definition: presentationaudiolist.cpp:78
QTime totalTime() const
Definition: presentationaudiolist.cpp:123
Definition: presentationaudiolist.h:85
QList< QUrl > fileUrls()
Definition: presentationaudiolist.cpp:240
void signalAddedDropItems(const QList< QUrl > &filesUrl)
void dragMoveEvent(QDragMoveEvent *) override
Definition: presentationaudiolist.cpp:209
void dragEnterEvent(QDragEnterEvent *) override
Definition: presentationaudiolist.cpp:201
PresentationAudioList(QWidget *const parent=nullptr)
Definition: presentationaudiolist.cpp:192
void dropEvent(QDropEvent *) override
Definition: presentationaudiolist.cpp:217
Definition: presentation_audiopage.cpp:46