diff options
Diffstat (limited to 'demos/multimedia/player')
-rw-r--r-- | demos/multimedia/player/player.cpp | 33 | ||||
-rw-r--r-- | demos/multimedia/player/player.pro | 9 | ||||
-rw-r--r-- | demos/multimedia/player/playercontrols.h | 2 | ||||
-rw-r--r-- | demos/multimedia/player/videowidget.h | 2 |
4 files changed, 29 insertions, 17 deletions
diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp index af30a97..bf314ee 100644 --- a/demos/multimedia/player/player.cpp +++ b/demos/multimedia/player/player.cpp @@ -45,8 +45,8 @@ #include "playlistmodel.h" #include "videowidget.h" -#include <QtMultimedia/qmediaservice.h> -#include <QtMultimedia/qmediaplaylist.h> +#include <QtMediaServices/qmediaservice.h> +#include <QtMediaServices/qmediaplaylist.h> #include <QtGui> @@ -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); + } + } } } @@ -204,14 +215,14 @@ void Player::positionChanged(qint64 progress) void Player::metaDataChanged() { - //qDebug() << "update metadata" << player->metaData(QtMultimedia::Title).toString(); + //qDebug() << "update metadata" << player->metaData(QtMediaServices::Title).toString(); if (player->isMetaDataAvailable()) { setTrackInfo(QString("%1 - %2") - .arg(player->metaData(QtMultimedia::AlbumArtist).toString()) - .arg(player->metaData(QtMultimedia::Title).toString())); + .arg(player->metaData(QtMediaServices::AlbumArtist).toString()) + .arg(player->metaData(QtMediaServices::Title).toString())); if (coverLabel) { - QUrl url = player->metaData(QtMultimedia::CoverArtUrlLarge).value<QUrl>(); + QUrl url = player->metaData(QtMediaServices::CoverArtUrlLarge).value<QUrl>(); coverLabel->setPixmap(!url.isEmpty() ? QPixmap(url.toString()) diff --git a/demos/multimedia/player/player.pro b/demos/multimedia/player/player.pro index 929f3cd..0b868bd 100644 --- a/demos/multimedia/player/player.pro +++ b/demos/multimedia/player/player.pro @@ -1,5 +1,7 @@ +TEMPLATE = app +TARGET = player -QT += multimedia +QT += gui mediaservices HEADERS = \ player.h \ @@ -15,9 +17,8 @@ SOURCES = \ videowidget.cpp target.path = $$[QT_INSTALL_DEMOS]/multimedia/player - -sources.files = $$SOURCES $$HEADERS -sources.path = $$[QT_INSTALL_DEMOS]/multimedia/player player.pro +sources.files = $$SOURCES $$HEADERS *.pro +sources.path = $$[QT_INSTALL_DEMOS]/multimedia/player INSTALLS += target sources diff --git a/demos/multimedia/player/playercontrols.h b/demos/multimedia/player/playercontrols.h index 99894ff..d2229bd 100644 --- a/demos/multimedia/player/playercontrols.h +++ b/demos/multimedia/player/playercontrols.h @@ -42,7 +42,7 @@ #ifndef PLAYERCONTROLS_H #define PLAYERCONTROLS_H -#include <QtMultimedia/qmediaplayer.h> +#include <QtMediaServices/qmediaplayer.h> #include <QtGui/qwidget.h> diff --git a/demos/multimedia/player/videowidget.h b/demos/multimedia/player/videowidget.h index 543e1e0..b5bf581 100644 --- a/demos/multimedia/player/videowidget.h +++ b/demos/multimedia/player/videowidget.h @@ -41,7 +41,7 @@ #ifndef VIDEOWIDGET_H #define VIDEOWIDGET_H -#include <QtMultimedia/qvideowidget.h> +#include <QtMediaServices/qvideowidget.h> QT_BEGIN_HEADER |