SVN commit 543315 by mwiesweg:
Update image metadata stored in DImg instance when metadata is changed in file on disk - add signalFileMetadataChanged to ImageAttributesWatch - add method to re-read metadata to DImgInterface (code duplicate to DImgLoader::readMetadata) - connect to signal in ImageWindow - send signal in AlbumIconView, ImageDescEditTab, KipiInterface TODO: - update ImagePropertiesMetadataTab on signalFileMetadataChanged (ImageAttributesWatch is libdigikam, the metadatatab is used by showfoto, create a subclass ImagePropertiesMetadataTabDB?) CCMAIL: [hidden email] M +3 -3 TODO M +8 -1 digikam/albumiconview.cpp M +5 -0 digikam/imageattributeswatch.cpp M +16 -0 digikam/imageattributeswatch.h M +1 -0 digikam/kipiinterface.cpp M +1 -0 libs/imageproperties/imagedescedittab.cpp M +6 -0 utilities/imageeditor/canvas/canvas.cpp M +1 -0 utilities/imageeditor/canvas/canvas.h M +14 -0 utilities/imageeditor/canvas/dimginterface.cpp M +1 -0 utilities/imageeditor/canvas/dimginterface.h M +14 -0 utilities/imageeditor/editor/imagewindow.cpp M +2 -0 utilities/imageeditor/editor/imagewindow.h --- trunk/extragear/graphics/digikam/TODO #543314:543315 @@ -38,10 +38,10 @@ - Added signal/slots control between IE and main interface about "comments & tags" tab. Comments & tags set from main must be updated in IE and vise-versa. -* Image Editor : +* Image Editor : - - If Comments & tags informations have been changed, notify DImg instance of current image to set - informations in metadata bytes array (COM, EXIF, IPTC). + - update ImagePropertiesMetadataTab on ImageAttributesWatch's signalFileMetadataChanged + (ImageAttributesWatch is libdigikam, the metadatatab is used by showfoto - create subclass ImagePropertiesMetadataTabDB?) * Showfoto: --- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #543314:543315 @@ -1349,7 +1349,7 @@ for( it = urlList.begin(); it != urlList.end(); ++it ) { kdDebug() << "Setting Exif Orientation tag to " << orientation << endl; - + DMetadata metadata((*it).path()); DMetadata::ImageOrientation o = (DMetadata::ImageOrientation)orientation; metadata.setImageOrientation(o); @@ -1360,6 +1360,10 @@ .arg((*it).filename())); return; } + else + { + ImageAttributesWatch::instance()->fileMetadataChanged((*it)); + } } refreshItems(urlList); @@ -1709,6 +1713,7 @@ DMetadata metadata(info->filePath()); metadata.setImageKeywords(oldKeywords, tagPaths); metadata.applyChanges(); + ImageAttributesWatch::instance()->fileMetadataChanged(info->kurl()); } } } @@ -1744,6 +1749,7 @@ DMetadata metadata(info->filePath()); metadata.setImageKeywords(oldKeywords, tagPaths); metadata.applyChanges(); + ImageAttributesWatch::instance()->fileMetadataChanged(info->kurl()); } } } @@ -1777,6 +1783,7 @@ DMetadata metadata(info->filePath()); metadata.setImageRating(rating); metadata.applyChanges(); + ImageAttributesWatch::instance()->fileMetadataChanged(info->kurl()); } } } --- trunk/extragear/graphics/digikam/digikam/imageattributeswatch.cpp #543314:543315 @@ -70,6 +70,11 @@ emit signalImageCaptionChanged(imageId); } +void ImageAttributesWatch::fileMetadataChanged(const KURL &url) +{ + emit signalFileMetadataChanged(url); +} + } // namespace Digikam #include "imageattributeswatch.moc" --- trunk/extragear/graphics/digikam/digikam/imageattributeswatch.h #543314:543315 @@ -22,8 +22,14 @@ #ifndef IMAGEATTRIBUTESWATCH_H #define IMAGEATTRIBUTESWATCH_H +// Qt includes + #include <qobject.h> +// KDE includes + +#include <kurl.h> + namespace Digikam { @@ -44,6 +50,8 @@ void imageDateChanged(Q_LLONG imageId); void imageCaptionChanged(Q_LLONG imageId); + void fileMetadataChanged(const KURL &url); + signals: /** Indicates that tags have been assigned or removed @@ -67,6 +75,14 @@ void signalImageDateChanged(Q_LLONG imageId); void signalImageCaptionChanged(Q_LLONG imageId); + /** + Indicates that the metadata if the given file + has been changed (a write operation on the file on disk). + Usually, the database is updated accordingly, so then this + signal is sent in combination with one or more of the above signals. + */ + void signalFileMetadataChanged(const KURL &url); + protected: ~ImageAttributesWatch(); --- trunk/extragear/graphics/digikam/digikam/kipiinterface.cpp #543314:543315 @@ -135,6 +135,7 @@ DMetadata metadata(_url.path()); metadata.setImageComment(description); metadata.applyChanges(); + ImageAttributesWatch::instance()->fileMetadataChanged(_url); } } } --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #543314:543315 @@ -444,6 +444,7 @@ } metadata.applyChanges(); + ImageAttributesWatch::instance()->fileMetadataChanged(d->currInfo->kurl()); } d->modified = false; --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #543314:543315 @@ -475,6 +475,12 @@ d->im->setModified(); } +void Canvas::readMetadataFromFile(const QString &file) +{ + d->im->readMetadataFromFile(file); +} + + void Canvas::clearUndoHistory() { d->im->clearUndoManager(); --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.h #543314:543315 @@ -65,6 +65,7 @@ void switchToLastSaved(const QString& newFilename); void abortSaving(); void setModified(); + void readMetadataFromFile(const QString &file); void clearUndoHistory(); void setUndoHistoryOrigin(); DImg currentImage(); --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.cpp #543314:543315 @@ -622,6 +622,20 @@ emit signalUndoStateChanged(d->undoMan->anyMoreUndo(), d->undoMan->anyMoreRedo(), !d->undoMan->isAtOrigin()); } +void DImgInterface::readMetadataFromFile(const QString &file) +{ + DMetadata meta(file); + + //TODO: code is essentially the same as DImgLoader::readMetadata, + // put both in a common place. + if (!meta.getComments().isNull()) + d->image.setComments(meta.getComments()); + if (!meta.getExif().isNull()) + d->image.setExif(meta.getExif()); + if (!meta.getIptc().isNull()) + d->image.setIptc(meta.getIptc()); +} + void DImgInterface::clearUndoManager() { d->undoMan->clear(); --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.h #543314:543315 @@ -67,6 +67,7 @@ void switchToLastSaved(const QString& newFilename); void abortSaving(); void setModified(); + void readMetadataFromFile(const QString &file); void clearUndoManager(); void setUndoManagerOrigin(); --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #543314:543315 @@ -86,6 +86,7 @@ #include "loadingcacheinterface.h" #include "savingcontextcontainer.h" #include "imagewindow.h" +#include "imageattributeswatch.h" namespace Digikam { @@ -183,6 +184,11 @@ connect(this, SIGNAL(signalNoCurrentItem()), m_rightSidebar, SLOT(slotNoCurrentItem())); + + ImageAttributesWatch *watch = ImageAttributesWatch::instance(); + + connect(watch, SIGNAL(signalFileMetadataChanged(const KURL &)), + this, SLOT(slotFileMetadataChanged(const KURL &))); } void ImageWindow::setupUserArea() @@ -787,6 +793,14 @@ close(); } +void ImageWindow::slotFileMetadataChanged(const KURL &url) +{ + if (url == m_urlCurrent) + { + m_canvas->readMetadataFromFile(url.path()); + } +} + } // namespace Digikam #include "imagewindow.moc" --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #543314:543315 @@ -137,6 +137,8 @@ void slotAssignTag(int tagID); void slotRemoveTag(int tagID); + + void slotFileMetadataChanged(const KURL &url); }; } // namespace Digikam _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |