void EditMetadataDialog::updateImageGrid() { AlbumArtList *albumArtList = albumArt->getImageList(); QSize size = coverart_grid->getImageItemSize(); for (int x = 0; x < albumArtList->size(); x++) { if (albumArtList->at(x)->embedded) continue; QPixmap *pixmap = createScaledPixmap(albumArtList->at(x)->filename, size.width(), size.height(), Qt::KeepAspectRatio); ImageGridItem *item = new ImageGridItem(AlbumArtImages::getTypeName(albumArtList->at(x)->imageType), pixmap, false, (void*) albumArtList->at(x)); coverart_grid->appendItem(item); } coverart_grid->setItemCount(albumArtList->size()); coverart_grid->recalculateLayout(); if (!albumArtList->empty()) gridItemChanged(coverart_grid->getItemAt(0)); coverart_grid->refresh(); }
void EditAlbumartDialog::updateImageGrid(void) { AlbumArtList *albumArtList = m_albumArt->getImageList(); m_coverartList->Reset(); for (int x = 0; x < albumArtList->size(); x++) { MythUIButtonListItem *item = new MythUIButtonListItem(m_coverartList, AlbumArtImages::getTypeName(albumArtList->at(x)->imageType), qVariantFromValue(albumArtList->at(x))); item->SetImage(albumArtList->at(x)->filename); QString state = albumArtList->at(x)->embedded ? "tag" : "file"; item->DisplayState(state, "locationstate"); } }
void Metadata::setEmbeddedAlbumArt(AlbumArtList &albumart) { // add the images found in the tag to the ones we got from the DB if (!m_albumArt) m_albumArt = new AlbumArtImages(this); for (int x = 0; x < albumart.size(); x++) { m_albumArt->addImage(albumart.at(x)); } m_changed = true; }
void EditMetadataCommon::scanForImages(void) { // clear the original images AlbumArtList *imageList = m_metadata->getAlbumArtImages()->getImageList(); while (!imageList->isEmpty()) { delete imageList->back(); imageList->pop_back(); } // scan the directory for images QFileInfo fi(m_metadata->Filename()); QDir dir = fi.absoluteDir(); QString nameFilter = gCoreContext->GetSetting("AlbumArtFilter", "*.png;*.jpg;*.jpeg;*.gif;*.bmp"); dir.setNameFilters(nameFilter.split(";")); QStringList files = dir.entryList(); for (int x = 0; x < files.size(); x++) { AlbumArtImage *image = new AlbumArtImage(); //image->id = 0; image->filename = dir.absolutePath() + '/' + files.at(x); image->embedded = false; image->imageType = AlbumArtImages::guessImageType(image->filename); image->description = ""; m_metadata->getAlbumArtImages()->addImage(image); } // scan the tracks tag for any images MetaIO *tagger = m_metadata->getTagger(); if (tagger->supportsEmbeddedImages()) { AlbumArtList art = tagger->getAlbumArtList(m_metadata->Filename()); for (int x = 0; x < art.count(); x++) { AlbumArtImage image = art.at(x); m_metadata->getAlbumArtImages()->addImage(image); } } }