commit ddaf0549f7821291ae2e2f4b50ba396c196c0a1e Author: Austen Date: Wed Jun 18 13:22:19 2014 -0400 Initial Commit diff --git a/Picture.pro b/Picture.pro new file mode 100644 index 0000000..8de8f4f --- /dev/null +++ b/Picture.pro @@ -0,0 +1,25 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-06-18T10:46:07 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = Picture +TEMPLATE = app + + +SOURCES += main.cpp\ + picture.cpp + +HEADERS += picture.h + +FORMS += picture.ui + +unix: CONFIG += link_pkgconfig +unix: PKGCONFIG += exiv2 + +OTHER_FILES += diff --git a/Picture.pro.user b/Picture.pro.user new file mode 100644 index 0000000..df5b813 --- /dev/null +++ b/Picture.pro.user @@ -0,0 +1,260 @@ + + + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + true + 1 + true + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {78915aca-1f52-4c43-bbd6-02dcf5b6f6cf} + 0 + 0 + 0 + + /home/stonewareslord/qt/build-Picture-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/stonewareslord/qt/build-Picture-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Picture + + Qt4ProjectManager.Qt4RunConfiguration:/home/stonewareslord/qt/Picture/Picture.pro + + Picture.pro + false + false + + 3768 + true + false + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.EnvironmentId + {e2e3f798-676b-49e0-8a74-a8a450ab116a} + + + ProjectExplorer.Project.Updater.FileVersion + 15 + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..313e48b --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "picture.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Picture w; + w.show(); + + return a.exec(); +} diff --git a/picture.cpp b/picture.cpp new file mode 100644 index 0000000..cf6a93b --- /dev/null +++ b/picture.cpp @@ -0,0 +1,61 @@ +#include "picture.h" +#include "ui_picture.h" +#include +#include +#include +#include +#include + +Picture::Picture(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::Picture){ + ui->setupUi(this); + connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory())); + changeDirectory(); + fillList(); +} +std::string exec(char* cmd) { + FILE* pipe = popen(cmd, "r"); + if (!pipe) return "ERROR"; + char buffer[128]; + std::string result = ""; + while(!feof(pipe)) { + if(fgets(buffer, 128, pipe) != NULL){ + result += buffer; + } + } + pclose(pipe); + return result; +} +Picture::~Picture(){ + delete ui; +} +void Picture::changeDirectory(){ + QString path=QFileDialog::getExistingDirectory(this,tr("Directory"),directory.path()); + if(path.isNull()==false){ + directory.setPath(path); + fillList(); + } + //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(){ + foreach(const QString &str,directory.entryList()){ + QString tmp=QString("echo "); + tmp+=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); + } +} diff --git a/picture.h b/picture.h new file mode 100644 index 0000000..735f14e --- /dev/null +++ b/picture.h @@ -0,0 +1,33 @@ +#ifndef PICTURE_H +#define PICTURE_H + +#include +#include +#include + +namespace Ui { +class Picture; +} + +class Picture : public QMainWindow +{ + Q_OBJECT + +public: + explicit Picture(QWidget *parent = 0); + ~Picture(); +private slots: + void changeDirectory(); + void fillList(); + + + void on_cd_clicked(); + + void on_erase_clicked(); + +private: + Ui::Picture *ui; + QDir directory; +}; + +#endif // PICTURE_H diff --git a/picture.ui b/picture.ui new file mode 100644 index 0000000..06fb3be --- /dev/null +++ b/picture.ui @@ -0,0 +1,86 @@ + + + Picture + + + + 0 + 0 + 400 + 300 + + + + Picture + + + + + + 11 + 1 + 258 + 229 + + + + + + + + + + + + Change Directory + + + + + + + Erase Metadata + + + + + + + + + + + + 0 + 0 + 400 + 21 + + + + + File + + + + + + + + TopToolBarArea + + + false + + + + + + Open Files + + + + + + +