本文整理汇总了C++中Media::title方法的典型用法代码示例。如果您正苦于以下问题:C++ Media::title方法的具体用法?C++ Media::title怎么用?C++ Media::title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: t
LatestCommentsDialog::LatestCommentsDialog(Session* session, MediaCollection *mediaCollection, WObject* parent): WDialog{parent}
{
setResizable(true);
setWindowTitle(wtr("menu.latest.comments"));
setClosable(true);
setTransient(true);
setMaximumSize(700, WLength::Auto);
Dbo::Transaction t(*session);
Dbo::collection<CommentPtr> latestComments = session->find<Comment>().orderBy("last_updated desc").limit(5);
if(!latestComments.size())
contents()->addWidget(new WText{wtr("comments.empty")});
for(CommentPtr comment: latestComments) {
WContainerWidget* commentWidget = new WContainerWidget;
Media media = mediaCollection->media(comment->mediaId());
WContainerWidget *header = WW<WContainerWidget>();
header->setContentAlignment(AlignCenter);
WAnchor *videoLink = WW<WAnchor>("", media.title(t)).css("link-hand label label-info comment-box-element");
header->addWidget(videoLink);
Dbo::ptr<AuthInfo> authInfo = session->find<AuthInfo>().where("user_id = ?").bind(comment->user().id());
header->addWidget(WW<WText>(WString("{1} ({2})").arg(authInfo->identity("loginname")).arg(comment->lastUpdated().toString()))
.css("label label-success comment-box-element"));
commentWidget->addWidget(header);
videoLink->clicked().connect([=](WMouseEvent){
_mediaClicked.emit(media);
accept();
});
commentWidget->addWidget(WW<WText>(WString::fromUTF8(comment->content())).css("well comment-text comment-box-element").setInline(false));
contents()->addWidget(WW<WContainerWidget>().css("comment-text").add(commentWidget));
}
}
示例2: t
QueueItem::QueueItem(Media media, std::list< QueueItem* >& queue, WContainerWidget* container, Session* session, WContainerWidget* parent)
: WContainerWidget(parent), PlaylistItem(media)
{
QueueItem *queueItem = this;
Dbo::Transaction t(*session);
WAnchor *anchor = new WAnchor{this};
anchor->addWidget(WW<WText>(media.title(t)).css("link-hand").onClick([=](WMouseEvent&){ playSignal.emit(this); }));
WContainerWidget *actionsContainer = WW<WContainerWidget>(anchor).css("pull-right");
auto fixButtons = [=,&queue] {
for(QueueItem *item: queue) {
item->upButton->setHidden(item == queue.front());
item->downButton->setHidden(item == queue.back());
}
};
auto moveElement = [=,&queue](int direction) {
auto element = std::find(begin(queue), end(queue), queueItem);
auto nextElement = element;
direction>0 ? nextElement++ : nextElement--;
swap(*nextElement, *element);
int index = container->indexOf(queueItem);
container->removeWidget(queueItem);
container->insertWidget(index + direction, queueItem);
fixButtons();
};
actionsContainer->addWidget(upButton = WW<WImage>(Settings::staticPath("/icons/actions/up.png"))
.css("link-hand").onClick([=,&queue](WMouseEvent){
if(queue.front() == queueItem) return;
moveElement(-1);
}));
actionsContainer->addWidget(downButton = WW<WImage>(Settings::staticPath("/icons/actions/down.png"))
.css("link-hand").onClick([=,&queue](WMouseEvent){
if(queue.back() == queueItem) return;
moveElement(+1);
}));
actionsContainer->addWidget(removeButton = WW<WImage>(Settings::staticPath("/icons/actions/delete.png"))
.css("link-hand").onClick([=,&queue](WMouseEvent){
queue.erase(std::remove(begin(queue), end(queue), queueItem));
delete queueItem;
fixButtons();
}));
upButton->setHiddenKeepsGeometry(true);
downButton->setHiddenKeepsGeometry(true);
container->addWidget(this);
queue.push_back(this);
fixButtons();
}
示例3: 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 );
//.........这里部分代码省略.........