本文整理汇总了C++中playlist_ptr::entries方法的典型用法代码示例。如果您正苦于以下问题:C++ playlist_ptr::entries方法的具体用法?C++ playlist_ptr::entries怎么用?C++ playlist_ptr::entries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlist_ptr
的用法示例。
在下文中一共展示了playlist_ptr::entries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
void
GlobalActionManager::getShortLink( const playlist_ptr& pl )
{
QVariantMap m;
m[ "title" ] = pl->title();
m[ "creator" ] = pl->author().isNull() ? "" : pl->author()->friendlyName();
QVariantList tracks;
foreach( const plentry_ptr& pl, pl->entries() )
{
if ( pl->query().isNull() )
continue;
QVariantMap track;
track[ "title" ] = pl->query()->track();
track[ "creator" ] = pl->query()->artist();
track[ "album" ] = pl->query()->album();
tracks << track;
}
m[ "track" ] = tracks;
QVariantMap jspf;
jspf["playlist"] = m;
QJson::Serializer s;
QByteArray msg = s.serialize( jspf );
// No built-in Qt facilities for doing a FORM POST. So we build the payload ourselves...
const QByteArray boundary = "----------------------------2434992cccab";
QByteArray data(QByteArray("--" + boundary + "\r\n"));
data += "Content-Disposition: form-data; name=\"data\"; filename=\"playlist.jspf\"\r\n";
data += "Content-Type: application/octet-stream\r\n\r\n";
data += msg;
data += "\r\n\r\n";
data += "--" + boundary + "--\r\n\r\n";
const QUrl url( QString( "%1/p/").arg( hostname() ) );
QNetworkRequest req( url );
req.setHeader( QNetworkRequest::ContentTypeHeader, QString( "multipart/form-data; boundary=%1" ).arg( QString::fromLatin1( boundary ) ) );
QNetworkReply *reply = TomahawkUtils::nam()->post( req, data );
connect( reply, SIGNAL( finished() ), SLOT( postShortenFinished() ) );
connect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ), SLOT( shortenLinkRequestError( QNetworkReply::NetworkError ) ) );
}