Now successfully changes directories and removes metadata. Added logging feature
This commit is contained in:
parent
28608056cb
commit
8f9d74199b
31
picture.cpp
31
picture.cpp
@ -6,7 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <QDebug>
|
||||
#include <QImageReader>
|
||||
|
||||
Picture::Picture(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::Picture){
|
||||
@ -36,20 +35,20 @@ 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);
|
||||
@ -61,16 +60,24 @@ void Picture::on_erase_clicked(){
|
||||
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...");
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ private slots:
|
||||
|
||||
void on_refresh_clicked();
|
||||
|
||||
void on_clearLog_clicked();
|
||||
|
||||
void on_erase_pressed();
|
||||
|
||||
private:
|
||||
Ui::Picture *ui;
|
||||
QDir directory;
|
||||
|
32
picture.ui
32
picture.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>656</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -60,13 +60,39 @@
|
||||
<string>Erase Metadata</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="log">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>60</y>
|
||||
<width>301</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="clearLog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>561</x>
|
||||
<y>222</y>
|
||||
<width>51</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<width>656</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user