本文整理汇总了C++中tomahawk::result_ptr::id方法的典型用法代码示例。如果您正苦于以下问题:C++ result_ptr::id方法的具体用法?C++ result_ptr::id怎么用?C++ result_ptr::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomahawk::result_ptr
的用法示例。
在下文中一共展示了result_ptr::id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
QVariantMap
MprisPlugin::metadata() const
{
QVariantMap metadataMap;
Tomahawk::result_ptr track = AudioEngine::instance()->currentTrack();
if( track )
{
metadataMap.insert( "mpris:trackid", QString( "/track/" ) + track->id().replace( "-", "" ) );
metadataMap.insert( "mpris:length", track->duration() );
metadataMap.insert( "xesam:album", track->album()->name() );
metadataMap.insert( "xesam:artist", track->artist()->name() );
metadataMap.insert( "xesam:title", track->track() );
}
return metadataMap;
}
示例2: coverFile
QVariantMap
MprisPlugin::metadata() const
{
QVariantMap metadataMap;
Tomahawk::result_ptr track = AudioEngine::instance()->currentTrack();
if ( track )
{
metadataMap.insert( "mpris:trackid", QVariant::fromValue(QDBusObjectPath(QString( "/track/" ) + track->id().replace( "-", "" ))) );
metadataMap.insert( "mpris:length", static_cast<qlonglong>(track->duration()) * 1000000 );
metadataMap.insert( "xesam:album", track->album()->name() );
metadataMap.insert( "xesam:artist", QStringList( track->artist()->name() ) );
metadataMap.insert( "xesam:title", track->track() );
// Only return art if tempfile exists, and if its name contains the same "artist_album_tomahawk_cover.png"
if ( !m_coverTempFile.isEmpty() )
{
QFile coverFile( m_coverTempFile );
if ( coverFile.exists() && coverFile.fileName().contains( track->artist()->name() + "_" + track->album()->name() + "_tomahawk_cover.png" ) )
metadataMap.insert( "mpris:artUrl", QString( QUrl::fromLocalFile( m_coverTempFile ).toEncoded() ) );
}
}
return metadataMap;
}