本文整理汇总了C++中phonon::MediaObject::remainingTime方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject::remainingTime方法的具体用法?C++ MediaObject::remainingTime怎么用?C++ MediaObject::remainingTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phonon::MediaObject
的用法示例。
在下文中一共展示了MediaObject::remainingTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: togglePlayPause
void UBGraphicsAudioItemDelegate::togglePlayPause()
{
if ( mDelegated && mDelegated->mediaObject() )
{
Phonon::MediaObject* media = mDelegated->mediaObject();
if ( media->state() == Phonon::StoppedState ) {
media->play();
} else if ( media->state() == Phonon::PlayingState ) {
if ( media->remainingTime() <= 0 ) {
media->stop();
media->play();
} else {
media->pause();
if ( mDelegated->scene() )
mDelegated->scene()->setModified ( true );
}
} else if ( media->state() == Phonon::PausedState ) {
if ( media->remainingTime() <= 0 ) {
media->stop();
}
media->play();
} else if ( media->state() == Phonon::LoadingState ) {
mDelegated->mediaObject()->setCurrentSource(mDelegated->mediaFileUrl());
media->play();
} else if (media->state() == Phonon::ErrorState){
qDebug() << "Error appeared." << media->errorString();
}
}
}
示例2: togglePlayPause
void UBGraphicsVideoItemDelegate::togglePlayPause()
{
if (delegated() && delegated()->mediaObject())
{
Phonon::MediaObject* media = delegated()->mediaObject();
if (media->state() == Phonon::StoppedState)
{
media->play();
}
else if (media->state() == Phonon::PlayingState)
{
if (media->remainingTime() <= 0)
{
media->stop();
media->play();
}
else
{
media->pause();
if(delegated()->scene())
delegated()->scene()->setModified(true);
}
}
else if (media->state() == Phonon::PausedState)
{
if (media->remainingTime() <= 0)
{
media->stop();
}
media->play();
}
else if ( media->state() == Phonon::LoadingState ){
delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
media->play();
}
else{
qDebug() << "Media state "<< media->state() << " not supported";
}
}
}