diff --git a/picture.cpp b/picture.cpp index 2bf85b6..e32f443 100644 --- a/picture.cpp +++ b/picture.cpp @@ -3,6 +3,7 @@ #include #include #include +#include Picture::Picture(QWidget *parent) : QMainWindow(parent), ui(new Ui::Picture){ @@ -31,7 +32,6 @@ void Picture::dropEvent(QDropEvent *event){ //qDebug() << "Dropped file:" << fileName; } } - void Picture::changeDirectory(){ QString path=QFileDialog::getExistingDirectory(this,tr("Directory"),directory.path()); if(path.isNull()==false){ @@ -69,12 +69,20 @@ void Picture::on_erase_clicked(){ QImageReader reader(str); if(!reader.format().isEmpty()){ QString fullPath=str; - 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->writeMetadata(); + 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 An ASCII Exif comment added with Exiv2"; + 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; diff --git a/picture.ui b/picture.ui index 25dae5b..5ad7038 100644 --- a/picture.ui +++ b/picture.ui @@ -41,7 +41,7 @@ - Change Directory + Open Directory