Projet

Général

Profil

Révision 83a77071

Voir les différences:

assistant.cpp
29 29
    ui->setupUi(this);
30 30
    m_tools = new tools(QDir("."),this);
31 31
    connect(m_tools, SIGNAL(signalUploadEnd()), this, SLOT(uploadEnd()));
32

  
33
    //Es-ce qu'on a deja des valeurs ?
34
    QSettings settings;
35
    settings.beginGroup("FTP");
36
    ui->leFTPLogin->setText(settings.value("FTPLogin","identifiant").toString());
37
    ui->leFTPPass->setText(settings.value("FTPPass","").toString());
38
    ui->leFTPServeur->setText(settings.value("FTPServeur","ftpperso.free.fr").toString());
39
    ui->leFTPDirectory->setText(settings.value("FTPDirectory","/album").toString());
32 40
}
33 41

  
34 42
Assistant::~Assistant()
......
39 47
void Assistant::on_btnUploadPHP_clicked()
40 48
{
41 49
    qDebug() << "Assistant::on_btnUploadPHP_clicked";
42
    ui->btnUploadPHP->setEnabled(false);
50

  
51
    QSettings settings;
52
    settings.beginGroup("FTP");
53
    settings.setValue("FTPLogin",ui->leFTPLogin->text());
54
    settings.setValue("FTPPass",ui->leFTPPass->text());
55
    settings.setValue("FTPServeur",ui->leFTPServeur->text());
56
    settings.setValue("FTPDirectory",ui->leFTPDirectory->text());
43 57

  
44 58
    if(ui->leFTPServeur->text().trimmed() == "") {
45 59
        ui->leFTPServeur->setFocus();
......
54 68
        return;
55 69
    }
56 70

  
71
//    ui->btnUploadPHP->setEnabled(false);
57 72
    m_tools->ftpConnect(ui->leFTPServeur->text(),
58 73
                        ui->leFTPLogin->text(),
59 74
                        ui->leFTPPass->text());
assistant.h
29 29
#include <QDebug>
30 30
#include <QDir>
31 31
#include <QTimer>
32
#include <QSettings>
32 33
#include "tools.h"
33 34
#include "abuleduapplicationv1.h"
34 35

  
main.cpp
55 55
    WebPhotoAlbum w;
56 56
    w.show();
57 57

  
58
    QNetworkProxy proxy;
59
    proxy.setType(QNetworkProxy::NoProxy);
60
    QNetworkProxy::setApplicationProxy(proxy);
61

  
58 62
    return a.exec();
59 63
}
tools.cpp
157 157
{
158 158
    if(!m_ftpCommands.isEmpty()) {
159 159
        QStringList cmd(m_ftpCommands.takeFirst().split(";"));
160
        QString fileName;
160 161
        //Commande speciale pour extraire un fichier ZIP sur le serveur
161 162
        //exemple: http://webopenphoto.free.fr/sagc/extract.php?src=galleries/Cala-Montjoi-2012_Christophe/zip/mq.zip
162 163
        if(cmd.at(0) == "unzip") {
163
            QUrl u("http://webopenphoto.free.fr/sagc/extract.php?src=" + cmd.at(1));
164
            QUrl u(m_urlSite + "/extract.php?src=" + cmd.at(1));
164 165
            m_web->load(u);
165 166
            qDebug() << "Ouverture de " << u;
167
            fileName = "Unzip " + cmd.at(1);
166 168
        }
167 169
        if(cmd.at(0) == "mkdir") {
168 170
            m_ftp->mkdir(cmd.at(1));
171
            fileName = cmd.at(1);
169 172
        }
170 173
        if(cmd.at(0) == "put") {
171 174
            QFile *fic = new QFile(cmd.at(1));
172 175
            if(fic->open(QIODevice::ReadOnly)) {
173 176
                qDebug() << "       Upload : " << cmd.at(1) << " -> " << cmd.at(2);
174 177
                m_ftp->put(fic,cmd.at(2));
178
                fileName = cmd.at(2);
175 179
            }
176 180
            else {
177 181
                //erreur
178 182
            }
179 183
        }
180 184
        m_currentFTPFileUpload++;
181
        emit signalUpload(nbTotalUpload(), m_currentFTPFileUpload, cmd.at(1));
185
        emit signalUpload(nbTotalUpload(), m_currentFTPFileUpload, fileName);
182 186
    }
183 187
    else {
184 188
        emit signalUploadEnd();
......
232 236
}
233 237

  
234 238

  
235
void tools::uploadRecursifGallery(QString destDirBase)
239
void tools::uploadRecursifGallery(QString destDirBase, QString urlSite)
236 240
{
237 241
    qDebug() << " ** uploadRecursifGallery : " << m_fileListToUploadIndex.count() ;
242
    m_urlSite = urlSite;
238 243
    m_destDirBase = destDirBase;
239 244
    m_typeUploadRecursif = "Gallery";
240 245
    while(m_fileListToUploadIndex.count()>0) {
tools.h
51 51
    void ftpDone(bool error);
52 52
    void ftpStateChanged(int state);
53 53
    void uploadRecursifPHP(QString destDirBase);
54
    void uploadRecursifGallery(QString destDirBase);
54
    void uploadRecursifGallery(QString destDirBase, QString urlSite);
55 55
    void updateDataTransferProgress(qint64 readBytes,
56 56
                                    qint64 totalBytes);
57 57
    void addToList(const QUrlInfo &urlInfo);
......
76 76
    int m_currentFTPFileUpload;
77 77
    QStringList m_ftpCommands;
78 78
    QWebView *m_web;
79
    QString m_urlSite;
79 80
};
80 81

  
81 82
#endif // TOOLS_H
version.h
7 7
#define VER_PRODUCTVERSION          0,9,9,0
8 8
#define VER_PRODUCTVERSION_STR      "0.9.9\0"
9 9

  
10
#define VER_COMPANYNAME_STR         "RyXeo SARL"
10
#define VER_COMPANYNAME_STR         "RyXeo"
11 11
#define VER_FILEDESCRIPTION_STR     "RyXéo -- WebPhotoAlbum"
12 12
#define VER_INTERNALNAME_STR        "ryxeo-webphotoalbum"
13 13
#define VER_LEGALCOPYRIGHT_STR      "Copyright (c) 2012 RyXeo SARL"
webphotoalbum.cpp
430 430
    makeZip(m_baseDir.absolutePath() + "/" + ui->treeWidget->currentItem()->text(0) + "/thumbs",
431 431
            m_baseDir.absolutePath() + "/" + ui->treeWidget->currentItem()->text(0) + "/zip/thumbs.zip");
432 432

  
433
    QSettings settings;
434
    settings.beginGroup("FTP");
435
    settings.setValue("FTPLogin",ui->leFTPLogin->text());
436
    settings.setValue("FTPPass",ui->leFTPPass->text());
437
    settings.setValue("FTPServeur",ui->leFTPServeur->text());
438
    settings.setValue("FTPDirectory",ui->leFTPDirectory->text());
439
    settings.setValue("SiteAdresse",ui->leSiteAdresse->text());
440

  
433 441
    m_tools->clear();
434 442

  
435 443
    m_tools->ftpConnect(ui->leFTPServeur->text(),
......
447 455
    QDir dir(fi.absoluteFilePath());
448 456
    m_tools->parcoursRecursif(dir.absolutePath(),ui->treeWidget->currentItem()->text(0));
449 457
    //qDebug() << m_fileListToUpload;
450
    m_tools->uploadRecursifGallery(ui->leFTPDirectory->text());
458
    m_tools->uploadRecursifGallery(ui->leFTPDirectory->text(),ui->leSiteAdresse->text().trimmed());
451 459
    connect(m_tools, SIGNAL(signalUpload(int,int,QString)), this, SLOT(updateProgressFichier(int,int,QString)));
452 460
    connect(m_tools, SIGNAL(signalUploadData(int,int)), this, SLOT(updateProgressData(int,int)));
453 461
}
......
462 470
{
463 471
    ui->pbFTPFichier->setMaximum(total);
464 472
    ui->pbFTPFichier->setValue(current);
465
    ui->textBrowser->append(fileName + "\n");
473
    ui->textBrowser->append(fileName);
466 474
}
467 475

  
468 476
void WebPhotoAlbum::updateProgressData(int total, int current)
......
511 519

  
512 520
void WebPhotoAlbum::uploadEnd()
513 521
{
514
    ui->textBrowser->append(trUtf8("Téléchargement terminé\n"));
522
    ui->textBrowser->append(trUtf8("Téléchargement terminé"));
523
}
524

  
525
void WebPhotoAlbum::on_tabWidget_currentChanged(int index)
526
{
527
    if(index == 2) {
528
        //Lecture du QSettings pour avoir les infos login / pass / url site
529
        QSettings settings;
530
        settings.beginGroup("FTP");
531
        ui->leFTPLogin->setText(settings.value("FTPLogin","identifiant").toString());
532
        ui->leFTPPass->setText(settings.value("FTPPass").toString());
533
        ui->leFTPServeur->setText(settings.value("FTPServeur","ftpperso.free.fr").toString());
534
        ui->leFTPDirectory->setText(settings.value("FTPDirectory","/album").toString());
535
        ui->leSiteAdresse->setText(settings.value("SiteAdresse","http://votresite.free.fr/album/").toString());
536
    }
515 537
}
webphotoalbum.h
77 77
    void makeZip(QString repSource, QString destFileName);
78 78
    void uploadEnd();
79 79

  
80
    void on_tabWidget_currentChanged(int index);
81

  
80 82
private:
81 83
    Ui::WebPhotoAlbum *ui;
82 84
    QDir m_baseDir;
webphotoalbum.ui
266 266
           </property>
267 267
          </widget>
268 268
         </item>
269
         <item row="6" column="1">
269
         <item row="7" column="1">
270 270
          <widget class="QPushButton" name="btnUpload">
271 271
           <property name="text">
272 272
            <string>&amp;Télécharger la gallerie en cours</string>
273 273
           </property>
274 274
          </widget>
275 275
         </item>
276
         <item row="4" column="1">
276
         <item row="5" column="1">
277 277
          <widget class="QProgressBar" name="pbFTPFichier">
278 278
           <property name="value">
279 279
            <number>0</number>
......
283 283
           </property>
284 284
          </widget>
285 285
         </item>
286
         <item row="5" column="1">
286
         <item row="6" column="1">
287 287
          <widget class="QProgressBar" name="pbFTPProgress">
288 288
           <property name="value">
289 289
            <number>0</number>
290 290
           </property>
291 291
          </widget>
292 292
         </item>
293
         <item row="4" column="0">
293
         <item row="5" column="0">
294 294
          <widget class="QLabel" name="lblFichiers">
295 295
           <property name="text">
296 296
            <string>Fichiers:</string>
297 297
           </property>
298 298
          </widget>
299 299
         </item>
300
         <item row="5" column="0">
300
         <item row="6" column="0">
301 301
          <widget class="QLabel" name="lblProgression">
302 302
           <property name="text">
303 303
            <string>Progression</string>
304 304
           </property>
305 305
          </widget>
306 306
         </item>
307
         <item row="7" column="0" colspan="2">
307
         <item row="8" column="0" colspan="2">
308 308
          <widget class="QTextBrowser" name="textBrowser"/>
309 309
         </item>
310
         <item row="4" column="1">
311
          <widget class="QLineEdit" name="leSiteAdresse">
312
           <property name="text">
313
            <string>http://</string>
314
           </property>
315
          </widget>
316
         </item>
317
         <item row="4" column="0">
318
          <widget class="QLabel" name="label">
319
           <property name="text">
320
            <string>Adresse du site</string>
321
           </property>
322
          </widget>
323
         </item>
310 324
        </layout>
311 325
       </widget>
312 326
      </widget>

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux