[Digikam-devel] [Bug 133359] WISH: Google maps support to show satellite images of the photos

Gilles Caulier caulier.gilles at free.fr
Mon Sep 25 13:54:52 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=133359         




------- Additional Comments From caulier.gilles free fr  2006-09-25 14:54 -------
SVN commit 588251 by cgilles:

kipi-plugins from trunk : GPSSync tool : 

- New options :
   * to set GPS coordinates manually.
   * to remove all GPS info from file.

- Bug fix (relevant of EXIV2 library ?) : we need to clean up all GPS info from file before to rewrite it. 
Andreas, i have seen that if a picture has already GPS infos, if i don't process a clean up of all Exif.GPSInfo tags, 
the lattitude and altitude values are set to 0.

CCMAIL: kde-imaging kde org, alexios.beveratos gmail com, gerhard kulzer net, ahuggel gmx net

CCBUGS: 133359, 111560

 M  +1 -1      Makefile.am  
 A             gpseditdialog.cpp   [License: GPL]
 A             gpseditdialog.h   [License: GPL]
 M  +39 -8     gpslistviewitem.cpp  
 M  +3 -1      gpslistviewitem.h  
 M  +31 -10    gpssyncdialog.cpp  
 M  +7 -0      gpssyncdialog.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/Makefile.am #588250:588251
 @ -10,7 +10,7  @
 
 # Srcs for the plugin
 kipiplugin_gpssync_la_SOURCES = plugin_gpssync.cpp gpssyncdialog.cpp gpslistviewitem.cpp \
-	                            gpsbabelbinary.cpp gpsdataparser.cpp 
+	                            gpsbabelbinary.cpp gpsdataparser.cpp gpseditdialog.cpp 
 
 # Libs needed by the plugin
 kipiplugin_gpssync_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #588250:588251
 @ -44,12 +44,14  @
 
     GPSListViewItemPriv()
     {
-        enabled        = false;
-        dirty          = false;
+        enabled = false;
+        dirty   = false;
+        erase   = false;
     }
 
     bool             enabled;
     bool             dirty;
+    bool             erase;
 
     QDateTime        date;
 
 @ -86,7 +88,7  @
     delete d;
 }
 
