1 |
|
/**
|
2 |
|
* Classe
|
|
1 |
/** Classe original: nom du projet prototype :)
|
3 |
2 |
* @see https://redmine.ryxeo.com/projects/
|
4 |
3 |
* @author 2012 Eric Seigne <eric.seigne@ryxeo.com>
|
5 |
4 |
* @see The GNU Public License (GNU/GPL) v3
|
... | ... | |
106 |
105 |
delete ui;
|
107 |
106 |
}
|
108 |
107 |
|
109 |
|
//void original::on_btnExport_clicked()
|
110 |
|
//{
|
111 |
|
// //Creation de la destination
|
112 |
|
// QDir rep;
|
113 |
|
// QString dest = ui->leDest->text().trimmed() + "/web-gallery";
|
114 |
|
// rep.mkpath(dest);
|
115 |
|
// rep.mkpath(dest + "/hq");
|
116 |
|
// rep.mkpath(dest + "/lq");
|
117 |
|
// rep.mkpath(dest + "/mq");
|
118 |
|
// rep.mkpath(dest + "/thumbs");
|
119 |
|
// rep.mkpath(dest + "/zip");
|
120 |
|
// rep.mkpath(dest + "/comments");
|
121 |
|
|
122 |
|
// //Creation des images
|
123 |
|
// QDir dir(ui->leSource->text().trimmed());
|
124 |
|
// dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
125 |
|
// QFileInfoList list = dir.entryInfoList();
|
126 |
|
// for(int i = 0; i < list.count(); i++) {
|
127 |
|
// ui->statusBar->clearMessage();
|
128 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1").arg(list.at(i).fileName()),3000);
|
129 |
|
// qApp->processEvents();
|
130 |
|
|
131 |
|
// qDebug() << "Processing : " << list.at(i).absoluteFilePath();
|
132 |
|
// QPixmap pixmap(list.at(i).absoluteFilePath());
|
133 |
|
// pixmap.save(QString("%1/hq/img-%2.jpg").arg(dest).arg(i));
|
134 |
|
|
135 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq]").arg(list.at(i).fileName()),3000);
|
136 |
|
// QPixmap pixmapThumbs(pixmap.scaled(QSize(120,120), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
137 |
|
// pixmapThumbs.save(QString("%1/thumbs/img-%2.jpg").arg(dest).arg(i));
|
138 |
|
|
139 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq]").arg(list.at(i).fileName()),3000);
|
140 |
|
// QPixmap pixmapMQ(pixmap.scaled(QSize(800,600), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
141 |
|
// pixmapMQ.save(QString("%1/mq/img-%2.jpg").arg(dest).arg(i));
|
142 |
|
|
143 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq] [lq]").arg(list.at(i).fileName()),3000);
|
144 |
|
// QPixmap pixmapLQ(pixmap.scaled(QSize(640,480), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
145 |
|
// pixmapLQ.save(QString("%1/lq/img-%2.jpg").arg(dest).arg(i));
|
146 |
|
|
147 |
|
|
148 |
|
// QFile file(QString("%1/comments/%2.txt").arg(dest).arg(i));
|
149 |
|
// if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
150 |
|
// return;
|
151 |
|
|
152 |
|
// QTextStream out(&file);
|
153 |
|
// out << "<span>Photo " + QString::number(i) + "</span>\n";
|
154 |
|
// file.close();
|
155 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq] [lq] [meta]").arg(list.at(i).fileName()),3000);
|
156 |
|
|
157 |
|
// //================== on copie les metadata
|
158 |
|
// Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(list.at(i).absoluteFilePath().toStdString());
|
159 |
|
// Exiv2::Image::AutoPtr imageLQ = Exiv2::ImageFactory::open(QString("%1/lq/img-%2.jpg").arg(dest).arg(i).toStdString());
|
160 |
|
// Exiv2::Image::AutoPtr imageMQ = Exiv2::ImageFactory::open(QString("%1/mq/img-%2.jpg").arg(dest).arg(i).toStdString());
|
161 |
|
// Exiv2::Image::AutoPtr imageHQ = Exiv2::ImageFactory::open(QString("%1/hq/img-%2.jpg").arg(dest).arg(i).toStdString());
|
162 |
|
// Exiv2::Image::AutoPtr imageThumb = Exiv2::ImageFactory::open(QString("%1/thumbs/img-%2.jpg").arg(dest).arg(i).toStdString());
|
163 |
|
// if (image.get() != 0)
|
164 |
|
// {
|
165 |
|
// image->readMetadata();
|
166 |
|
// Exiv2::ExifData &exifData = image->exifData();
|
167 |
|
// if (!exifData.empty())
|
168 |
|
// {
|
169 |
|
// bool setArtist = false;
|
170 |
|
// bool setCopyright = false;
|
171 |
|
// bool setSoftware = false;
|
172 |
|
// Exiv2::ExifData::const_iterator end = exifData.end();
|
173 |
|
// qDebug() << "============================ DEBUT ===============================";
|
174 |
|
// for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i)
|
175 |
|
// {
|
176 |
|
// qDebug() << i->key().c_str() << " = " << i->value().toString().c_str();
|
177 |
|
// if (i->key() == "Exif.Image.Artist") {
|
178 |
|
// exifData["Exif.Image.Artist"] = ui->leAuthor->text().trimmed().toStdString();
|
179 |
|
// setArtist = true;
|
180 |
|
// }
|
181 |
|
// if (i->key() == "Exif.Image.Copyright") {
|
182 |
|
// exifData["Exif.Image.Copyright"] = ui->leAuthor->text().trimmed().toStdString();
|
183 |
|
// setCopyright = true;
|
184 |
|
// }
|
185 |
|
// if (i->key() == "Exif.Image.Software") {
|
186 |
|
// exifData["Exif.Image.Software"] = "RyXeo WebPhotoAlbum - http://www.ryxeo.com/";
|
187 |
|
// setSoftware = true;
|
188 |
|
// }
|
189 |
|
// }
|
190 |
|
// //Si on n'a pas les meta il faut les ajouter
|
191 |
|
|
192 |
|
// //Mise à jour de l'auteur
|
193 |
|
// if(!setArtist) {
|
194 |
|
// Exiv2::ExifKey k("Exif.Image.Artist");
|
195 |
|
// Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString);
|
196 |
|
// v->read(ui->leAuthor->text().trimmed().toStdString());
|
197 |
|
// exifData.add(k,v.get());
|
198 |
|
// }
|
199 |
|
|
200 |
|
// if(!setCopyright) {
|
201 |
|
// Exiv2::ExifKey k2("Exif.Image.Copyright");
|
202 |
|
// Exiv2::Value::AutoPtr v2 = Exiv2::Value::create(Exiv2::asciiString);
|
203 |
|
// v2->read(ui->leAuthor->text().trimmed().toStdString());
|
204 |
|
// exifData.add(k2,v2.get());
|
205 |
|
// }
|
206 |
|
|
207 |
|
// if(!setSoftware) {
|
208 |
|
// Exiv2::ExifKey k3("Exif.Image.Software");
|
209 |
|
// Exiv2::Value::AutoPtr v3 = Exiv2::Value::create(Exiv2::asciiString);
|
210 |
|
// v3->read("RyXéo WebPhotoAlbum - http://www.ryxeo.com/");
|
211 |
|
// exifData.add(k3,v3.get());
|
212 |
|
// }
|
213 |
|
|
214 |
|
// qDebug() << "============================ APRES ===============================";
|
215 |
|
// Exiv2::ExifData::const_iterator end2 = exifData.end();
|
216 |
|
// for (Exiv2::ExifData::const_iterator i2 = exifData.begin(); i2 != end2; ++i2)
|
217 |
|
// {
|
218 |
|
// qDebug() << i2->key().c_str() << " = " << i2->value().toString().c_str();
|
219 |
|
// }
|
220 |
|
// qDebug() << "============================ FIN ===============================";
|
221 |
|
|
222 |
|
// imageLQ->setExifData(exifData);
|
223 |
|
// imageLQ->writeMetadata();
|
224 |
|
|
225 |
|
// imageMQ->setExifData(exifData);
|
226 |
|
// imageMQ->writeMetadata();
|
227 |
|
|
228 |
|
// imageHQ->setExifData(exifData);
|
229 |
|
// imageHQ->writeMetadata();
|
230 |
|
|
231 |
|
// imageThumb->setExifData(exifData);
|
232 |
|
// imageThumb->writeMetadata();
|
233 |
|
// }
|
234 |
|
// }
|
235 |
|
// ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq] [lq] [meta] ... terminé").arg(list.at(i).fileName()),3000);
|
236 |
|
// }
|
237 |
|
//}
|
238 |
|
|
239 |
108 |
void original::on_action_Nouvel_album_triggered()
|
240 |
109 |
{
|
241 |
110 |
m_currentProjectPictureNumber = 0;
|