diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-11-20 12:19:09 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-11-20 12:19:09 (GMT) |
commit | b5294497836db44261c97cfeab28d0ac4f8402f1 (patch) | |
tree | c4331314445b41166ce2cd22a80c9fb9f46b5023 /demos/qmediaplayer | |
parent | 2473ab1cf217a989849190cbfa47fe312698adb9 (diff) | |
parent | 1b8d5bec5763708c66e7bd586aee3df7f94b5cb5 (diff) | |
download | Qt-b5294497836db44261c97cfeab28d0ac4f8402f1.zip Qt-b5294497836db44261c97cfeab28d0ac4f8402f1.tar.gz Qt-b5294497836db44261c97cfeab28d0ac4f8402f1.tar.bz2 |
Merge branch '4.6' into mmfphonon
Conflicts:
demos/qmediaplayer/mediaplayer.cpp
Diffstat (limited to 'demos/qmediaplayer')
-rw-r--r-- | demos/qmediaplayer/mediaplayer.cpp | 54 | ||||
-rw-r--r-- | demos/qmediaplayer/mediaplayer.h | 1 | ||||
-rw-r--r-- | demos/qmediaplayer/qmediaplayer.pro | 2 |
3 files changed, 54 insertions, 3 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 4e0da3f..8f6848f 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -271,11 +271,14 @@ MediaPlayer::MediaPlayer(const QString &filePath, fileMenu = new QMenu(this); QAction *openFileAction = fileMenu->addAction(tr("Open &File...")); QAction *openUrlAction = fileMenu->addAction(tr("Open &Location...")); + QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File...")); + + connect(openLinkAction, SIGNAL(triggered(bool)), this, SLOT(openRamFile())); fileMenu->addSeparator(); QMenu *aspectMenu = fileMenu->addMenu(tr("&Aspect ratio")); QActionGroup *aspectGroup = new QActionGroup(aspectMenu); - connect(aspectGroup, SIGNAL(triggered(QAction *)), this, SLOT(aspectChanged(QAction *))); + connect(aspectGroup, SIGNAL(triggered(QAction*)), this, SLOT(aspectChanged(QAction*))); aspectGroup->setExclusive(true); QAction *aspectActionAuto = aspectMenu->addAction(tr("Auto")); aspectActionAuto->setCheckable(true); @@ -293,7 +296,7 @@ MediaPlayer::MediaPlayer(const QString &filePath, QMenu *scaleMenu = fileMenu->addMenu(tr("&Scale mode")); QActionGroup *scaleGroup = new QActionGroup(scaleMenu); - connect(scaleGroup, SIGNAL(triggered(QAction *)), this, SLOT(scaleChanged(QAction *))); + connect(scaleGroup, SIGNAL(triggered(QAction*)), this, SLOT(scaleChanged(QAction*))); scaleGroup->setExclusive(true); QAction *scaleActionFit = scaleMenu->addAction(tr("Fit in view")); scaleActionFit->setCheckable(true); @@ -332,7 +335,7 @@ MediaPlayer::MediaPlayer(const QString &filePath, connect(&m_MediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(updateTime())); connect(&m_MediaObject, SIGNAL(tick(qint64)), this, SLOT(updateTime())); connect(&m_MediaObject, SIGNAL(finished()), this, SLOT(finished())); - connect(&m_MediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); + connect(&m_MediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(&m_MediaObject, SIGNAL(bufferStatus(int)), this, SLOT(bufferStatus(int))); connect(&m_MediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasVideoChanged(bool))); @@ -854,6 +857,51 @@ void MediaPlayer::openUrl() } } +/*! + \since 4.6 + */ +void MediaPlayer::openRamFile() +{ + QSettings settings; + settings.beginGroup(QLatin1String("BrowserMainWindow")); + + const QStringList fileNameList(QFileDialog::getOpenFileNames(this, + QString(), + settings.value("openRamFile").toString(), + QLatin1String("RAM files (*.ram)"))); + + if (fileNameList.isEmpty()) + return; + + QFile linkFile; + QList<QUrl> list; + QByteArray sourceURL; + for (int i = 0; i < fileNameList.count(); i++ ) { + linkFile.setFileName(fileNameList[i]); + if (linkFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!linkFile.atEnd()) { + sourceURL = linkFile.readLine().trimmed(); + if (!sourceURL.isEmpty()) { + const QUrl url(QUrl::fromEncoded(sourceURL)); + if (url.isValid()) + list.append(url); + } + } + linkFile.close(); + } + } + + if (!list.isEmpty()) { + m_MediaObject.setCurrentSource(Phonon::MediaSource(list[0])); + m_MediaObject.play(); + for (int i = 1; i < list.count(); i++) + m_MediaObject.enqueue(Phonon::MediaSource(list[i])); + } + + forwardButton->setEnabled(!m_MediaObject.queue().isEmpty()); + settings.setValue("openRamFile", fileNameList[0]); +} + void MediaPlayer::finished() { } diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 00f9b54..14ed4ac 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -139,6 +139,7 @@ private slots: void showContextMenu(const QPoint& point); void bufferStatus(int percent); void openUrl(); + void openRamFile(); void configureEffect(); void hasVideoChanged(bool); diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro index 2f15c28..9407a81 100644 --- a/demos/qmediaplayer/qmediaplayer.pro +++ b/demos/qmediaplayer/qmediaplayer.pro @@ -32,4 +32,6 @@ symbian { DEPLOYMENT += addFiles include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) + + TARGET.CAPABILITY="NetworkServices" } |