diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-01-14 00:31:37 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-01-14 00:31:37 (GMT) |
commit | 2ec89699a6f372ccbd92ce2bda753ec0e28f8650 (patch) | |
tree | e8f5a9c9bb8cb41a7e47e7b75cd3f6ddac702814 /demos/qmediaplayer/mediaplayer.cpp | |
parent | 351060bd313220044b9323d59d56627e78deea9f (diff) | |
parent | 48592026bc9eb024f304411895c3f233b2296cfa (diff) | |
download | Qt-2ec89699a6f372ccbd92ce2bda753ec0e28f8650.zip Qt-2ec89699a6f372ccbd92ce2bda753ec0e28f8650.tar.gz Qt-2ec89699a6f372ccbd92ce2bda753ec0e28f8650.tar.bz2 |
Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into kinetic-declarativeui
Conflicts:
bin/syncqt
src/corelib/io/qurl.cpp
Diffstat (limited to 'demos/qmediaplayer/mediaplayer.cpp')
-rw-r--r-- | demos/qmediaplayer/mediaplayer.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 8f6848f..3cb0616 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -673,6 +673,13 @@ void MediaPlayer::setFile(const QString &fileName) m_MediaObject.play(); } +void MediaPlayer::setLocation(const QString& location) +{ + setWindowTitle(location.right(location.length() - location.lastIndexOf('/') - 1)); + m_MediaObject.setCurrentSource(Phonon::MediaSource(QUrl::fromEncoded(location.toUtf8()))); + m_MediaObject.play(); +} + bool MediaPlayer::playPauseForDialog() { // If we're running on a small screen, we want to pause the video when @@ -850,9 +857,7 @@ void MediaPlayer::openUrl() bool ok = false; sourceURL = QInputDialog::getText(this, tr("Open Location"), tr("Please enter a valid address here:"), QLineEdit::Normal, sourceURL, &ok); if (ok && !sourceURL.isEmpty()) { - setWindowTitle(sourceURL.right(sourceURL.length() - sourceURL.lastIndexOf('/') - 1)); - m_MediaObject.setCurrentSource(Phonon::MediaSource(QUrl::fromEncoded(sourceURL.toUtf8()))); - m_MediaObject.play(); + setLocation(sourceURL); settings.setValue("location", sourceURL); } } @@ -892,10 +897,11 @@ void MediaPlayer::openRamFile() } if (!list.isEmpty()) { - m_MediaObject.setCurrentSource(Phonon::MediaSource(list[0])); - m_MediaObject.play(); + m_MediaObject.clearQueue(); + setLocation(list[0].toString()); for (int i = 1; i < list.count(); i++) m_MediaObject.enqueue(Phonon::MediaSource(list[i])); + m_MediaObject.play(); } forwardButton->setEnabled(!m_MediaObject.queue().isEmpty()); |