From ad161bdb706d66e3a8fc8c18268799fe8f7df7b3 Mon Sep 17 00:00:00 2001 From: Austen Date: Wed, 25 Jun 2014 19:58:22 -0400 Subject: [PATCH] Added text edit field to edit gps data. Works. --- Picture.pro.user | 2 +- picture.cpp | 21 ++++++++++++++++++++- picture.h | 4 +++- picture.ui | 14 ++------------ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Picture.pro.user b/Picture.pro.user index 0dd141d..f394213 100644 --- a/Picture.pro.user +++ b/Picture.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/picture.cpp b/picture.cpp index 3c5b144..9195f63 100644 --- a/picture.cpp +++ b/picture.cpp @@ -92,7 +92,7 @@ void Picture::on_processButton_clicked(){ //Label Images{{{ if(ui->labelImagesRadio->isChecked()){ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString()); - assert (image.get() != 0); + assert (image.get()!=0); image->readMetadata(); if(ui->eraseOtherMetadata->isChecked()){ image->clearMetadata(); @@ -132,3 +132,22 @@ void Picture::on_processButton_clicked(){ ui->log->append("Done processing metadata"); } //}}} +void Picture::on_fileList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) { + ui->gpsData->clear(); + QString tmp=current->text(); + std::string tmp2=tmp.toStdString(); + Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(tmp2); + assert(image.get()!=0); + image->readMetadata(); + Exiv2::ExifData &exifData=image->exifData(); + std::string arrStr[7]={"GPSLatitudeRef","GPSLatitude","GPSLongitudeRef","GPSLongitude","GPSAltitudeRef","GPSAltitude","GPSTimeStamp"}; + for(int i=0;i<7;i++){ + Exiv2::Exifdatum gps=exifData["Exif.GPSInfo."+arrStr[i]]; + std::string a; + a=gps.toString(); + ui->gpsData->append(QString::fromStdString(a)); + //qDebug()<gpsData->append(GPSLatitudeRef.toString()); */ + +} diff --git a/picture.h b/picture.h index d5ba9b4..ed14778 100644 --- a/picture.h +++ b/picture.h @@ -37,7 +37,9 @@ class Picture : public QMainWindow { void on_clearLog_clicked(); void on_processButton_clicked(); void on_processButton_pressed(); - private: + void on_fileList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + +private: Ui::Picture *ui; QDir directory; protected: diff --git a/picture.ui b/picture.ui index a319615..8792506 100644 --- a/picture.ui +++ b/picture.ui @@ -59,17 +59,7 @@ - - - Qt::Vertical - - - - 20 - 40 - - - + @@ -112,7 +102,7 @@ - Erase GPS Data + Set GPS Data From Above