306 |
306 |
}
|
307 |
307 |
|
308 |
308 |
}
|
309 |
|
|
310 |
|
|
311 |
|
ui->lwPictures->clear();
|
312 |
|
m_currentProjectDir = item->data(1,0).toString();
|
313 |
|
m_currentProjectPictureNumber=0;
|
314 |
|
|
315 |
|
QDir dir(item->data(1,0).toString()+"/thumbs/");
|
316 |
|
dir.setFilter(QDir::Files);
|
317 |
|
dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
|
318 |
|
QFileInfoList list = dir.entryInfoList();
|
319 |
|
for(int i = 0; i < list.count(); i++) {
|
320 |
|
qDebug() << list.at(i).fileName();
|
321 |
|
QListWidgetItem *newitem = new QListWidgetItem();
|
322 |
|
QIcon icone(list.at(i).absoluteFilePath());//pour la mettre à coté de l'item
|
323 |
|
newitem->setIcon(icone); // ajout de la petite icone sur l'item
|
324 |
|
newitem->setText(list.at(i).fileName());
|
325 |
|
ui->lwPictures->insertItem(i,newitem);
|
326 |
|
m_currentProjectPictureNumber = i;
|
327 |
|
}
|
328 |
|
|
329 |
|
if(m_currentProjectPictureNumber == 0) {
|
330 |
|
qDebug() << "Pas d'image ... message";
|
331 |
|
m_labelDeposez->resize(ui->lwPictures->size());
|
332 |
|
m_labelDeposez->move(ui->lwPictures->pos());
|
333 |
|
m_labelDeposez->show();
|
334 |
|
qDebug() << m_labelDeposez->pos();
|
335 |
|
qDebug() << m_labelDeposez->size();
|
336 |
|
}
|
337 |
|
else {
|
338 |
|
m_labelDeposez->hide();
|
339 |
|
}
|
340 |
|
m_currentProjectPictureNumber++;
|
|
309 |
m_currentProjectPictureNumber++;
|
|
310 |
refreshPictureList();
|
341 |
311 |
qDebug() << "On continue la numerotation a " << m_currentProjectPictureNumber;
|
342 |
312 |
qDebug() << "Espace de stockage du projet " << m_currentProjectDir;
|
343 |
313 |
}
|
... | ... | |
411 |
381 |
ui->statusBar->showMessage(trUtf8("Fichier en cours: %1").arg(fic),3000);
|
412 |
382 |
qApp->processEvents();
|
413 |
383 |
|
|
384 |
if(m_currentProjectPictureNumber == 0)
|
|
385 |
m_currentProjectPictureNumber = 1;
|
|
386 |
|
414 |
387 |
qDebug() << "Processing : " << fic;
|
415 |
388 |
QPixmap pixmap(fic);
|
416 |
389 |
pixmap.save(QString("%1/hq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber));
|
... | ... | |
439 |
412 |
ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq] [lq] [meta]").arg(fic),3000);
|
440 |
413 |
|
441 |
414 |
//================== on copie les metadata
|
442 |
|
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fic.toStdString());
|
443 |
|
Exiv2::Image::AutoPtr imageLQ = Exiv2::ImageFactory::open(QString("%1/lq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
444 |
|
Exiv2::Image::AutoPtr imageMQ = Exiv2::ImageFactory::open(QString("%1/mq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
445 |
|
Exiv2::Image::AutoPtr imageHQ = Exiv2::ImageFactory::open(QString("%1/hq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
446 |
|
Exiv2::Image::AutoPtr imageThumb = Exiv2::ImageFactory::open(QString("%1/thumbs/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
447 |
|
if (image.get() != 0)
|
448 |
|
{
|
449 |
|
image->readMetadata();
|
450 |
|
Exiv2::ExifData &exifData = image->exifData();
|
451 |
|
if (!exifData.empty())
|
|
415 |
try {
|
|
416 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fic.toStdString());
|
|
417 |
Exiv2::Image::AutoPtr imageLQ = Exiv2::ImageFactory::open(QString("%1/lq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
|
418 |
Exiv2::Image::AutoPtr imageMQ = Exiv2::ImageFactory::open(QString("%1/mq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
|
419 |
Exiv2::Image::AutoPtr imageHQ = Exiv2::ImageFactory::open(QString("%1/hq/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
|
420 |
Exiv2::Image::AutoPtr imageThumb = Exiv2::ImageFactory::open(QString("%1/thumbs/img-%2.jpg").arg(m_currentProjectDir).arg(m_currentProjectPictureNumber).toStdString());
|
|
421 |
if (image.get() != 0)
|
452 |
422 |
{
|
453 |
|
bool setArtist = false;
|
454 |
|
bool setCopyright = false;
|
455 |
|
bool setSoftware = false;
|
456 |
|
Exiv2::ExifData::const_iterator end = exifData.end();
|
457 |
|
qDebug() << "============================ DEBUT ===============================";
|
458 |
|
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i)
|
|
423 |
image->readMetadata();
|
|
424 |
Exiv2::ExifData &exifData = image->exifData();
|
|
425 |
if (!exifData.empty())
|
459 |
426 |
{
|
460 |
|
qDebug() << i->key().c_str() << " = " << i->value().toString().c_str();
|
461 |
|
if (i->key() == "Exif.Image.Artist") {
|
462 |
|
exifData["Exif.Image.Artist"] = "Eric S.";
|
463 |
|
setArtist = true;
|
464 |
|
}
|
465 |
|
if (i->key() == "Exif.Image.Copyright") {
|
466 |
|
exifData["Exif.Image.Copyright"] = "Eric S.";
|
467 |
|
setCopyright = true;
|
|
427 |
bool setArtist = false;
|
|
428 |
bool setCopyright = false;
|
|
429 |
bool setSoftware = false;
|
|
430 |
Exiv2::ExifData::const_iterator end = exifData.end();
|
|
431 |
// qDebug() << "============================ DEBUT ===============================";
|
|
432 |
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i)
|
|
433 |
{
|
|
434 |
// qDebug() << i->key().c_str() << " = " << i->value().toString().c_str();
|
|
435 |
if (i->key() == "Exif.Image.Artist") {
|
|
436 |
exifData["Exif.Image.Artist"] = "Eric S.";
|
|
437 |
setArtist = true;
|
|
438 |
}
|
|
439 |
if (i->key() == "Exif.Image.Copyright") {
|
|
440 |
exifData["Exif.Image.Copyright"] = "Eric S.";
|
|
441 |
setCopyright = true;
|
|
442 |
}
|
|
443 |
if (i->key() == "Exif.Image.Software") {
|
|
444 |
exifData["Exif.Image.Software"] = "RyXeo WebPhotoAlbum - http://www.ryxeo.com/";
|
|
445 |
setSoftware = true;
|
|
446 |
}
|
468 |
447 |
}
|
469 |
|
if (i->key() == "Exif.Image.Software") {
|
470 |
|
exifData["Exif.Image.Software"] = "RyXeo WebPhotoAlbum - http://www.ryxeo.com/";
|
471 |
|
setSoftware = true;
|
|
448 |
//Si on n'a pas les meta il faut les ajouter
|
|
449 |
|
|
450 |
//Mise à jour de l'auteur
|
|
451 |
if(!setArtist) {
|
|
452 |
Exiv2::ExifKey k("Exif.Image.Artist");
|
|
453 |
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString);
|
|
454 |
v->read("Eric S.");
|
|
455 |
exifData.add(k,v.get());
|
472 |
456 |
}
|
473 |
|
}
|
474 |
|
//Si on n'a pas les meta il faut les ajouter
|
475 |
|
|
476 |
|
//Mise à jour de l'auteur
|
477 |
|
if(!setArtist) {
|
478 |
|
Exiv2::ExifKey k("Exif.Image.Artist");
|
479 |
|
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString);
|
480 |
|
v->read("Eric S.");
|
481 |
|
exifData.add(k,v.get());
|
482 |
|
}
|
483 |
457 |
|
484 |
|
if(!setCopyright) {
|
485 |
|
Exiv2::ExifKey k2("Exif.Image.Copyright");
|
486 |
|
Exiv2::Value::AutoPtr v2 = Exiv2::Value::create(Exiv2::asciiString);
|
487 |
|
v2->read("Eric S.");
|
488 |
|
exifData.add(k2,v2.get());
|
489 |
|
}
|
|
458 |
if(!setCopyright) {
|
|
459 |
Exiv2::ExifKey k2("Exif.Image.Copyright");
|
|
460 |
Exiv2::Value::AutoPtr v2 = Exiv2::Value::create(Exiv2::asciiString);
|
|
461 |
v2->read("Eric S.");
|
|
462 |
exifData.add(k2,v2.get());
|
|
463 |
}
|
490 |
464 |
|
491 |
|
if(!setSoftware) {
|
492 |
|
Exiv2::ExifKey k3("Exif.Image.Software");
|
493 |
|
Exiv2::Value::AutoPtr v3 = Exiv2::Value::create(Exiv2::asciiString);
|
494 |
|
v3->read("RyXéo WebPhotoAlbum - http://www.ryxeo.com/");
|
495 |
|
exifData.add(k3,v3.get());
|
496 |
|
}
|
|
465 |
if(!setSoftware) {
|
|
466 |
Exiv2::ExifKey k3("Exif.Image.Software");
|
|
467 |
Exiv2::Value::AutoPtr v3 = Exiv2::Value::create(Exiv2::asciiString);
|
|
468 |
v3->read("RyXéo WebPhotoAlbum - http://www.ryxeo.com/");
|
|
469 |
exifData.add(k3,v3.get());
|
|
470 |
}
|
497 |
471 |
|
498 |
|
qDebug() << "============================ APRES ===============================";
|
499 |
|
Exiv2::ExifData::const_iterator end2 = exifData.end();
|
500 |
|
for (Exiv2::ExifData::const_iterator i2 = exifData.begin(); i2 != end2; ++i2)
|
501 |
|
{
|
502 |
|
qDebug() << i2->key().c_str() << " = " << i2->value().toString().c_str();
|
503 |
|
}
|
504 |
|
qDebug() << "============================ FIN ===============================";
|
|
472 |
// qDebug() << "============================ APRES ===============================";
|
|
473 |
Exiv2::ExifData::const_iterator end2 = exifData.end();
|
|
474 |
// for (Exiv2::ExifData::const_iterator i2 = exifData.begin(); i2 != end2; ++i2)
|
|
475 |
// {
|
|
476 |
// qDebug() << i2->key().c_str() << " = " << i2->value().toString().c_str();
|
|
477 |
// }
|
|
478 |
// qDebug() << "============================ FIN ===============================";
|
505 |
479 |
|
506 |
|
imageLQ->setExifData(exifData);
|
507 |
|
imageLQ->writeMetadata();
|
|
480 |
imageLQ->setExifData(exifData);
|
|
481 |
imageLQ->writeMetadata();
|
508 |
482 |
|
509 |
|
imageMQ->setExifData(exifData);
|
510 |
|
imageMQ->writeMetadata();
|
|
483 |
imageMQ->setExifData(exifData);
|
|
484 |
imageMQ->writeMetadata();
|
511 |
485 |
|
512 |
|
imageHQ->setExifData(exifData);
|
513 |
|
imageHQ->writeMetadata();
|
|
486 |
imageHQ->setExifData(exifData);
|
|
487 |
imageHQ->writeMetadata();
|
514 |
488 |
|
515 |
|
imageThumb->setExifData(exifData);
|
516 |
|
imageThumb->writeMetadata();
|
|
489 |
imageThumb->setExifData(exifData);
|
|
490 |
imageThumb->writeMetadata();
|
|
491 |
}
|
517 |
492 |
}
|
518 |
493 |
}
|
519 |
|
m_currentProjectPictureNumber++;
|
|
494 |
catch(...) {
|
|
495 |
qDebug() << "Erreur EXIV2";
|
|
496 |
}
|
520 |
497 |
ui->statusBar->showMessage(trUtf8("Fichier en cours: %1 [hq] [mq] [lq] [meta] ... terminé").arg(fic),3000);
|
|
498 |
m_currentProjectPictureNumber++;
|
|
499 |
refreshPictureList();
|
521 |
500 |
}
|
522 |
501 |
|
523 |
|
void original::on_btnFTPPublish_clicked()
|
|
502 |
void original::refreshPictureList()
|
|
503 |
{
|
|
504 |
QTreeWidgetItem *item = ui->treeWidget->currentItem();
|
|
505 |
ui->lwPictures->clear();
|
|
506 |
m_currentProjectDir = item->data(1,0).toString();
|
|
507 |
int currentProjectPictureNumber=0;
|
|
508 |
|
|
509 |
QDir dir(item->data(1,0).toString()+"/thumbs/");
|
|
510 |
dir.setFilter(QDir::Files);
|
|
511 |
dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
|
|
512 |
QFileInfoList list = dir.entryInfoList();
|
|
513 |
for(int i = 0; i < list.count(); i++) {
|
|
514 |
qDebug() << list.at(i).fileName();
|
|
515 |
QListWidgetItem *newitem = new QListWidgetItem();
|
|
516 |
QIcon icone(list.at(i).absoluteFilePath());//pour la mettre à coté de l'item
|
|
517 |
newitem->setIcon(icone); // ajout de la petite icone sur l'item
|
|
518 |
newitem->setText(list.at(i).fileName());
|
|
519 |
ui->lwPictures->insertItem(i,newitem);
|
|
520 |
currentProjectPictureNumber = i+1;
|
|
521 |
}
|
|
522 |
|
|
523 |
if(currentProjectPictureNumber == 0) {
|
|
524 |
qDebug() << "Pas d'image ... on affiche le message drag & drop";
|
|
525 |
m_labelDeposez->resize(ui->lwPictures->size());
|
|
526 |
m_labelDeposez->move(ui->lwPictures->pos());
|
|
527 |
m_labelDeposez->show();
|
|
528 |
qDebug() << m_labelDeposez->pos();
|
|
529 |
qDebug() << m_labelDeposez->size();
|
|
530 |
}
|
|
531 |
else {
|
|
532 |
m_labelDeposez->hide();
|
|
533 |
}
|
|
534 |
}
|
|
535 |
|
|
536 |
void original::ftpConnect()
|
524 |
537 |
{
|
525 |
538 |
m_currentFTPFileUpload = -1;
|
526 |
539 |
|
... | ... | |
545 |
558 |
m_ftp->mkdir(ui->leFTPDirectory->text());
|
546 |
559 |
m_ftp->mkdir(ui->leFTPDirectory->text() + "/galleries");
|
547 |
560 |
|
548 |
|
|
549 |
|
|
550 |
561 |
//On uploade l'album en cours
|
551 |
562 |
//m_ftp->put()
|
552 |
|
|
553 |
|
|
554 |
563 |
}
|
555 |
564 |
|
556 |
565 |
void original::ftpCommandFinished(int commandId, bool error)
|
... | ... | |
583 |
592 |
}
|
584 |
593 |
|
585 |
594 |
//on passe au suivant
|
586 |
|
if(m_currentFTPFileUpload >= 0 && m_currentFTPFileUpload < m_fileListToUploadIndex.count()) {
|
|
595 |
if(m_currentFTPFileUpload >= 0 && m_fileListToUploadIndex.count() > 0) {
|
|
596 |
qDebug() << "Il en reste encore a envoyer ";
|
587 |
597 |
if(m_typeUploadRecursif == "PHP")
|
588 |
598 |
uploadRecursifPHP();
|
589 |
599 |
else
|
590 |
600 |
uploadRecursifGallery();
|
591 |
601 |
}
|
|
602 |
else {
|
|
603 |
qDebug() << "Tout a ete expedie ";
|
|
604 |
}
|
592 |
605 |
}
|
593 |
606 |
|
594 |
607 |
void original::addToList(const QUrlInfo &urlInfo)
|
... | ... | |
603 |
616 |
|
604 |
617 |
void original::on_btnPHP_clicked()
|
605 |
618 |
{
|
|
619 |
ftpConnect();
|
606 |
620 |
qDebug() << "on_btnPHP_clicked";
|
607 |
621 |
//On uploade le code php
|
608 |
622 |
m_ftp->cd(ui->leFTPDirectory->text());
|
... | ... | |
664 |
678 |
{
|
665 |
679 |
qDebug() << "parcoursRecursif : " << rep;
|
666 |
680 |
QDir dir(rep);
|
667 |
|
dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
|
681 |
dir.setFilter(QDir::Hidden | QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
668 |
682 |
QFileInfoList list = dir.entryInfoList();
|
669 |
683 |
for(int i = 0; i < list.count(); i++) {
|
670 |
684 |
qDebug() << "Ajout de ... " << list.at(i).absoluteFilePath();
|
... | ... | |
678 |
692 |
|
679 |
693 |
void original::on_btnUpload_clicked()
|
680 |
694 |
{
|
|
695 |
ftpConnect();
|
681 |
696 |
qDebug() << "on_btnUpload_clicked : " << ui->treeWidget->currentItem()->data(1,0).toString();
|
682 |
697 |
QFileInfo fi(ui->treeWidget->currentItem()->data(1,0).toString());
|
683 |
698 |
QDir dir(fi.absoluteFilePath());
|