summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/player/qmediaplaylist.h
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-08-30 20:30:26 +0200
committerKai Köhne <kai.koehne@qt.io>2022-09-23 07:51:15 +0200
commit45589023cd35f3e616a2047bec76c826f725c88f (patch)
tree4f18721e8e50aa2fd3a099ecfa479f01fba099ac /examples/multimedia/player/qmediaplaylist.h
parent7ba5d1f3df45585ee90db5d1c7174203f52c2c05 (diff)
Let examples show up in Qt Creator again
Fix an issue where the relative paths in the generated examples-manifest.xml did miss the parent directory, effectively blocking the examples from being shown in the Qt Creator Welcome screen. This broke in commit c403e775f60a, where the exampledirs path was changed from "../../../examples" to "../../../examples/multimedia" and "../../../examples/multimediawidgets". This made qdoc miss the "multimedia" and "multimediawidgets" directories in the generated paths. To fix this, the patch * moves all the multimediawidgets examples to multimedia * sets examplesinstallpath to "multimedia" The unification of directories is needed because there can be only one examplesinstallpath per qdoc project. Fixes: QTBUG-104943 Change-Id: I4d1b1f857563ec23b4d60028ca08d0470ba96298 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit c3081f86f4fc53509d853a2b88aff88df8c55d87) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples/multimedia/player/qmediaplaylist.h')
-rw-r--r--examples/multimedia/player/qmediaplaylist.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/examples/multimedia/player/qmediaplaylist.h b/examples/multimedia/player/qmediaplaylist.h
new file mode 100644
index 000000000..94846d9b7
--- /dev/null
+++ b/examples/multimedia/player/qmediaplaylist.h
@@ -0,0 +1,96 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMEDIAPLAYLIST_H
+#define QMEDIAPLAYLIST_H
+
+#include <QtCore/qobject.h>
+
+#include <QtMultimedia/qtmultimediaglobal.h>
+#include <QtMultimedia/qmediaenumdebug.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class QMediaPlaylistPrivate;
+class QMediaPlaylist : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QMediaPlaylist::PlaybackMode playbackMode READ playbackMode WRITE setPlaybackMode NOTIFY playbackModeChanged)
+ Q_PROPERTY(QUrl currentMedia READ currentMedia NOTIFY currentMediaChanged)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
+
+public:
+ enum PlaybackMode { CurrentItemOnce, CurrentItemInLoop, Sequential, Loop };
+ Q_ENUM(PlaybackMode)
+ enum Error { NoError, FormatError, FormatNotSupportedError, NetworkError, AccessDeniedError };
+ Q_ENUM(Error)
+
+ explicit QMediaPlaylist(QObject *parent = nullptr);
+ virtual ~QMediaPlaylist();
+
+ PlaybackMode playbackMode() const;
+ void setPlaybackMode(PlaybackMode mode);
+
+ int currentIndex() const;
+ QUrl currentMedia() const;
+
+ int nextIndex(int steps = 1) const;
+ int previousIndex(int steps = 1) const;
+
+ QUrl media(int index) const;
+
+ int mediaCount() const;
+ bool isEmpty() const;
+
+ void addMedia(const QUrl &content);
+ void addMedia(const QList<QUrl> &items);
+ bool insertMedia(int index, const QUrl &content);
+ bool insertMedia(int index, const QList<QUrl> &items);
+ bool moveMedia(int from, int to);
+ bool removeMedia(int pos);
+ bool removeMedia(int start, int end);
+ void clear();
+
+ void load(const QUrl &location, const char *format = nullptr);
+ void load(QIODevice *device, const char *format = nullptr);
+
+ bool save(const QUrl &location, const char *format = nullptr) const;
+ bool save(QIODevice *device, const char *format) const;
+
+ Error error() const;
+ QString errorString() const;
+
+public Q_SLOTS:
+ void shuffle();
+
+ void next();
+ void previous();
+
+ void setCurrentIndex(int index);
+
+Q_SIGNALS:
+ void currentIndexChanged(int index);
+ void playbackModeChanged(QMediaPlaylist::PlaybackMode mode);
+ void currentMediaChanged(const QUrl&);
+
+ void mediaAboutToBeInserted(int start, int end);
+ void mediaInserted(int start, int end);
+ void mediaAboutToBeRemoved(int start, int end);
+ void mediaRemoved(int start, int end);
+ void mediaChanged(int start, int end);
+
+ void loaded();
+ void loadFailed();
+
+private:
+ QMediaPlaylistPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QMediaPlaylist)
+};
+
+QT_END_NAMESPACE
+
+Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, PlaybackMode)
+Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, Error)
+
+#endif // QMEDIAPLAYLIST_H