diff options
author | Kai Köhne <kai.koehne@qt.io> | 2022-08-30 20:30:26 +0200 |
---|---|---|
committer | Kai Köhne <kai.koehne@qt.io> | 2022-09-23 07:51:15 +0200 |
commit | 45589023cd35f3e616a2047bec76c826f725c88f (patch) | |
tree | 4f18721e8e50aa2fd3a099ecfa479f01fba099ac /examples/multimedia/player/main.cpp | |
parent | 7ba5d1f3df45585ee90db5d1c7174203f52c2c05 (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/main.cpp')
-rw-r--r-- | examples/multimedia/player/main.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/multimedia/player/main.cpp b/examples/multimedia/player/main.cpp new file mode 100644 index 000000000..befe1d561 --- /dev/null +++ b/examples/multimedia/player/main.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "player.h" + +#include <QApplication> +#include <QCommandLineParser> +#include <QCommandLineOption> +#include <QDir> +#include <QUrl> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QCoreApplication::setApplicationName("Player Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription("Qt MultiMedia Player Example"); + parser.addHelpOption(); + parser.addVersionOption(); + parser.addPositionalArgument("url", "The URL(s) to open."); + parser.process(app); + + Player player; + + if (!parser.positionalArguments().isEmpty() && player.isPlayerAvailable()) { + QList<QUrl> urls; + for (auto &a: parser.positionalArguments()) + urls.append(QUrl::fromUserInput(a, QDir::currentPath())); + player.addToPlaylist(urls); + } + + player.show(); + return app.exec(); +} |