use setUrl instead of setPath, more general, but still use a qstring,

seems to work better with javascript

svn path=/trunk/KDE/kdelibs/; revision=924896
This commit is contained in:
Marco Martin 2009-02-11 21:34:07 +00:00
parent 2da5f905d3
commit 12c645ff82
2 changed files with 13 additions and 9 deletions

View File

@ -19,6 +19,8 @@
#include "videowidget.h" #include "videowidget.h"
#include <kurl.h>
#include <phonon/videowidget.h> #include <phonon/videowidget.h>
#include <phonon/mediaobject.h> #include <phonon/mediaobject.h>
#include <phonon/mediasource.h> #include <phonon/mediasource.h>
@ -77,14 +79,14 @@ Phonon::AudioOutput *VideoWidget::audioOutput() const
return d->audioOutput; return d->audioOutput;
} }
void VideoWidget::setFile(const QString &path) void VideoWidget::setUrl(const QString &url)
{ {
d->media->setCurrentSource(Phonon::MediaSource(path)); d->media->setCurrentSource(Phonon::MediaSource(url));
} }
QString VideoWidget::file() const QString VideoWidget::url() const
{ {
return d->media->currentSource().fileName(); return d->media->currentSource().url().toString();
} }
void VideoWidget::play() void VideoWidget::play()

View File

@ -30,6 +30,8 @@ namespace Phonon {
class AudioOutput; class AudioOutput;
} }
class KUrl;
namespace Plasma namespace Plasma
{ {
@ -47,7 +49,7 @@ class PLASMA_EXPORT VideoWidget : public QGraphicsProxyWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString file READ file WRITE setFile) Q_PROPERTY(QString url READ url WRITE setUrl)
Q_PROPERTY(QString currentTime READ currentTime) Q_PROPERTY(QString currentTime READ currentTime)
Q_PROPERTY(QString totalTime READ totalTime) Q_PROPERTY(QString totalTime READ totalTime)
Q_PROPERTY(QString remainingTime READ remainingTime) Q_PROPERTY(QString remainingTime READ remainingTime)
@ -58,15 +60,15 @@ public:
~VideoWidget(); ~VideoWidget();
/** /**
* Choose what file to play * Load a certain url that can be a local file or a remote one
* @arg path resource to play * @arg path resource to play
*/ */
void setFile(const QString &path); void setUrl(const QString &url);
/** /**
* @return the file we are playing * @return the url (local or remote) we are playing
*/ */
QString file() const; QString url() const;
/** /**
* @return the Phonon::MediaObject being used * @return the Phonon::MediaObject being used