diff --git a/picture.cpp b/picture.cpp
index e32f443..c26cb08 100644
--- a/picture.cpp
+++ b/picture.cpp
@@ -18,6 +18,7 @@ Picture::~Picture(){
}
void Picture::dragEnterEvent(QDragEnterEvent *event){
if(event->mimeData()->hasUrls()){
+ ui->tabField->setCurrentIndex(0);
event->acceptProposedAction();
}
}
@@ -73,8 +74,7 @@ void Picture::on_erase_clicked(){
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
assert (image.get() != 0);
image->readMetadata();
- Exiv2::ExifData &exifData = image->exifData();
- exifData["Exif.Photo.UserComment"] = "charset=Ascii An ASCII Exif comment added with Exiv2";
+ image->clearMetadata();
image->writeMetadata();
}catch(Exiv2::AnyError& e){
QMessageBox msgBox;
@@ -107,3 +107,44 @@ void Picture::on_erase_pressed(){
ui->tabField->setCurrentIndex(1);
on_erase_clicked();
}
+void Picture::on_processButton_pressed(){
+ ui->log->append("Processing images...");
+ ui->tabField->setCurrentIndex(1);
+ on_processButton_clicked();
+}
+void Picture::on_processButton_clicked(){
+ bool ignored=false;
+ QStringList myStringList;
+ for (int i = 0; i < ui->fileList->count(); ++i)
+ myStringList.append(ui->fileList->item(i)->text());
+ qDebug() << myStringList;
+ //foreach(const QString &str,directory.entryList()){
+ foreach(const QString &str,myStringList){
+ QImageReader reader(str);
+ if(!reader.format().isEmpty()){
+ QString fullPath=str;
+ try{
+ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
+ assert (image.get() != 0);
+ image->readMetadata();
+ Exiv2::ExifData &exifData = image->exifData();
+ exifData["Exif.Photo.UserComment"] = "charset=Ascii "+ui->labelText->text().toStdString();
+ image->writeMetadata();
+ }catch(Exiv2::AnyError& e){
+ QMessageBox msgBox;
+ msgBox.setInformativeText("The program could not process the file: "+fullPath);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setDefaultButton(QMessageBox::Ok);
+ int ret=msgBox.exec();
+ }
+ }else{
+ if(!ignored){
+ ignored=true;
+ ui->log->append("Ignored Files:");
+ }
+ ui->log->append(str);
+ }
+ }
+ ui->log->append("Done erasing metadata");
+}
+
diff --git a/picture.h b/picture.h
index fb9b6ad..509deb8 100644
--- a/picture.h
+++ b/picture.h
@@ -37,6 +37,10 @@ private slots:
void on_refresh_clicked();
void on_clearLog_clicked();
void on_erase_pressed();
+ void on_processButton_clicked();
+
+ void on_processButton_pressed();
+
private:
Ui::Picture *ui;
QDir directory;
diff --git a/picture.ui b/picture.ui
index 5ad7038..a9b7df2 100644
--- a/picture.ui
+++ b/picture.ui
@@ -19,7 +19,7 @@
0
0
- 521
+ 651
411
@@ -66,12 +66,42 @@
-
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
Label
+ -
+
+
+ -
+
+
+ Erase GPS Data
+
+
+
+ -
+
+
+ Process
+
+
+