Attempting QProcess execution
This commit is contained in:
parent
e5a1b2283e
commit
e1dbb7db6d
@ -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-18T14:39:43. -->
|
<!-- Written by QtCreator 3.0.1, 2014-06-18T20:10:29. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
18
picture.cpp
18
picture.cpp
@ -3,10 +3,21 @@ Picture::Picture(QWidget *parent) :
|
|||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::Picture){
|
ui(new Ui::Picture){
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
connect(&commandProcess,SIGNAL(readyReadStandardOutput()),this,SLOT(log()));
|
||||||
|
connect(&commandProcess,SIGNAL(readyReadStandardError()),this,SLOT(log()));
|
||||||
connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory()));
|
connect(ui->actionOpen_Files,SIGNAL(triggered()),this,SLOT(changeDirectory()));
|
||||||
//changeDirectory();
|
//changeDirectory();
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
|
void Picture::log(){
|
||||||
|
QByteArray cmdoutput = commandProcess.readAllStandardOutput();
|
||||||
|
QString txtoutput = cmdoutput;
|
||||||
|
ui->log->append(txtoutput);
|
||||||
|
cmdoutput = commandProcess.readAllStandardError();
|
||||||
|
txtoutput = cmdoutput;
|
||||||
|
ui->log->append(txtoutput);
|
||||||
|
}
|
||||||
|
|
||||||
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";
|
||||||
@ -60,7 +71,8 @@ void Picture::on_erase_clicked(){
|
|||||||
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);
|
||||||
|
commandProcess.start(a);
|
||||||
}else{
|
}else{
|
||||||
if(!ignored){
|
if(!ignored){
|
||||||
ignored=true;
|
ignored=true;
|
||||||
@ -73,10 +85,14 @@ void Picture::on_erase_clicked(){
|
|||||||
}
|
}
|
||||||
void Picture::on_refresh_clicked(){
|
void Picture::on_refresh_clicked(){
|
||||||
fillList();
|
fillList();
|
||||||
|
ui->log->append("Refreshed directory");
|
||||||
}
|
}
|
||||||
void Picture::on_clearLog_clicked(){
|
void Picture::on_clearLog_clicked(){
|
||||||
ui->log->setText("");
|
ui->log->setText("");
|
||||||
|
ui->tabField->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
void Picture::on_erase_pressed(){
|
void Picture::on_erase_pressed(){
|
||||||
ui->log->append("Erasing metadata from images...");
|
ui->log->append("Erasing metadata from images...");
|
||||||
|
ui->tabField->setCurrentIndex(1);
|
||||||
|
on_erase_clicked();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Picture;
|
class Picture;
|
||||||
@ -34,8 +35,10 @@ private slots:
|
|||||||
void on_refresh_clicked();
|
void on_refresh_clicked();
|
||||||
void on_clearLog_clicked();
|
void on_clearLog_clicked();
|
||||||
void on_erase_pressed();
|
void on_erase_pressed();
|
||||||
|
void log();
|
||||||
private:
|
private:
|
||||||
Ui::Picture *ui;
|
Ui::Picture *ui;
|
||||||
QDir directory;
|
QDir directory;
|
||||||
|
QProcess commandProcess;
|
||||||
};
|
};
|
||||||
#endif // PICTURE_H
|
#endif // PICTURE_H
|
||||||
|
67
picture.ui
67
picture.ui
@ -14,11 +14,27 @@
|
|||||||
<string>Picture</string>
|
<string>Picture</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
|
<widget class="QTabWidget" name="tabField">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>471</width>
|
||||||
|
<height>301</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Commands</string>
|
||||||
|
</attribute>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>11</x>
|
<x>20</x>
|
||||||
<y>1</y>
|
<y>20</y>
|
||||||
<width>258</width>
|
<width>258</width>
|
||||||
<height>229</height>
|
<height>229</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -47,26 +63,49 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="erase">
|
<widget class="QWidget" name="">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>310</x>
|
<x>300</x>
|
||||||
<y>10</y>
|
<y>60</y>
|
||||||
<width>124</width>
|
<width>107</width>
|
||||||
<height>27</height>
|
<height>62</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="erase">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Erase Metadata</string>
|
<string>Erase Metadata</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Label</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<zorder>fileList</zorder>
|
||||||
|
<zorder>fileList</zorder>
|
||||||
|
<zorder>layoutWidget</zorder>
|
||||||
|
<zorder>erase</zorder>
|
||||||
|
<zorder>pushButton</zorder>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Log</string>
|
||||||
|
</attribute>
|
||||||
<widget class="QTextEdit" name="log">
|
<widget class="QTextEdit" name="log">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>310</x>
|
<x>10</x>
|
||||||
<y>60</y>
|
<y>10</y>
|
||||||
<width>301</width>
|
<width>381</width>
|
||||||
<height>191</height>
|
<height>192</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
@ -76,8 +115,8 @@
|
|||||||
<widget class="QPushButton" name="clearLog">
|
<widget class="QPushButton" name="clearLog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>561</x>
|
<x>270</x>
|
||||||
<y>222</y>
|
<y>220</y>
|
||||||
<width>51</width>
|
<width>51</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -87,6 +126,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
Loading…
Reference in New Issue
Block a user