-void GPSListViewItem::setGPSInfo(GPSDataContainer gpsData, bool dirty)
+void GPSListViewItem::setGPSInfo(GPSDataContainer gpsData, bool dirty, bool addedManually)
 {
     d->dirty   = dirty;
     d->gpsData = gpsData;
 @ -100,7 +102,12  @
         if (d->gpsData.isInterpolated())
             status = i18n("Interpolated");
         else
-            status = i18n("Found");
+        {
+            if (addedManually)
+                status = i18n("Added");
+            else
+                status = i18n("Found");
+        }
     }
     setText(6, status);
 
 @ -147,10 +154,13  @
     {
         setPixmap(1, SmallIcon("run"));
         KIPIPlugins::Exiv2Iface exiv2Iface;
-        exiv2Iface.load(d->url.path());
-        bool ret = exiv2Iface.setGPSInfo(d->gpsData.altitude(), 
-                                         d->gpsData.latitude(), 
+        bool ret = exiv2Iface.load(d->url.path());
+        ret &= exiv2Iface.removeGPSInfo();
+        if (!d->erase)
+        {
+            ret &= exiv2Iface.setGPSInfo(d->gpsData.altitude(), d->gpsData.latitude(), 
                                          d->gpsData.longitude());
+        }
         ret &= exiv2Iface.save(d->url.path());
         if (ret)
             setPixmap(1, SmallIcon("ok"));
 @ -175,11 +185,24  @
     return d->dirty;
 }
 
+void GPSListViewItem::eraseGPSInfo(bool e)
+{
+    d->erase = e;
+    d->dirty = true;
+
+    if (e)
+        setText(6, i18n("Deleted!"));
+    else 
+        setText(6, "");
+
+    repaint();
+}
+
 void GPSListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
 {
     if (d->enabled)
     {
-        if ( isDirty() && column >=2  && column <=4 )
+        if ( isDirty() && !d->erase && column >= 2  && column <= 4 )
         {
             QColorGroup _cg( cg );
             QColor c = _cg.text();
 @ -187,6 +210,14  @
             KListViewItem::paintCell( p, _cg, column, width, alignment );
             _cg.setColor( QColorGroup::Text, c );
         }
+        else if ( isDirty() && d->erase && column == 6)
+        {
+            QColorGroup _cg( cg );
+            QColor c = _cg.text();
+            _cg.setColor( QColorGroup::Text, Qt::red );
+            KListViewItem::paintCell( p, _cg, column, width, alignment );
+            _cg.setColor( QColorGroup::Text, c );
+        }
         else
             KListViewItem::paintCell(p, cg, column, width, alignment);
     }
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.h #588250:588251
 @ -55,9 +55,11  @
     GPSListViewItem(KListView *view, QListViewItem *after, const KURL& url);
     ~GPSListViewItem();
 
-    void setGPSInfo(GPSDataContainer gpsData, bool dirty=true);
+    void setGPSInfo(GPSDataContainer gpsData, bool dirty=true, bool addedManually=false);
     GPSDataContainer getGPSInfo();
+    void eraseGPSInfo(bool e);
 
+
     void setDateTime(QDateTime date);
     QDateTime getDateTime();
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #588250:588251
 @ -54,6 +54,7  @
 
 #include "gpslistviewitem.h"
 #include "pluginsversion.h"
+#include "gpseditdialog.h"
 #include "gpssyncdialog.h"
 #include "gpssyncdialog.moc"
 
 @ -98,15 +99,16  @
 
 GPSSyncDialog::GPSSyncDialog( KIPI::Interface* interface, QWidget* parent)
              : KDialogBase(Plain, i18n("GPS Sync"), 
-                           Help|User1|Apply|Close, Close, 
+                           Help|User1|User2|Apply|Close, Close, 
                            parent, 0, true, true )
 {
     d = new GPSSyncDialogPriv;
     d->interface = interface;
 
     setButtonText(User1, i18n("Correlate"));
-    enableButton(Apply, false);
+    setButtonText(User2, i18n("Edit Coordinates..."));
     enableButton(User1, false);
+    enableButton(User2, true);
 
     QGridLayout *mainLayout = new QGridLayout(plainPage(), 3, 1, 0, marginHint());
 
 @ -158,9 +160,6  @
 
     QPushButton *loadGPXButton = new QPushButton(i18n("Load GPX File..."), settingsBox);
 
-    connect(loadGPXButton, SIGNAL(pressed()),
-            this, SLOT(slotLoadGPXFile()));
-
     QLabel *gpxFileLabel = new QLabel(i18n("Current GPX file:"), settingsBox);
     d->gpxFileName       = new KSqueezedTextLabel(i18n("No GPX file"), settingsBox);
     d->gpxPointsLabel    = new QLabel(settingsBox);
 @ -255,6 +254,9  @
 
     // ---------------------------------------------------------------
 
+    connect(loadGPXButton, SIGNAL(pressed()),
+            this, SLOT(slotLoadGPXFile()));
+
     connect(d->interpolateBox, SIGNAL(toggled(bool)),
             d->maxTimeLabel, SLOT(setEnabled(bool)));
 
 @ -299,7 +301,6  @
     {
         KMessageBox::error(this, i18n("Cannot parse %1 GPX file!")
                            .arg(loadGPXFile.fileName()), i18n("GPS Sync"));    
-        enableButton(Apply, false);
         enableButton(User1, false);
         return;
     }
 @ -308,14 +309,12  @
     {
         KMessageBox::sorry(this, i18n("The %1 GPX file do not have a date-time track to use!")
                            .arg(loadGPXFile.fileName()), i18n("GPS Sync"));    
-        enableButton(Apply, false);
         enableButton(User1, false);
         return;
     }
 
     d->gpxFileName->setText(loadGPXFile.fileName());
     d->gpxPointsLabel->setText(i18n("Points parsed: %1").arg(d->gpxParser.numPoints()));
-    enableButton(Apply, true);
     enableButton(User1, true);
     slotUser1();
 }
 @ -392,7 +391,6  @
     {
         KMessageBox::sorry(this, i18n("Cannot find pictures to correlate with GPX file data."),
                            i18n("GPS Sync"));    
-        enableButton(Apply, false);
         return;
     }
 
 @ -400,9 +398,32  @
                              "the list using the GPX data file.\n"
                              "Press Apply button to update picture(s) metadata.")
                              .arg(itemsUpdated), i18n("GPS Sync"));    
-    enableButton(Apply, true);
 }
 
+// Launch the GPS coordinates editor.
+void GPSSyncDialog::slotUser2()
+{
+    if (!d->listView->currentItem())
+    {
+        KMessageBox::information(this, i18n("Please, select a picture from "
+                     "the list to edit GPS coordinate manually."), i18n("GPS Sync"));    
+        return;
+    }
+
+    GPSListViewItem* item = (GPSListViewItem*)d->listView->currentItem();
+
+    GPSEditDialog dlg(this, item->getGPSInfo(), item->getUrl().fileName());
+    switch (dlg.exec())
+    {
+        case KDialogBase::Accepted:
+            item->setGPSInfo(dlg.getGPSInfo(), true, true);
+        break;
+        case(-1):   // Erase all GPS tags
+            item->eraseGPSInfo(true);
+        break;
+    }
+}
+
 void GPSSyncDialog::slotApply()
 {
     QListViewItemIterator it( d->listView );
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.h #588250:588251
 @ -35,8 +35,11  @
 
 #include "gpsdataparser.h"
 
+class QListViewItem;
+
 namespace KIPIGPSSyncPlugin
 {
+
 class GPSSyncDialogPriv;
 
 class GPSSyncDialog :public KDialogBase 
 @ -60,6 +63,10  @
     void slotHelp();
     void slotClose();
     void slotUser1();
+    void slotUser2();
+
+private slots:
+
     void slotLoadGPXFile(); 
 
 private:



More information about the Digikam-devel mailing list