|
|
@ -145,48 +145,34 @@ UBGraphicsVideoItem* UBGraphicsVideoItemDelegate::delegated() |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsVideoItemDelegate::togglePlayPause() |
|
|
|
void UBGraphicsVideoItemDelegate::togglePlayPause() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (delegated() && delegated()->mediaObject()) |
|
|
|
if (delegated() && delegated()->mediaObject()) { |
|
|
|
{ |
|
|
|
|
|
|
|
Phonon::MediaObject* media = delegated()->mediaObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (media->state() == Phonon::StoppedState) |
|
|
|
Phonon::MediaObject* media = delegated()->mediaObject(); |
|
|
|
{ |
|
|
|
if (media->state() == Phonon::StoppedState) { |
|
|
|
media->play(); |
|
|
|
media->play(); |
|
|
|
} |
|
|
|
} else if (media->state() == Phonon::PlayingState) { |
|
|
|
else if (media->state() == Phonon::PlayingState) |
|
|
|
if (media->remainingTime() <= 0) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (media->remainingTime() <= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
media->stop(); |
|
|
|
media->stop(); |
|
|
|
media->play(); |
|
|
|
media->play(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
media->pause(); |
|
|
|
media->pause(); |
|
|
|
if(delegated()->scene()) |
|
|
|
if(delegated()->scene()) |
|
|
|
delegated()->scene()->setModified(true); |
|
|
|
delegated()->scene()->setModified(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (media->state() == Phonon::PausedState) { |
|
|
|
else if (media->state() == Phonon::PausedState) |
|
|
|
if (media->remainingTime() <= 0) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (media->remainingTime() <= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
media->stop(); |
|
|
|
media->stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
media->play(); |
|
|
|
media->play(); |
|
|
|
} |
|
|
|
} else if ( media->state() == Phonon::LoadingState ) { |
|
|
|
else if ( media->state() == Phonon::LoadingState ){ |
|
|
|
|
|
|
|
delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); |
|
|
|
delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); |
|
|
|
media->play(); |
|
|
|
media->play(); |
|
|
|
} |
|
|
|
} else if (media->state() == Phonon::ErrorState){ |
|
|
|
else{ |
|
|
|
qDebug() << "Error appeared." << media->errorString(); |
|
|
|
qDebug() << "Media state "<< media->state() << " not supported"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsVideoItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) |
|
|
|
void UBGraphicsVideoItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(newstate); |
|
|
|
Q_UNUSED(newstate); |
|
|
@ -338,7 +324,6 @@ void DelegateVideoControl::seekToMousePos(QPointF mousePos) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DelegateVideoControl::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
void DelegateVideoControl::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mDisplayCurrentTime = false; |
|
|
|
mDisplayCurrentTime = false; |
|
|
|