Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-webphotoalbum-git / assistant.cpp @ 925ac0ca

Historique | Voir | Annoter | Télécharger (2,78 ko)

1
/** Classe Assistant qui permet de créer l'espace d'hébergement web
2
  * @see https://redmine.ryxeo.com/projects/
3
  * @author 2012 Eric Seigne <eric.seigne@ryxeo.com>
4
  * @see The GNU Public License (GNU/GPL) v3
5
  *
6
  *
7
  * This program is free software; you can redistribute it and/or modify
8
  * it under the terms of the GNU General Public License as published by
9
  * the Free Software Foundation; either version 3 of the License, or
10
  * (at your option) any later version.
11
  *
12
  * This program is distributed in the hope that it will be useful, but
13
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15
  * for more details.
16
  *
17
  * You should have received a copy of the GNU General Public License along
18
  * with this program. If not, see <http://www.gnu.org/licenses/>.
19
  */
20

    
21

    
22
#include "assistant.h"
23
#include "ui_assistant.h"
24

    
25
Assistant::Assistant(QWidget *parent) :
26
    QWizard(parent),
27
    ui(new Ui::Assistant)
28
{
29
    ui->setupUi(this);
30
    m_tools = new tools(QDir("."),this);
31
    connect(m_tools, SIGNAL(signalUploadEnd()), this, SLOT(uploadEnd()));
32
}
33

    
34
Assistant::~Assistant()
35
{
36
    delete ui;
37
}
38

    
39
void Assistant::on_btnUploadPHP_clicked()
40
{
41
    qDebug() << "Assistant::on_btnUploadPHP_clicked";
42
    ui->btnUploadPHP->setEnabled(false);
43

    
44
    if(ui->leFTPServeur->text().trimmed() == "") {
45
        ui->leFTPServeur->setFocus();
46
        return;
47
    }
48
    if(ui->leFTPLogin->text().trimmed() == "") {
49
        ui->leFTPLogin->setFocus();
50
        return;
51
    }
52
    if(ui->leFTPPass->text().trimmed() == "") {
53
        ui->leFTPPass->setFocus();
54
        return;
55
    }
56

    
57
    m_tools->ftpConnect(ui->leFTPServeur->text(),
58
                        ui->leFTPLogin->text(),
59
                        ui->leFTPPass->text());
60

    
61
    m_tools->ftpMkdir(ui->leFTPDirectory->text());
62
    m_tools->ftpMkdir(ui->leFTPDirectory->text() + "/galleries");
63

    
64
    //On uploade le code php
65
    //m_ftp->cd(ui->leFTPDirectory->text());
66
    QDir dir("data/www");
67
    m_tools->clear();
68
    m_tools->parcoursRecursif(dir.absolutePath(),"");
69
    //qDebug() << m_fileListToUpload;
70
    m_tools->uploadRecursifPHP(ui->leFTPDirectory->text());
71
    connect(m_tools, SIGNAL(signalUpload(int,int,QString)), this, SLOT(updateProgressFichier(int,int,QString)));
72
    connect(m_tools, SIGNAL(signalUploadData(int,int)), this, SLOT(updateProgressData(int,int)));
73
}
74

    
75
void Assistant::updateProgressFichier(int total, int current, QString fileName)
76
{
77
    ui->pbFTPFichier->setMaximum(total);
78
    ui->pbFTPFichier->setValue(current);
79
}
80

    
81
void Assistant::updateProgressData(int total, int current)
82
{
83
    ui->pbFTPProgress->setMaximum(total);
84
    ui->pbFTPProgress->setValue(current);
85
}
86

    
87
void Assistant::uploadEnd()
88
{
89
    ui->btnUploadPHP->setText(trUtf8("Téléchargement terminé !"));
90
}
Redmine Appliance - Powered by TurnKey Linux