/* called by itdb_track_set_thumbnails() and itdb_track_set_thumbnails_from_data() */ static gboolean itdb_track_set_thumbnails_internal (Itdb_Track *track, const gchar *filename, const guchar *image_data, gsize image_data_len, gpointer *pixbuf, gint rotation, GError **error) { gboolean result = FALSE; g_return_val_if_fail (track, FALSE); g_return_val_if_fail (filename || image_data || pixbuf, FALSE); itdb_artwork_remove_thumbnails (track->artwork); /* clear artwork id */ track->artwork->id = 0; if (filename) { result = itdb_artwork_set_thumbnail (track->artwork, filename, rotation, error); } if (image_data) { result = itdb_artwork_set_thumbnail_from_data (track->artwork, image_data, image_data_len, rotation, error); } if (pixbuf) { result = itdb_artwork_set_thumbnail_from_pixbuf (track->artwork, pixbuf, rotation, error); } if (result == TRUE) { /* some black magic :-( */ /* track->artwork_size should actually be the total size of artwork packed into MP3 tags. We don't write mp3 tags... */ track->artwork_size = track->artwork->artwork_size; /* track->artwork_count should actually be the number of images packed into MP3 tags. */ track->artwork_count = 1; /* for some reason artwork->artwork_size is always track->artwork_size + track->artwork_count */ track->artwork->artwork_size += track->artwork_count; /* indicate artwork is present */ track->has_artwork = 0x01; } else { itdb_track_remove_thumbnails (track); } return result; }
void PropertiesDialog::write() { ipod.DBchanged=true; itdb_track_unlink(currentTrack); currentTrack->album=g_strdup(AlbumBox->text().toLatin1()); currentTrack->artist=g_strdup(ArtistBox->text().toLatin1()); currentTrack->title=g_strdup(TitleBox->text().toLatin1()); if(coverChanged) { itdb_track_remove_thumbnails(currentTrack); AlbumArt->pixmap()->save("tmpcover","JPG",100); itdb_track_set_thumbnails_from_pixbuf(currentTrack,gdk_pixbuf_new_from_file("tmpcover",NULL)); coverChanged=false; } itdb_track_add(ipod.currDB(),currentTrack,-1); emit modified(); }
void PropertiesDialog::removeCover() { itdb_track_remove_thumbnails(currentTrack); AlbumArt->setPixmap(QPixmap(":/images/no-cover-art.jpg")); propChanged(); }