void MetadataTask::run() { if(d->cancel) { return; } if (d->direction == MetadataSynchronizer::WriteFromDatabaseToFile) { MetadataHub fileHub; // read in from database fileHub.load(d->item); // write out to file DMetadata if(d->tagsOnly) { fileHub.writeTags(d->item.filePath()); } else { fileHub.write(d->item.filePath(), MetadataHub::WRITE_ALL, true); } } else // MetadataSynchronizer::ReadFromFileToDatabase { CollectionScanner scanner; scanner.scanFile(d->item, CollectionScanner::Rescan); } emit signalFinished(QImage()); emit signalDone(); }
void ImageWindow::assignColorLabel(const ImageInfo& info, int colorId) { if (!info.isNull()) { MetadataHub hub; hub.load(info); hub.setColorLabel(colorId); hub.write(info, MetadataHub::PartialWrite); hub.write(info.filePath(), MetadataHub::FullWriteIfChanged); } }
void ImageWindow::slotRemoveTag(int tagID) { if (!d->currentImageInfo.isNull()) { MetadataHub hub; hub.load(d->currentImageInfo); hub.setTag(tagID, false); hub.write(d->currentImageInfo, MetadataHub::PartialWrite); hub.write(d->currentImageInfo.filePath(), MetadataHub::FullWriteIfChanged); } }
void LightTableThumbBar::toggleTag(int tagID) { ImageInfo info/* = currentItemImageInfo()*/; if (!info.isNull()) { MetadataHub hub; hub.load(info); hub.setTag(tagID, !info.tagIds().contains(tagID)); hub.write(info, MetadataHub::PartialWrite); hub.write(info.filePath(), MetadataHub::FullWriteIfChanged); } }
void LightTableThumbBar::assignRating(const ImageInfo& info, int rating) { rating = qMin(5, qMax(0, rating)); if (!info.isNull()) { MetadataHub hub; hub.load(info); hub.setRating(rating); hub.write(info, MetadataHub::PartialWrite); hub.write(info.filePath(), MetadataHub::FullWriteIfChanged); } }
void ImageWindow::assignRating(const ImageInfo& info, int rating) { rating = qMin(RatingMax, qMax(RatingMin, rating)); if (!info.isNull()) { MetadataHub hub; hub.load(info); hub.setRating(rating); hub.write(info, MetadataHub::PartialWrite); hub.write(info.filePath(), MetadataHub::FullWriteIfChanged); } }
void BatchSyncMetadata::parsePicture() { ImageInfo info = d->imageInfoList[d->imageInfoIndex]; if (d->direction == WriteFromDatabaseToFile) { MetadataHub fileHub; // read in from database fileHub.load(info); // write out to file DMetadata fileHub.write(info.filePath()); } else { d->scanner.scanFile(info, CollectionScanner::Rescan); } emit signalProgressValue((int)((d->count++/(float)d->imageInfoList.count())*100.0)); d->imageInfoIndex++; }
void ImageDescEditTab::slotWriteToFileMetadataFromDatabase() { initProgressIndicator(); emit signalProgressMessageChanged(i18n("Writing metadata to files. Please wait...")); int i = 0; foreach(const ImageInfo& info, d->currInfos) { MetadataHub fileHub; // read in from database fileHub.load(info); // write out to file DMetadata fileHub.write(info.filePath()); emit signalProgressValueChanged(i++/(float)d->currInfos.count()); qApp->processEvents(); } emit signalProgressFinished(); }