Now successfully removes metadata
This commit is contained in:
parent
ddaf0549f7
commit
28608056cb
@ -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-18T13:21:56. -->
|
<!-- Written by QtCreator 3.0.1, 2014-06-18T14:39:43. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
69
picture.cpp
69
picture.cpp
@ -5,57 +5,72 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QImageReader>
|
||||||
|
|
||||||
Picture::Picture(QWidget *parent) :
|
Picture::Picture(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::Picture){
|
ui(new Ui::Picture){
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory()));
|
connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory()));
|
||||||
changeDirectory();
|
//changeDirectory();
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
std::string exec(char* cmd) {
|
std::string exec(char* cmd) {
|
||||||
FILE* pipe = popen(cmd, "r");
|
FILE* pipe = popen(cmd, "r");
|
||||||
if (!pipe) return "ERROR";
|
if (!pipe) return "ERROR";
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
while(!feof(pipe)) {
|
while(!feof(pipe)) {
|
||||||
if(fgets(buffer, 128, pipe) != NULL){
|
if(fgets(buffer, 128, pipe) != NULL){
|
||||||
result += buffer;
|
result += buffer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pclose(pipe);
|
}
|
||||||
return result;
|
pclose(pipe);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
Picture::~Picture(){
|
Picture::~Picture(){
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
void Picture::changeDirectory(){
|
void Picture::changeDirectory(){
|
||||||
QString path=QFileDialog::getExistingDirectory(this,tr("Directory"),directory.path());
|
QString path=QFileDialog::getExistingDirectory(this,tr("Directory"),directory.path());
|
||||||
if(path.isNull()==false){
|
if(path.isNull()==false){
|
||||||
directory.setPath(path);
|
directory.setPath(path);
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
//exec("which exiv2>>/tmp/log");
|
//exec("which exiv2>>/tmp/log");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Picture::fillList() {
|
void Picture::fillList() {
|
||||||
ui->fileList->clear();
|
ui->fileList->clear();
|
||||||
ui->fileList->addItems(directory.entryList());
|
ui->fileList->addItems(directory.entryList());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Picture::on_cd_clicked(){
|
void Picture::on_cd_clicked(){
|
||||||
changeDirectory();
|
changeDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Picture::on_erase_clicked(){
|
void Picture::on_erase_clicked(){
|
||||||
foreach(const QString &str,directory.entryList()){
|
foreach(const QString &str,directory.entryList()){
|
||||||
QString tmp=QString("echo ");
|
QString tmp=QString("exiv2 rm ");
|
||||||
tmp+=str+">>/tmp/log";
|
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();
|
std::string tmp2=tmp.toStdString();
|
||||||
char* a=new char[tmp2.size()+1];
|
char* a=new char[tmp2.size()+1];
|
||||||
a[tmp2.size()]=0;
|
a[tmp2.size()]=0;
|
||||||
memcpy(a,tmp2.c_str(),tmp2.size());
|
memcpy(a,tmp2.c_str(),tmp2.size());
|
||||||
exec(a);
|
exec(a);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Picture::on_refresh_clicked(){
|
||||||
|
fillList();
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ private slots:
|
|||||||
|
|
||||||
void on_erase_clicked();
|
void on_erase_clicked();
|
||||||
|
|
||||||
|
void on_refresh_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Picture *ui;
|
Ui::Picture *ui;
|
||||||
QDir directory;
|
QDir directory;
|
||||||
|
17
picture.ui
17
picture.ui
@ -37,9 +37,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="erase">
|
<widget class="QPushButton" name="refresh">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Erase Metadata</string>
|
<string>Refresh Directory</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -47,6 +47,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
Loading…
Reference in New Issue
Block a user