diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-04-21 02:03:49 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-04-21 02:03:49 (GMT) |
commit | 4819ac8dd5b8699e09fd783ba4795746a0a44839 (patch) | |
tree | 365971d9fe880f090791ea1e1f89b970d8590746 /demos | |
parent | 84c0fb3a16a36704631738e98cac3f1a90330647 (diff) | |
download | Qt-4819ac8dd5b8699e09fd783ba4795746a0a44839.zip Qt-4819ac8dd5b8699e09fd783ba4795746a0a44839.tar.gz Qt-4819ac8dd5b8699e09fd783ba4795746a0a44839.tar.bz2 |
Player demo: load not only local files but playlists and urls passed as
command line arguments.
Reviewed-by: Andrew den Exter
Diffstat (limited to 'demos')
-rw-r--r-- | demos/multimedia/player/player.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp index 6ba19fd..bf314ee 100644 --- a/demos/multimedia/player/player.cpp +++ b/demos/multimedia/player/player.cpp @@ -171,11 +171,22 @@ Player::Player(QWidget *parent) metaDataChanged(); - QStringList fileNames = qApp->arguments(); - fileNames.removeAt(0); - foreach (QString const &fileName, fileNames) { - if (QFileInfo(fileName).exists()) - playlist->addMedia(QUrl::fromLocalFile(fileName)); + QStringList arguments = qApp->arguments(); + arguments.removeAt(0); + foreach (QString const &argument, arguments) { + QFileInfo fileInfo(argument); + if (fileInfo.exists()) { + QUrl url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + if (fileInfo.suffix().toLower() == QLatin1String("m3u")) { + playlist->load(url); + } else + playlist->addMedia(url); + } else { + QUrl url(argument); + if (url.isValid()) { + playlist->addMedia(url); + } + } } } |