diff options
Diffstat (limited to 'demos/multimedia')
-rw-r--r-- | demos/multimedia/multimedia.pro | 3 | ||||
-rw-r--r-- | demos/multimedia/player/player.cpp | 33 | ||||
-rw-r--r-- | demos/multimedia/player/player.pro | 2 | ||||
-rw-r--r-- | demos/multimedia/player/playercontrols.h | 2 | ||||
-rw-r--r-- | demos/multimedia/player/videowidget.h | 2 |
5 files changed, 26 insertions, 16 deletions
diff --git a/demos/multimedia/multimedia.pro b/demos/multimedia/multimedia.pro index 042650f..fa29a12 100644 --- a/demos/multimedia/multimedia.pro +++ b/demos/multimedia/multimedia.pro @@ -1,4 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = player - +contains(QT_CONFIG, mediaservices): SUBDIRS = player 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 dc731e4..fb93416 100644 --- a/demos/multimedia/player/player.pro +++ b/demos/multimedia/player/player.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = player -QT += gui multimedia +QT += gui mediaservices HEADERS = \ 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 |