Summary: | Improve the gui of the Geolocation tool | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Julien Narboux <Julien> |
Component: | Plugin-Generic-GeolocationEdit | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.2.0 | |
Sentry Crash Report: | |||
Attachments: | A screenshot of flickr. |
Description
Julien Narboux
2006-10-11 14:09:21 UTC
Created attachment 18091 [details]
A screenshot of flickr.
This screenshots shows the flickr interface which is well designed imho.
*** Bug 135452 has been marked as a duplicate of this bug. *** SVN commit 598625 by cgilles: kipiplugins from trunk : GPSSync plugin: plugin now provides 3 sub-menu entries (instead just one) : - Start GPS device correlator using current pictures selection. - Start Geographical Coordinates editor to tag current pictures selection. - Remove Geographical Coordinates from current pictures selection CCBUGS: 135451 CCMAIL: kde-imaging@kde.org, digikam-devel@kde.org M +6 -3 gpseditdialog.cpp M +140 -14 plugin_gpssync.cpp M +5 -3 plugin_gpssync.h --- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #598624:598625 @@ -196,21 +196,24 @@ d->altitudeInput->text().toDouble(&ok); if (!ok) { - KMessageBox::error(this, i18n("Altitude value is not correct!"), i18n("GPS Sync")); + KMessageBox::error(this, i18n("Altitude value is not correct!"), + i18n("Edit Geographical Coordinates")); return; } d->latitudeInput->text().toDouble(&ok); if (!ok) { - KMessageBox::error(this, i18n("Latitude value is not correct!"), i18n("GPS Sync")); + KMessageBox::error(this, i18n("Latitude value is not correct!"), + i18n("Edit Geographical Coordinates")); return; } d->longitudeInput->text().toDouble(&ok); if (!ok) { - KMessageBox::error(this, i18n("Longitude value is not correct!"), i18n("GPS Sync")); + KMessageBox::error(this, i18n("Longitude value is not correct!"), + i18n("Edit Geographical Coordinates")); return; } --- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.cpp #598624:598625 @@ -19,6 +19,10 @@ * * ============================================================ */ +// Qt includes. + +#include <qfileinfo.h> + // KDE includes. #include <klocale.h> @@ -36,7 +40,10 @@ // Local includes. +#include "exiv2iface.h" #include "gpsbabelbinary.h" +#include "gpsdatacontainer.h" +#include "gpseditdialog.h" #include "gpssyncdialog.h" #include "plugin_gpssync.h" #include "plugin_gpssync.moc" @@ -55,18 +62,37 @@ { KIPI::Plugin::setup( widget ); - // this is our action shown in the menubar/toolbar of the mainwindow + m_action_geolocalization = new KActionMenu(i18n("Geolocalization"), + 0, + actionCollection(), + "geolocalization"); - m_actionGPSSync = new KAction (i18n("Geolocalization..."), - "gpsimagetag", - 0, - this, - SLOT(slotActivate()), - actionCollection(), - "gpssync"); + m_action_geolocalization->insert(new KAction (i18n("Correlator..."), + "gpsimagetag", + 0, + this, + SLOT(slotGPSSync()), + actionCollection(), + "gpssync")); - addAction( m_actionGPSSync ); + m_action_geolocalization->insert(new KAction (i18n("Edit coordinates..."), + 0, + 0, + this, + SLOT(slotGPSEdit()), + actionCollection(), + "gpsedit")); + m_action_geolocalization->insert(new KAction (i18n("Remove coordinates..."), + 0, + 0, + this, + SLOT(slotGPSRemove()), + actionCollection(), + "gpsremove")); + + addAction( m_action_geolocalization ); + m_interface = dynamic_cast< KIPI::Interface* >( parent() ); if ( !m_interface ) @@ -76,10 +102,10 @@ } KIPI::ImageCollection selection = m_interface->currentSelection(); - m_actionGPSSync->setEnabled( selection.isValid() && !selection.images().isEmpty() ); + m_action_geolocalization->setEnabled( selection.isValid() && !selection.images().isEmpty() ); connect( m_interface, SIGNAL(selectionChanged(bool)), - m_actionGPSSync, SLOT(setEnabled(bool))); + m_action_geolocalization, SLOT(setEnabled(bool))); } bool Plugin_GPSSync::checkBinaries(QString &gpsBabelVersion) @@ -127,9 +153,8 @@ return true; } -void Plugin_GPSSync::slotActivate() +void Plugin_GPSSync::slotGPSSync() { - // Get the current/selected album from host KIPI::ImageCollection images = m_interface->currentSelection(); if ( !images.isValid() || images.images().isEmpty() ) @@ -147,9 +172,110 @@ dialog->show(); } +void Plugin_GPSSync::slotGPSEdit() +{ + KIPI::ImageCollection images = m_interface->currentSelection(); + + if ( !images.isValid() || images.images().isEmpty() ) + return; + + KURL img = images.images().first(); + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.load(img.path()); + double alt, lat, lng; + bool hasGPSInfo = exiv2Iface.getGPSInfo(alt, lat, lng); + KIPIGPSSyncPlugin::GPSDataContainer gpsData(alt, lat, lng, false); + + KIPIGPSSyncPlugin::GPSEditDialog dlg(kapp->activeWindow(), + gpsData, img.fileName(), hasGPSInfo); + + if (dlg.exec() == KDialogBase::Accepted) + { + gpsData = dlg.getGPSInfo(); + KURL::List imageURLs = images.images(); + KURL::List errorURLs; + + for( KURL::List::iterator it = imageURLs.begin() ; + it != imageURLs.end(); ++it) + { + KURL url = *it; + + // We only add all JPEG files as R/W because Exiv2 can't yet + // update metadata on others file formats. + + QFileInfo fi(url.path()); + QString ext = fi.extension(false).upper(); + if (ext == QString("JPG") || ext == QString("JPEG") || ext == QString("JPE")) + { + if (exiv2Iface.load(url.path())) + { + bool ret = exiv2Iface.setGPSInfo(gpsData.altitude(), + gpsData.latitude(), + gpsData.longitude()); + ret &= exiv2Iface.save(url.path()); + + if (!ret) + errorURLs.append(url); + } + } + } + + if (!errorURLs.isEmpty()) + { + KMessageBox::errorList( + kapp->activeWindow(), + i18n("Unable to save geographical coordinates to:"), + errorURLs.toStringList(), + i18n("Edit Geographical Coordinates")); + } + } +} + +void Plugin_GPSSync::slotGPSRemove() +{ + KIPI::ImageCollection images = m_interface->currentSelection(); + + if ( !images.isValid() || images.images().isEmpty() ) + return; + + KURL::List imageURLs = images.images(); + KURL::List errorURLs; + + for( KURL::List::iterator it = imageURLs.begin() ; + it != imageURLs.end(); ++it) + { + KURL url = *it; + + // We only add all JPEG files as R/W because Exiv2 can't yet + // update metadata on others file formats. + + QFileInfo fi(url.path()); + QString ext = fi.extension(false).upper(); + if (ext == QString("JPG") || ext == QString("JPEG") || ext == QString("JPE")) + { + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.load(url.path()); + bool ret = exiv2Iface.removeGPSInfo(); + ret &= exiv2Iface.save(url.path()); + + if (!ret) + errorURLs.append(url); + } + } + + if (!errorURLs.isEmpty()) + { + KMessageBox::errorList( + kapp->activeWindow(), + i18n("Unable to remove geographical coordinates from:"), + errorURLs.toStringList(), + i18n("Remove Geographical Coordinates")); + } +} + KIPI::Category Plugin_GPSSync::category( KAction* action ) const { - if ( action == m_actionGPSSync ) + if ( action == m_action_geolocalization ) return KIPI::IMAGESPLUGIN; kdWarning( 51000 ) << "Unrecognized action for plugin category identification" << endl; --- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.h #598624:598625 @@ -26,7 +26,7 @@ #include <libkipi/plugin.h> -class KAction; +class KActionMenu; class Plugin_GPSSync : public KIPI::Plugin { @@ -41,7 +41,9 @@ protected slots: - void slotActivate(); + void slotGPSSync(); + void slotGPSEdit(); + void slotGPSRemove(); private: @@ -49,7 +51,7 @@ private: - KAction *m_actionGPSSync; + KActionMenu *m_action_geolocalization; KIPI::Interface *m_interface; }; I just realized that adding GPS coordinates (using the Picture geolocalization correlator or with edit geographical coordinates) forces the thumbnails to be re-created. This can take quite long and does not seem to be necesssary, because the image itself does not change. Hey guy.... I'm happy to said than all points from this report are fixed in KDE4 port of the plugin... (:=))) ... Gilles SVN commit 772640 by cgilles: kipi-plugins from trunk (KDE4) : digiKam has a new tool to edit a GPS track list using googlemaps ! More than one point can be edited over the ma at the same time... A fresh screenshot of the tool in action is available here : http://digikam3rdparty.free.fr/Screenshots/gpstracklisteditor.png BUG: 135451 BUG: 135386 CCMAIL: digikam-devel@kde.org CCMAIL: kde-imaging@kde.org M +7 -2 gpstracklistcontainer.h M +19 -7 gpstracklisteditdialog.cpp M +2 -0 gpstracklisteditdialog.h M +2 -10 gpstracklistviewitem.cpp M +1 -1 gpstracklistwidget.cpp M +51 -2 plugin_gpssync.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=772640 |