File indexing completed on 2025-01-05 03:57:28
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * http://www.digikam.org 0005 * 0006 * Date : 2006-20-12 0007 * Description : a view to embed QtMultimedia media player. 0008 * 0009 * SPDX-FileCopyrightText: 2006-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_MEDIA_PLAYER_VIEW_H 0016 #define DIGIKAM_MEDIA_PLAYER_VIEW_H 0017 0018 // Qt includes 0019 0020 #include <QStackedWidget> 0021 #include <QEvent> 0022 #include <QUrl> 0023 #include <QMediaPlayer> 0024 0025 // Local includes 0026 0027 #include "digikam_export.h" 0028 #include "dinfointerface.h" 0029 0030 namespace Digikam 0031 { 0032 0033 class DIGIKAM_EXPORT MediaPlayerView : public QStackedWidget 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 0039 explicit MediaPlayerView(QWidget* const parent); 0040 ~MediaPlayerView() override; 0041 0042 void setCurrentItem(const QUrl& url = QUrl(), 0043 bool hasPrevious = false, 0044 bool hasNext = false); 0045 0046 void setInfoInterface(DInfoInterface* const iface); 0047 void escapePreview(); 0048 void reload(); 0049 0050 Q_SIGNALS: 0051 0052 void signalNextItem(); 0053 void signalPrevItem(); 0054 void signalEscapePreview(); 0055 0056 public Q_SLOTS: 0057 0058 void slotEscapePressed(); 0059 void slotRotateVideo(); 0060 0061 private Q_SLOTS: 0062 0063 void slotPlayerStateChanged(QMediaPlayer::PlaybackState newState); 0064 void slotMediaStatusChanged(QMediaPlayer::MediaStatus newStatus); 0065 void slotHandlePlayerError(QMediaPlayer::Error, const QString&); 0066 void slotNativeSizeChanged(); 0067 void slotThemeChanged(); 0068 0069 /// Slidebar slots 0070 void slotPositionChanged(qint64 position); 0071 void slotDurationChanged(qint64 duration); 0072 void slotVolumeChanged(int volume); 0073 void slotLoopToggled(bool loop); 0074 void slotPosition(int position); 0075 void slotPausePlay(); 0076 void slotCapture(); 0077 0078 private: 0079 0080 int previewMode(); 0081 void setPreviewMode(int mode); 0082 0083 protected: 0084 0085 bool eventFilter(QObject* watched, QEvent* event) override; 0086 0087 private: 0088 0089 class Private; 0090 Private* const d; 0091 }; 0092 0093 } // namespace Digikam 0094 0095 #endif // DIGIKAM_MEDIA_PLAYER_VIEW_H