File indexing completed on 2025-01-19 03:57:02
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-05-25 0007 * Description : a widget to play audio track. 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_AUD_PLAYER_WDG_H 0016 #define DIGIKAM_AUD_PLAYER_WDG_H 0017 0018 // Qt include 0019 0020 #include <QWidget> 0021 #include <QString> 0022 0023 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0024 0025 // QtMultimedia includes 0026 0027 # include <QMediaPlayer> 0028 0029 #else 0030 0031 // QtAVPlayer includes 0032 0033 # include "daudioplayer.h" 0034 0035 #endif 0036 0037 // Local includes 0038 0039 #include "digikam_export.h" 0040 0041 namespace Digikam 0042 { 0043 0044 class DIGIKAM_EXPORT AudPlayerWdg : public QWidget 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 0050 explicit AudPlayerWdg(QWidget* const parent = nullptr); 0051 ~AudPlayerWdg() override; 0052 0053 void setAudioFile(const QString& afile); 0054 0055 public Q_SLOTS: 0056 0057 void slotPlay(); 0058 void slotStop(); 0059 0060 private Q_SLOTS: 0061 0062 void slotTimeUpdaterTimeout(qint64); 0063 void slotSetVolume(int); 0064 0065 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0066 0067 void slotPlayerStateChanged(QMediaPlayer::PlaybackState); 0068 void slotPlayerError(QMediaPlayer::Error, const QString&); 0069 0070 #else 0071 0072 void slotPlayerStateChanged(QAVPlayer::State); 0073 void slotPlayerError(QAVPlayer::Error, const QString&); 0074 0075 #endif 0076 0077 private: 0078 0079 void setZeroTime(); 0080 0081 private: 0082 0083 class Private; 0084 Private* const d; 0085 }; 0086 0087 } // namespace Digikam 0088 0089 #endif // DIGIKAM_AUD_PLAYER_WDG_H