summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJames McDonnell <jmcdonnell@blackberry.com>2017-04-03 16:36:46 -0400
committerJames McDonnell <jmcdonnell@blackberry.com>2017-11-14 17:03:28 +0000
commitc16ce50f2b3362c70d9e1cdf6382b9950e552509 (patch)
tree07fcc4965bb2f517642180f2f5052c166a04f3b7 /examples
parent1cb4027e0a59e1875db88b72afb5833aafbd87eb (diff)
Implement QCustomAudioRoleControl for QNX
Change-Id: I95202ffabbeae36dbb2f2fa43871e0bceed53cae Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/multimediawidgets/player/main.cpp9
-rw-r--r--examples/multimediawidgets/player/player.cpp5
-rw-r--r--examples/multimediawidgets/player/player.h1
3 files changed, 14 insertions, 1 deletions
diff --git a/examples/multimediawidgets/player/main.cpp b/examples/multimediawidgets/player/main.cpp
index 9e6d9358..a20fb1c4 100644
--- a/examples/multimediawidgets/player/main.cpp
+++ b/examples/multimediawidgets/player/main.cpp
@@ -63,14 +63,21 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
+ QCommandLineOption customAudioRoleOption("custom-audio-role",
+ "Set a custom audio role for the player.",
+ "role");
parser.setApplicationDescription("Qt MultiMedia Player Example");
parser.addHelpOption();
parser.addVersionOption();
- parser.addPositionalArgument("url", "The URL to open.");
+ parser.addOption(customAudioRoleOption);
+ parser.addPositionalArgument("url", "The URL(s) to open.");
parser.process(app);
Player player;
+ if (parser.isSet(customAudioRoleOption))
+ player.setCustomAudioRole(parser.value(customAudioRoleOption));
+
if (!parser.positionalArguments().isEmpty() && player.isPlayerAvailable()) {
QList<QUrl> urls;
for (auto &a: parser.positionalArguments())
diff --git a/examples/multimediawidgets/player/player.cpp b/examples/multimediawidgets/player/player.cpp
index 8113df70..4d334085 100644
--- a/examples/multimediawidgets/player/player.cpp
+++ b/examples/multimediawidgets/player/player.cpp
@@ -234,6 +234,11 @@ void Player::addToPlaylist(const QList<QUrl> &urls)
}
}
+void Player::setCustomAudioRole(const QString &role)
+{
+ m_player->setCustomAudioRole(role);
+}
+
void Player::durationChanged(qint64 duration)
{
m_duration = duration / 1000;
diff --git a/examples/multimediawidgets/player/player.h b/examples/multimediawidgets/player/player.h
index 1b30204f..a15d27bd 100644
--- a/examples/multimediawidgets/player/player.h
+++ b/examples/multimediawidgets/player/player.h
@@ -81,6 +81,7 @@ public:
bool isPlayerAvailable() const;
void addToPlaylist(const QList<QUrl> &urls);
+ void setCustomAudioRole(const QString &role);
signals:
void fullScreenChanged(bool fullScreen);