本文整理汇总了C++中Media::path方法的典型用法代码示例。如果您正苦于以下问题:C++ Media::path方法的具体用法?C++ Media::path怎么用?C++ Media::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayFile
void Player::PlayFile(const Media& entry, bool play_file)
{
media_.clearQueue();
if (entry.valid())
{
if (play_file || file_active_)
{
LOG("Player") << "Play: " << entry;
media_.setCurrentSource(entry.path());
media_.play();
file_active_ = true;
}
}
else
{
Stop();
}
}
示例2: info
void MediaInfoPanel::info( Media &media )
{
clear();
WContainerWidget *header = WW<WContainerWidget>().setContentAlignment( AlignCenter );
Dbo::Transaction t( *d->session );
WString title = media.title( t );
header->addWidget( WW<WText>( title ).css( "media-title" ) );
Dbo::ptr<MediaAttachment> previewAttachment = media.preview( t, Media::PreviewPlayer );
if( previewAttachment )
{
WLink previewLink = previewAttachment->link( previewAttachment, t, header );
WLink fullImage = previewLink;
Dbo::ptr<MediaAttachment> fullImageAttachment = media.preview( t, Media::PreviewFull );
if( fullImageAttachment )
fullImage = fullImageAttachment->link( fullImageAttachment, t, header );
WAnchor *fullImageLink = new WAnchor {fullImage, WW<WImage>(previewLink, title).css("img-responsive img-rounded")};
fullImageLink->setTarget( Wt::AnchorTarget::TargetNewWindow );
header->addWidget( fullImageLink );
}
else
{
auto iconType = ( media.mimetype().find( "video" ) == string::npos ) ? Settings::AudioFile : Settings::VideoFile;
WImage *icon = new WImage { d->settings->icon( iconType ) };
header->addWidget( icon );
}
auto mediaMediaInfoPanel = d->createPanel( "mediabrowser.information" );
WTable *table = new WTable( mediaMediaInfoPanel.second );
table->setWidth( WLength( 100, WLength::Percentage ) );
d->labelValueBox( "mediabrowser.filename", WString::fromUTF8(media.filename()), table );
d->labelValueBox( "mediabrowser.filesize", Utils::formatFileSize( fs::file_size( media.path() ) ), table );
MediaPropertiesPtr mediaProperties = media.properties( t );
if( mediaProperties )
{
d->labelValueBox( "mediabrowser.creation_time", mediaProperties->creationTime().toString(), table );
d->labelValueBox( "mediabrowser.medialength", WTime( 0, 0, 0 ).addSecs( mediaProperties->duration() ).toString(), table );
if( media.mimetype().find( "video" ) != string::npos && mediaProperties->width() > 0 && mediaProperties->height() > 0 )
d->labelValueBox( "mediabrowser.resolution", WString( "{1}x{2}" ).arg( mediaProperties->width() ).arg( mediaProperties->height() ), table );
}
Ratings rating = MediaRating::ratingFor( media, t );
if( rating.users > 0 )
{
WContainerWidget *avgRatingWidget = new WContainerWidget;
for( int i = 1; i <= 5; i++ )
{
avgRatingWidget->addWidget( WW<WImage>( Settings::staticPath( "/icons/rating_small.png" ) ).css( rating.ratingAverage < i ? "rating-unrated" : "" ) );
}
d->labelValueBox( "mediabrowser.rating", avgRatingWidget, table );
}
auto actions = d->createPanel( "mediabrowser.actions" );
actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.play" ) ).css( "btn btn-block btn-sm btn-primary" ).onClick( [ = ]( WMouseEvent )
{
d->play.emit( media );
} ) );
actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.queue" ) ).css( "btn btn-block btn-sm" ).onClick( [ = ]( WMouseEvent )
{
d->queue.emit( media );
} ) );
actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.share" ) ).css( "btn btn-block btn-sm" ).onClick( [ = ]( WMouseEvent )
{
Wt::Dbo::Transaction t( *d->session );
WW<WMessageBox>(wtr( "mediabrowser.share" ),
wtr( "mediabrowser.share.dialog" )
.arg( media.title( t ) )
.arg( d->settings->shareLink( media.uid() ).url() ),
Wt::Information, Ok)
.button(Ok, [=](WMessageBox *msgBox){ msgBox->accept(); }).get()->show();
} ) );
addWidget( WW<WPushButton>( wtr( "button.close.info" ) ).css( "btn btn-primary btn-block hidden-lg hidden-md" )
.onClick( [ = ]( WMouseEvent )
{
wasResetted().emit();
} ) );
actions.second->addWidget( WW<WPushButton>( wtr( "player.downloadlink" ) ).css( "btn btn-block btn-sm btn-success" ).onClick( [ = ]( WMouseEvent )
{
WDialog *downloadDialog = new WDialog(wtr("player.downloadlink"));
downloadDialog->contents()->addWidget(new WText{wtr("player.downloadlink.message").arg(d->settings->linkFor( media.path() , d->session).url()), XHTMLUnsafeText});
downloadDialog->footer()->addWidget(WW<WPushButton>(wtr("button.ok")).css("btn btn-primary").onClick([=](WMouseEvent){ downloadDialog->accept(); }));
downloadDialog->show();
} ) );
addWidget( WW<WPushButton>( wtr( "button.close.info" ) ).css( "btn btn-primary btn-block hidden-lg hidden-md" )
.onClick( [ = ]( WMouseEvent )
{
wasResetted().emit();
} ) );
addWidget( header );
addWidget( mediaMediaInfoPanel.first );
addWidget( actions.first );
//.........这里部分代码省略.........