summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-11-23 08:44:52 (GMT)
committeraxis <qt-info@nokia.com>2009-11-23 08:44:52 (GMT)
commit76b66d6da548ce4a247727f14e09b1d301330db5 (patch)
tree0e678a4e278af8c2ddb5ebd35f572dd331cd6dd6 /demos
parent50465c3409d699612a59b6c1d16e3502bb3a92fd (diff)
parent1b8d5bec5763708c66e7bd586aee3df7f94b5cb5 (diff)
downloadQt-76b66d6da548ce4a247727f14e09b1d301330db5.zip
Qt-76b66d6da548ce4a247727f14e09b1d301330db5.tar.gz
Qt-76b66d6da548ce4a247727f14e09b1d301330db5.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-staging2
Diffstat (limited to 'demos')
-rw-r--r--demos/qmediaplayer/mediaplayer.cpp48
-rw-r--r--demos/qmediaplayer/mediaplayer.h1
-rw-r--r--demos/qmediaplayer/qmediaplayer.pro2
3 files changed, 51 insertions, 0 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp
index 4021352..f8ca8ea 100644
--- a/demos/qmediaplayer/mediaplayer.cpp
+++ b/demos/qmediaplayer/mediaplayer.cpp
@@ -266,6 +266,9 @@ 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"));
@@ -835,6 +838,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 a1c3d92..a8f18f0 100644
--- a/demos/qmediaplayer/mediaplayer.h
+++ b/demos/qmediaplayer/mediaplayer.h
@@ -107,6 +107,7 @@ private slots:
void showContextMenu(const QPoint &);
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"
}