本文整理汇总了C++中meta::TrackPtr::hasCapabilityInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPtr::hasCapabilityInterface方法的具体用法?C++ TrackPtr::hasCapabilityInterface怎么用?C++ TrackPtr::hasCapabilityInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta::TrackPtr
的用法示例。
在下文中一共展示了TrackPtr::hasCapabilityInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopupDropperAction
QList<PopupDropperAction*>
Playlist::ViewCommon::actionsFor( QWidget *parent, const QModelIndex *index, bool coverActions )
{
QList<PopupDropperAction*> actions;
Meta::TrackPtr track = index->data( Playlist::TrackRole ).value< Meta::TrackPtr >();
PopupDropperAction *separator = new PopupDropperAction( parent );
separator->setSeparator( true );
const bool isCurrentTrack = index->data( Playlist::ActiveTrackRole ).toBool();
PopupDropperAction *stopAction = new PopupDropperAction( KIcon( "media-playback-stop-amarok" ), i18n( "Stop Playing After This Track" ), parent );
QObject::connect( stopAction, SIGNAL( triggered() ), parent, SLOT( stopAfterTrack() ) );
actions << stopAction;
actions << separator;
const bool isQueued = index->data( Playlist::StateRole ).toInt() & Item::Queued;
const QString queueText = !isQueued ? i18n( "Queue Track" ) : i18n( "Dequeue Track" );
PopupDropperAction *queueAction = new PopupDropperAction( KIcon( "media-track-queue-amarok" ), queueText, parent );
if( isQueued )
QObject::connect( queueAction, SIGNAL( triggered() ), parent, SLOT( dequeueSelection() ) );
else
QObject::connect( queueAction, SIGNAL( triggered() ), parent, SLOT( queueSelection() ) );
actions << queueAction;
actions << separator;
PopupDropperAction *removeAction = new PopupDropperAction( KIcon( "media-track-remove-amarok" ), i18n( "Remove From Playlist" ), parent );
QObject::connect( removeAction, SIGNAL( triggered() ), parent, SLOT( removeSelection() ) );
actions << removeAction;
actions << separator;
//lets see if parent is the currently playing tracks, and if it has CurrentTrackActionsCapability
if( isCurrentTrack )
{
QList<QAction*> globalCurrentTrackActions = The::globalCurrentTrackActions()->actions();
foreach( QAction *action, globalCurrentTrackActions )
actions << PopupDropperAction::from( action );
if ( track->hasCapabilityInterface( Meta::Capability::CurrentTrackActions ) )
{
Meta::CurrentTrackActionsCapability *cac = track->create<Meta::CurrentTrackActionsCapability>();
if ( cac )
{
QList<PopupDropperAction *> actions = cac->customActions();
foreach( PopupDropperAction *action, actions )
actions << action;
}
delete cac;
}
}
actions << separator;
if ( coverActions )
{
Meta::AlbumPtr album = track->album();
if ( album )
{
Meta::CustomActionsCapability *cac = album->create<Meta::CustomActionsCapability>();
if ( cac )
{
QList<PopupDropperAction *> customActions = cac->customActions();
foreach( PopupDropperAction *customAction, customActions )
actions << customAction;
}
delete cac;
}
}
actions << separator;
const bool isMultiSource = index->data( Playlist::MultiSourceRole ).toBool();
if( isMultiSource )
{
PopupDropperAction *selectSourceAction = new PopupDropperAction( KIcon( "media-playlist-repeat" ), i18n( "Select Source" ), parent );
QObject::connect( selectSourceAction, SIGNAL( triggered() ), parent, SLOT( selectSource() ) );
actions << selectSourceAction;
}
PopupDropperAction *editAction = new PopupDropperAction( KIcon( "media-track-edit-amarok" ), i18n( "Edit Track Details" ), parent );
QObject::connect( editAction, SIGNAL( triggered() ), parent, SLOT( editTrackInformation() ) );
actions << editAction;
return actions;
}