Now successfully removes metadata

This commit is contained in:
Austen Adler 2014-06-18 15:23:12 -04:00
parent ddaf0549f7
commit 28608056cb
4 changed files with 60 additions and 30 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-06-18T13:21:56. -->
<!-- Written by QtCreator 3.0.1, 2014-06-18T14:39:43. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -5,13 +5,14 @@
#include <iostream>
#include <stdio.h>
#include <QDebug>
#include <QImageReader>
Picture::Picture(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Picture){
ui->setupUi(this);
connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory()));
changeDirectory();
//changeDirectory();
fillList();
}
std::string exec(char* cmd) {
@ -50,8 +51,17 @@ void Picture::on_cd_clicked(){
void Picture::on_erase_clicked(){
foreach(const QString &str,directory.entryList()){
QString tmp=QString("echo ");
tmp+=str+">>/tmp/log";
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);
}else{
tmp="echo "+directory.absolutePath()+"/"+str+">>/tmp/log";
std::string tmp2=tmp.toStdString();
char* a=new char[tmp2.size()+1];
a[tmp2.size()]=0;
@ -59,3 +69,8 @@ void Picture::on_erase_clicked(){
exec(a);
}
}
}
void Picture::on_refresh_clicked(){
fillList();
}

View File

@ -25,6 +25,8 @@ private slots:
void on_erase_clicked();
void on_refresh_clicked();
private:
Ui::Picture *ui;
QDir directory;

View File

@ -37,9 +37,9 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="erase">
<widget class="QPushButton" name="refresh">
<property name="text">
<string>Erase Metadata</string>
<string>Refresh Directory</string>
</property>
</widget>
</item>
@ -47,6 +47,19 @@
</item>
</layout>
</widget>
<widget class="QPushButton" name="erase">
<property name="geometry">
<rect>
<x>270</x>
<y>10</y>
<width>124</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Erase Metadata</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">