"Erase Other Metadata" checkbox added and works correctly
This commit is contained in:
parent
8d5e2e4e81
commit
e722dea0dc
@ -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-20T13:04:41. -->
|
<!-- Written by QtCreator 3.0.1, 2014-06-22T19:25:12. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
14
picture.cpp
14
picture.cpp
@ -115,10 +115,10 @@ void Picture::on_processButton_pressed(){
|
|||||||
void Picture::on_processButton_clicked(){
|
void Picture::on_processButton_clicked(){
|
||||||
bool ignored=false;
|
bool ignored=false;
|
||||||
QStringList myStringList;
|
QStringList myStringList;
|
||||||
for (int i = 0; i < ui->fileList->count(); ++i)
|
for (int i=0;i<ui->fileList->count();++i){
|
||||||
myStringList.append(ui->fileList->item(i)->text());
|
myStringList.append(ui->fileList->item(i)->text());
|
||||||
qDebug() << myStringList;
|
}
|
||||||
//foreach(const QString &str,directory.entryList()){
|
qDebug()<<myStringList;
|
||||||
foreach(const QString &str,myStringList){
|
foreach(const QString &str,myStringList){
|
||||||
QImageReader reader(str);
|
QImageReader reader(str);
|
||||||
if(!reader.format().isEmpty()){
|
if(!reader.format().isEmpty()){
|
||||||
@ -127,7 +127,10 @@ void Picture::on_processButton_clicked(){
|
|||||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
|
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
|
||||||
assert (image.get() != 0);
|
assert (image.get() != 0);
|
||||||
image->readMetadata();
|
image->readMetadata();
|
||||||
Exiv2::ExifData &exifData = image->exifData();
|
if(ui->eraseOtherMetadata->isChecked()){
|
||||||
|
image->clearMetadata();
|
||||||
|
}
|
||||||
|
Exiv2::ExifData &exifData=image->exifData();
|
||||||
exifData["Exif.Photo.UserComment"] = "charset=Ascii "+ui->labelText->text().toStdString();
|
exifData["Exif.Photo.UserComment"] = "charset=Ascii "+ui->labelText->text().toStdString();
|
||||||
image->writeMetadata();
|
image->writeMetadata();
|
||||||
}catch(Exiv2::AnyError& e){
|
}catch(Exiv2::AnyError& e){
|
||||||
@ -135,7 +138,7 @@ void Picture::on_processButton_clicked(){
|
|||||||
msgBox.setInformativeText("The program could not process the file: "+fullPath);
|
msgBox.setInformativeText("The program could not process the file: "+fullPath);
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
int ret=msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(!ignored){
|
if(!ignored){
|
||||||
@ -147,4 +150,3 @@ void Picture::on_processButton_clicked(){
|
|||||||
}
|
}
|
||||||
ui->log->append("Done erasing metadata");
|
ui->log->append("Done erasing metadata");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
picture.ui
28
picture.ui
@ -61,7 +61,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="erase">
|
<widget class="QPushButton" name="erase">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Erase Metadata</string>
|
<string>Erase All Metadata</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -88,6 +88,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="labelText"/>
|
<widget class="QLineEdit" name="labelText"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="eraseOtherMetadata">
|
||||||
|
<property name="text">
|
||||||
|
<string>Erase Other Metadata</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="eraseGpsData">
|
<widget class="QCheckBox" name="eraseGpsData">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -167,5 +174,22 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>eraseOtherMetadata</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>eraseGpsData</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>428</x>
|
||||||
|
<y>367</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>432</x>
|
||||||
|
<y>387</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user