本文整理汇总了C++中Album::images方法的典型用法代码示例。如果您正苦于以下问题:C++ Album::images方法的具体用法?C++ Album::images怎么用?C++ Album::images使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::images方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveCoverNow
void SearchDialog::saveCoverNow(){
int ind = searchResults->currentRow();
if(ind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
if(album.images().size()==0){
return;
}
QList<QUrl> images = album.images();
saveCover( images[currentCoverInd] );
}
示例2: showCover
void SearchDialog::showCover( int ind ){
int aind = searchResults->currentRow();
if(aind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
QList<QUrl> images = album.images();
int n = images.size();
//qDebug()<<"Trying to set cover "<<ind<<" of "<<n;
if( n==0 ){
currentCoverInd=0;
return;
}
if( ind<0 ){
ind=0;
}
if( ind>=n ){
ind=n-1;
}
setCover( images[ind] );
//qDebug()<<"Set cover "<<ind<<" of "<<n;
currentCoverInd = ind;
coverLabel->setText("Cover "+QString::number(ind+1)+" of "+QString::number(n));
}
示例3: saveCoverFromReply
void SearchDialog::saveCoverFromReply(QNetworkReply* reply){
//image to be saved must exist in albumLineEdit.images
QByteArray data = reply->readAll();
QImage p;
p.loadFromData(data);
p.convertToFormat(QImage::Format_RGB32);
reply->deleteLater();
int aind = searchResults->currentRow();
if(aind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
QList<QUrl> images = album.images();
QString url = reply->url().toString();
int cInd=-1;
for(int i=0;i<images.size();i++){
if(url==images[i].toString()){
cInd=i;
break;
}
}
if(cInd==-1){
return;
}
QString name = images[cInd].toString();
//qDebug()<<name;
int ind = name.lastIndexOf("/");
if(ind==-1){
ind = name.lastIndexOf("\\");
}
name = name.remove(0,ind+1);
if(coverFormatCheckBox->isChecked()){
int suffInd = name.lastIndexOf(".");
QString ext = name.right(name.size()-suffInd);
name = createCoverName( cInd+1, ext );
}
//qDebug()<<name;
QString path = items_[0]->fileInfo().absoluteDir().absolutePath();
name = path+"/"+name;
int quality = settings->value("SearchDialog/coverQuality",-1).toInt();
bool ok = p.save( name, 0, quality );
if(!ok){
QMessageBox::critical(this, "Could not save cover",
"Could not save cover "+url+" as "+name, QMessageBox::Ok, QMessageBox::Ok);
}else{
qDebug()<<"saved"<<name;
}
}
示例4: showAlbumAndCover
void SearchDialog::showAlbumAndCover( const Album &album ){
if(album.images().size()==0){
//if( databaseComboBox->itemData(databaseComboBox->currentIndex()).toInt()==SearchDialog::MUSICBRAINZ ){
if( database_->type()==MusicDatabase::MUSICBRAINZ ){
cover->setText("Covers are not available from MusicBrainz");
}else{
cover->setText("No cover found...");
}
coverLabel->setText("");
}else{
showCover( 0 );
}
showAlbumInfo( album );
}
示例5: save
//.........这里部分代码省略.........
continue;
}
qDebug()<<"saving "<<fullfile;
//title
if(albumInfo->item(i,TableWidget::TITLE)){
tagItem->setTitle( albumInfo->item(i,TableWidget::TITLE)->text() );
}
//track
if(albumInfo->item(i,TableWidget::TRACK)){
int tmp = albumInfo->item(i,TableWidget::TRACK)->text().toInt(&trackOk,10);
if(trackOk){
tagItem->setTrack( tmp );
}
}
//add extra info to comments if checked
QString comments = "";
if( albumInfo->item(i,TableWidget::COMMENT) && !clearPreviousComentsCheckBox->isChecked() ){
comments = albumInfo->item(i,TableWidget::COMMENT)->text();
}
QString tmp="Format: "+formatLineEdit->text();
if(formatLabel->isVisible() && formatLabel->isChecked() && !comments.contains(tmp) && !formatLineEdit->text().isEmpty() ){
if(!comments.isEmpty()){ comments.append("\n"); }
comments.append(tmp);
}
tmp="Country: "+countryLineEdit->text();
if(countryLabel->isVisible() && countryLabel->isChecked() && !comments.contains(tmp) && !countryLineEdit->text().isEmpty() ){
if(!comments.isEmpty()){ comments.append("\n"); }
comments.append(tmp);
}
tmp="Label: "+labelLineEdit->text();
if(labelLabel->isVisible() && labelLabel->isChecked() && !comments.contains(tmp) && !labelLineEdit->text().isEmpty() ){
if(!comments.isEmpty()){ comments.append("\n"); }
comments.append(tmp);
}
tmp="Roles: "+rolesTextEdit->toPlainText();
if(rolesLabel->isVisible() && rolesLabel->isChecked() && !comments.contains(tmp) && !rolesTextEdit->toPlainText().isEmpty() ){
if(!comments.isEmpty()){ comments.append("\n"); }
comments.append(tmp);
}
tmp="Notes: "+notesTextEdit->toPlainText();
if(notesLabel->isVisible() && notesLabel->isChecked() && !comments.contains(tmp) && !notesTextEdit->toPlainText().isEmpty() ){
if(!comments.isEmpty()){ comments.append("\n"); }
comments.append(tmp);
}
commentsList.insert(fullfile,comments);
//comments
if(albumInfo->item(i,TableWidget::COMMENT)){
tagItem->setComment( comments );
}
//album
if(albumLabel->isChecked()){
tagItem->setAlbum( albumLineEdit->text() );
}
//artist
if(artistLabel->isChecked()){
tagItem->setArtist( artistLineEdit->text() );
}
//genre
if(genreLabel->isVisible() && genreLabel->isChecked()){
tagItem->setGenre( genreLineEdit->text() );
}
//year
if(yearLabel->isChecked()){
int tmp = yearLineEdit->text().toInt(&yearOk,10);
if(yearOk){
tagItem->setYear( tmp );
}
}
bool saveOk = tagItem->saveTag();
if(!saveOk){
log.append("\nCould not save tag for "+fullfile);
}
}
//at last, update saved data in table and labels
setItems();
//save covers at last, in case tags are used to name covers
if( saveCoverCheckBox->isChecked() && !saveAllCoversCheckBox->isChecked() ){
if( currentCoverInd>=0 && currentCoverInd<album.images().size() ){
QList<QUrl> images = album.images();
saveCover( images[currentCoverInd] );
}
}else if( saveAllCoversCheckBox->isChecked() ){
//save all covers
QList<QUrl> images = album.images();
for(int i=0;i<images.size();i++){
saveCover( images[i] );
}
}
//show log if any
if(!log.isEmpty()){
TextViewer t(log);
t.exec();
}
info->setText("Tags saved");
//albumInfo->setSortingEnabled(enabled);
}