Révision 5ea3da39
original.cpp | ||
---|---|---|
584 | 584 |
|
585 | 585 |
//on passe au suivant |
586 | 586 |
if(m_currentFTPFileUpload >= 0 && m_currentFTPFileUpload < m_fileListToUploadIndex.count()) { |
587 |
uploadRecursif(); |
|
587 |
if(m_typeUploadRecursif == "PHP") |
|
588 |
uploadRecursifPHP(); |
|
589 |
else |
|
590 |
uploadRecursifGallery(); |
|
588 | 591 |
} |
589 | 592 |
} |
590 | 593 |
|
... | ... | |
608 | 611 |
m_fileListToUploadIndex.clear(); |
609 | 612 |
m_currentFTPFileUpload = 0; |
610 | 613 |
parcoursRecursif(dir.absolutePath(),""); |
611 |
qDebug() << m_fileListToUpload; |
|
614 |
//qDebug() << m_fileListToUpload; |
|
615 |
m_typeUploadRecursif = "PHP"; |
|
616 |
uploadRecursifPHP(); |
|
612 | 617 |
} |
613 | 618 |
|
614 |
void original::uploadRecursif() |
|
619 |
void original::uploadRecursifPHP()
|
|
615 | 620 |
{ |
616 | 621 |
qDebug() << "uploadRecursif : "; |
617 | 622 |
if(m_currentFTPFileUpload < m_fileListToUploadIndex.count()) { |
618 | 623 |
QFileInfo fi(m_fileListToUploadIndex.at(m_currentFTPFileUpload)); |
619 | 624 |
if(fi.isDir()) { |
620 |
QString ladest = ui->leFTPDirectory->text() + "/" + fi.absoluteFilePath().remove(m_baseDir.absolutePath() + "/www");
|
|
625 |
QString ladest = ui->leFTPDirectory->text() + "/" + fi.absoluteFilePath().remove(m_baseDir.absolutePath()).remove("/www");
|
|
621 | 626 |
qDebug() << "mkdir : " << ladest; |
622 | 627 |
m_ftp->mkdir(ladest); |
623 | 628 |
} |
... | ... | |
633 | 638 |
} |
634 | 639 |
} |
635 | 640 |
|
641 |
void original::uploadRecursifGallery() |
|
642 |
{ |
|
643 |
qDebug() << "uploadRecursifGallery : "; |
|
644 |
if(m_currentFTPFileUpload < m_fileListToUploadIndex.count()) { |
|
645 |
QFileInfo fi(m_fileListToUploadIndex.at(m_currentFTPFileUpload)); |
|
646 |
if(fi.isDir()) { |
|
647 |
QString ladest = ui->leFTPDirectory->text() + "/galleries/" + fi.absoluteFilePath().remove(m_baseDir.absolutePath()).remove("/www"); |
|
648 |
qDebug() << "mkdir : " << ladest; |
|
649 |
m_ftp->mkdir(ladest); |
|
650 |
} |
|
651 |
else { |
|
652 |
QFile *fic = new QFile(fi.absoluteFilePath()); |
|
653 |
fic->open(QIODevice::ReadOnly); |
|
654 |
QString ladest = ui->leFTPDirectory->text() + "/galleries/" + m_fileListToUpload.value(fi.absoluteFilePath()) + "/" + fi.fileName(); |
|
655 |
qDebug() << "Upload : " << fi.fileName() << " -> " << ladest; |
|
656 |
m_ftp->put(fic,ladest); |
|
657 |
fic->close(); |
|
658 |
} |
|
659 |
m_currentFTPFileUpload++; |
|
660 |
} |
|
661 |
} |
|
662 |
|
|
636 | 663 |
void original::parcoursRecursif(QString rep, QString repertoireServeur) |
637 | 664 |
{ |
638 | 665 |
qDebug() << "parcoursRecursif : " << rep; |
... | ... | |
644 | 671 |
m_fileListToUpload.insert(list.at(i).absoluteFilePath(), repertoireServeur); |
645 | 672 |
m_fileListToUploadIndex << list.at(i).absoluteFilePath(); |
646 | 673 |
if(list.at(i).isDir()) { |
647 |
parcoursRecursif(list.at(i).absoluteFilePath(), list.at(i).absoluteFilePath().remove(m_baseDir.absolutePath() + "/www"));
|
|
674 |
parcoursRecursif(list.at(i).absoluteFilePath(), list.at(i).absoluteFilePath().remove(m_baseDir.absolutePath()).remove("/www"));
|
|
648 | 675 |
} |
649 | 676 |
} |
650 | 677 |
} |
651 | 678 |
|
652 | 679 |
void original::on_btnUpload_clicked() |
653 | 680 |
{ |
654 |
uploadRecursif(); |
|
681 |
qDebug() << "on_btnUpload_clicked : " << ui->treeWidget->currentItem()->data(1,0).toString(); |
|
682 |
QFileInfo fi(ui->treeWidget->currentItem()->data(1,0).toString()); |
|
683 |
QDir dir(fi.absoluteFilePath()); |
|
684 |
m_fileListToUpload.clear(); |
|
685 |
m_fileListToUploadIndex.clear(); |
|
686 |
m_currentFTPFileUpload = 0; |
|
687 |
parcoursRecursif(dir.absolutePath(),ui->treeWidget->currentItem()->text(0)); |
|
688 |
// qDebug() << m_fileListToUpload; |
|
689 |
m_typeUploadRecursif = "Gallery"; |
|
690 |
|
|
691 |
QString ladest = ui->leFTPDirectory->text() + "/galleries/" + ui->treeWidget->currentItem()->text(0); |
|
692 |
qDebug() << "mkdir : " << ladest; |
|
693 |
m_ftp->mkdir(ladest); |
|
694 |
// uploadRecursifGallery(); |
|
655 | 695 |
} |
original.h | ||
---|---|---|
73 | 73 |
qint64 totalBytes); |
74 | 74 |
|
75 | 75 |
void on_btnPHP_clicked(); |
76 |
void uploadRecursif(); |
|
76 |
void uploadRecursifPHP(); |
|
77 |
void uploadRecursifGallery(); |
|
77 | 78 |
void parcoursRecursif(QString rep, QString repertoireServeur); |
78 | 79 |
|
79 | 80 |
void on_btnUpload_clicked(); |
... | ... | |
84 | 85 |
QMenu *m_menu; |
85 | 86 |
QLabel *m_labelDeposez; |
86 | 87 |
QString m_currentProjectDir; |
88 |
QString m_typeUploadRecursif; |
|
87 | 89 |
QStringList m_fileListToUploadIndex; |
88 | 90 |
QMap<QString,QString> m_fileListToUpload; |
89 | 91 |
int m_currentProjectPictureNumber; |
original.ui | ||
---|---|---|
74 | 74 |
</widget> |
75 | 75 |
<widget class="QTabWidget" name="tabWidget"> |
76 | 76 |
<property name="currentIndex"> |
77 |
<number>2</number>
|
|
77 |
<number>0</number>
|
|
78 | 78 |
</property> |
79 | 79 |
<widget class="QWidget" name="tab_2"> |
80 | 80 |
<attribute name="title"> |
... | ... | |
263 | 263 |
</property> |
264 | 264 |
</widget> |
265 | 265 |
</item> |
266 |
<item row="4" column="2">
|
|
267 |
<widget class="QPushButton" name="btnFTPPublish">
|
|
266 |
<item row="4" column="4">
|
|
267 |
<widget class="QPushButton" name="btnUpload">
|
|
268 | 268 |
<property name="text"> |
269 |
<string>Envoyer</string>
|
|
269 |
<string>Upload gallerie en cours</string>
|
|
270 | 270 |
</property> |
271 | 271 |
</widget> |
272 | 272 |
</item> |
273 |
<item row="4" column="3">
|
|
274 |
<widget class="QPushButton" name="btnPHP">
|
|
273 |
<item row="4" column="0">
|
|
274 |
<widget class="QPushButton" name="btnFTPPublish">
|
|
275 | 275 |
<property name="text"> |
276 |
<string>PHP</string>
|
|
276 |
<string>Connexion FTP</string>
|
|
277 | 277 |
</property> |
278 | 278 |
</widget> |
279 | 279 |
</item> |
280 |
<item row="4" column="4">
|
|
281 |
<widget class="QPushButton" name="btnUpload">
|
|
280 |
<item row="4" column="1">
|
|
281 |
<widget class="QPushButton" name="btnPHP">
|
|
282 | 282 |
<property name="text"> |
283 |
<string>Upload</string>
|
|
283 |
<string>Envoyer le code PHP</string>
|
|
284 | 284 |
</property> |
285 | 285 |
</widget> |
286 | 286 |
</item> |
Formats disponibles : Unified diff