"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"?>
|
||||
<!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>
|
||||
<data>
|
||||
<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(){
|
||||
bool ignored=false;
|
||||
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());
|
||||
qDebug() << myStringList;
|
||||
//foreach(const QString &str,directory.entryList()){
|
||||
}
|
||||
qDebug()<<myStringList;
|
||||
foreach(const QString &str,myStringList){
|
||||
QImageReader reader(str);
|
||||
if(!reader.format().isEmpty()){
|
||||
@ -127,7 +127,10 @@ void Picture::on_processButton_clicked(){
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
|
||||
assert (image.get() != 0);
|
||||
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();
|
||||
image->writeMetadata();
|
||||
}catch(Exiv2::AnyError& e){
|
||||
@ -135,7 +138,7 @@ void Picture::on_processButton_clicked(){
|
||||
msgBox.setInformativeText("The program could not process the file: "+fullPath);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
int ret=msgBox.exec();
|
||||
msgBox.exec();
|
||||
}
|
||||
}else{
|
||||
if(!ignored){
|
||||
@ -147,4 +150,3 @@ void Picture::on_processButton_clicked(){
|
||||
}
|
||||
ui->log->append("Done erasing metadata");
|
||||
}
|
||||
|
||||
|
28
picture.ui
28
picture.ui
@ -61,7 +61,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="erase">
|
||||
<property name="text">
|
||||
<string>Erase Metadata</string>
|
||||
<string>Erase All Metadata</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -88,6 +88,13 @@
|
||||
<item>
|
||||
<widget class="QLineEdit" name="labelText"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="eraseOtherMetadata">
|
||||
<property name="text">
|
||||
<string>Erase Other Metadata</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="eraseGpsData">
|
||||
<property name="text">
|
||||
@ -167,5 +174,22 @@
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user