Added text edit field to edit gps data. Works.

This commit is contained in:
Austen Adler 2014-06-25 19:58:22 -04:00
parent ab3fe277b5
commit ad161bdb70
4 changed files with 26 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-06-23T22:55:24. --> <!-- Written by QtCreator 3.0.1, 2014-06-25T16:15:57. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -92,7 +92,7 @@ void Picture::on_processButton_clicked(){
//Label Images{{{ //Label Images{{{
if(ui->labelImagesRadio->isChecked()){ if(ui->labelImagesRadio->isChecked()){
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString()); Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
assert (image.get() != 0); assert (image.get()!=0);
image->readMetadata(); image->readMetadata();
if(ui->eraseOtherMetadata->isChecked()){ if(ui->eraseOtherMetadata->isChecked()){
image->clearMetadata(); image->clearMetadata();
@ -132,3 +132,22 @@ void Picture::on_processButton_clicked(){
ui->log->append("Done processing metadata"); 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()<<arrStr[i];
}
/* ui->gpsData->append(GPSLatitudeRef.toString()); */
}

View File

@ -37,7 +37,9 @@ class Picture : public QMainWindow {
void on_clearLog_clicked(); void on_clearLog_clicked();
void on_processButton_clicked(); void on_processButton_clicked();
void on_processButton_pressed(); void on_processButton_pressed();
private: void on_fileList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
private:
Ui::Picture *ui; Ui::Picture *ui;
QDir directory; QDir directory;
protected: protected:

View File

@ -59,17 +59,7 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<spacer name="verticalSpacer"> <widget class="QTextEdit" name="gpsData"/>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
@ -112,7 +102,7 @@
<item> <item>
<widget class="QCheckBox" name="eraseGpsData"> <widget class="QCheckBox" name="eraseGpsData">
<property name="text"> <property name="text">
<string>Erase GPS Data</string> <string>Set GPS Data From Above</string>
</property> </property>
</widget> </widget>
</item> </item>