diff --git a/picture.cpp b/picture.cpp index 7e690b6..d6b3d97 100644 --- a/picture.cpp +++ b/picture.cpp @@ -6,7 +6,6 @@ #include #include #include - Picture::Picture(QWidget *parent) : QMainWindow(parent), ui(new Ui::Picture){ @@ -36,41 +35,49 @@ void Picture::changeDirectory(){ if(path.isNull()==false){ directory.setPath(path); fillList(); + ui->log->append("Changed directory to: "+path+"/"); + }else{ + ui->log->append("Could not change directory"); } - //exec("which exiv2>>/tmp/log"); } - void Picture::fillList() { ui->fileList->clear(); ui->fileList->addItems(directory.entryList()); } - void Picture::on_cd_clicked(){ changeDirectory(); } - void Picture::on_erase_clicked(){ + bool ignored=false; foreach(const QString &str,directory.entryList()){ QString tmp=QString("exiv2 rm "); QImageReader reader(directory.absolutePath()+"/"+str); if(!reader.format().isEmpty()){ - tmp+=directory.absolutePath()+"/"+str+">>/tmp/log"; - std::string tmp2=tmp.toStdString(); - char* a=new char[tmp2.size()+1]; - a[tmp2.size()]=0; - memcpy(a,tmp2.c_str(),tmp2.size()); - exec(a); + tmp+=directory.absolutePath()+"/"+str+">>/tmp/log"; + std::string tmp2=tmp.toStdString(); + char* a=new char[tmp2.size()+1]; + a[tmp2.size()]=0; + memcpy(a,tmp2.c_str(),tmp2.size()); + exec(a); }else{ - tmp="echo "+directory.absolutePath()+"/"+str+">>/tmp/log"; - std::string tmp2=tmp.toStdString(); - char* a=new char[tmp2.size()+1]; - a[tmp2.size()]=0; - memcpy(a,tmp2.c_str(),tmp2.size()); - exec(a); + if(!ignored){ + ignored=true; + ui->log->append("Ignored Files:"); + } + ui->log->append(str); } } + ui->log->append("Done erasing metadata"); } - void Picture::on_refresh_clicked(){ fillList(); } +void Picture::on_clearLog_clicked(){ + ui->log->setText(""); +} + +void Picture::on_erase_pressed() +{ + + ui->log->append("Erasing metadata from images..."); +} diff --git a/picture.h b/picture.h index 2ac99f1..eb74ad5 100644 --- a/picture.h +++ b/picture.h @@ -27,6 +27,10 @@ private slots: void on_refresh_clicked(); + void on_clearLog_clicked(); + + void on_erase_pressed(); + private: Ui::Picture *ui; QDir directory; diff --git a/picture.ui b/picture.ui index f28cb45..75cf90b 100644 --- a/picture.ui +++ b/picture.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 656 + 350 @@ -60,13 +60,39 @@ Erase Metadata + + + + 310 + 60 + 301 + 191 + + + + true + + + + + + 561 + 222 + 51 + 30 + + + + Clear + + 0 0 - 400 + 656 21