Commit ee7e3737 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Account for non local non relative video file urls

BUGS: 376574
parent 6f3970db
......@@ -99,6 +99,25 @@ public:
double repetitionsLeft;
};
static QUrl urlFromUrlString(const QString &url, Okular::Document *document)
{
QUrl newurl;
if ( url.startsWith( QLatin1Char( '/' ) ) )
{
newurl = QUrl::fromLocalFile( url );
}
else
{
newurl = QUrl( url );
if ( newurl.isRelative() )
{
newurl = document->currentDocument().adjusted(QUrl::RemoveFilename);
newurl.setPath( newurl.path() + url );
}
}
return newurl;
}
void VideoWidget::Private::load()
{
repetitionsLeft = movie->playRepetitions();
......@@ -107,21 +126,7 @@ void VideoWidget::Private::load()
loaded = true;
QString url = movie->url();
QUrl newurl;
if ( QDir::isRelativePath( url ) )
{
newurl = document->currentDocument().adjusted(QUrl::RemoveFilename);
newurl.setPath( newurl.path() + url );
}
else
{
newurl = QUrl::fromLocalFile(url);
}
if ( newurl.isLocalFile() )
player->load( newurl );
else
player->load( newurl );
player->load( urlFromUrlString( movie->url(), document ) );
connect( player->mediaObject(), SIGNAL( stateChanged( Phonon::State, Phonon::State ) ),
q, SLOT( stateChanged( Phonon::State, Phonon::State ) ) );
......@@ -145,23 +150,8 @@ void VideoWidget::Private::setupPlayPauseAction( PlayPauseMode mode )
void VideoWidget::Private::takeSnapshot()
{
const QString url = movie->url();
QUrl newurl;
if ( QDir::isRelativePath( url ) )
{
newurl = document->currentDocument().adjusted(QUrl::RemoveFilename);
newurl.setPath( newurl.path() + url );
}
else
{
newurl = QUrl::fromLocalFile(url);
}
SnapshotTaker *taker = 0;
if ( newurl.isLocalFile() )
taker = new SnapshotTaker( newurl, q );
else
taker = new SnapshotTaker( newurl, q );
const QUrl url = urlFromUrlString( movie->url(), document );
SnapshotTaker *taker = new SnapshotTaker( url, q );
q->connect( taker, SIGNAL( finished( const QImage& ) ), q, SLOT( setPosterImage( const QImage& ) ) );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment