本文整理汇总了C++中Album::setRoles方法的典型用法代码示例。如果您正苦于以下问题:C++ Album::setRoles方法的具体用法?C++ Album::setRoles怎么用?C++ Album::setRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::setRoles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleRelease
//.........这里部分代码省略.........
//qDebug()<<xml.name()<<xml.readElementText();
if(xml.name() == "position"){
s.setTrack( xml.readElementText() );
}else if(xml.name() == "title"){
s.setTitle( xml.readElementText() );
}else if(xml.name() == "duration"){
QStringList tmp = xml.readElementText().split(":");
int sum=0;
for(int j=0;j<tmp.size();j++){
sum = sum + ( tmp[j].toInt()*pow(60,tmp.size()-j-1) );
}
s.setLength(sum);
}else{
xml.skipCurrentElement();
}
}
songs.append(s);
}else{
xml.skipCurrentElement();
}
}
}
}
}
//fix/compress roles for artists
//QList<artist> newArtists;
while( Artists.size()>0 ){
QString role = Artists[0].role();
if(role.isEmpty()){
Artists.removeAt(0);
continue;
}
Artist a;a.setRole(role);a.setName(Artists[0].name());
//qDebug()<<role;
for(int j=Artists.size()-1;j>=1;j--){
if( Artists[j].role()==role ){
if( !a.name().contains( Artists[j].name() ) ){
a.setName(a.name()+"/"+Artists[j].name());
//qDebug()<<a.name;
}
Artists.removeAt(j);
}
}
Artists.removeAt(0);
roles.append( a.role()+": "+a.name() );
//newArtists.append(a);
}
//remove html links from notes
QString notes = album.notes();
while(1){
int ind = notes.indexOf("<a href");
if(ind==-1){
break;
}
int ind2 = notes.indexOf(">",ind);
notes.remove(ind,ind2-ind+1);
}
notes.remove("</a>",Qt::CaseInsensitive);
album.setNotes(notes);
if( reply->error() || !err.isEmpty() ){
if( reply->error() ){
err = reply->errorString()+":\n"+err;
}
QMessageBox::critical(0, "Error",
err, QMessageBox::Ok, QMessageBox::Ok);
}
album.setArtists(artists);
album.setRoles(roles);
album.setImages(images);
album.setSongs(songs);
albums_.insert(album.key(),album);
reply->deleteLater();
/*
if(images.size()>0){
//qDebug()<<"starting image downloading for album "+album.title()<<", images: "<<images;
QNetworkRequest coverRequest(images[0]);
coverRequest.setAttribute(QNetworkRequest::User,album.key());
QNetworkAccessManager *coverManager = new QNetworkAccessManager;
connect(coverManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleCover(QNetworkReply*)));
coverManager->get(coverRequest);
}else {
*/
nDownloaded_++;
qDebug()<<"downloaded album "<<album.title();
if( downloadImmediately_ && nDownloaded_==albums_.size() ){
emit albumsDownloaded( albums_ );
}
if(!downloadImmediately_){
emit albumDownloaded( album );
}
//}
}