Projet

Général

Profil

Révision 925ac0ca

Voir les différences:

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

  
33 34
Assistant::~Assistant()
......
38 39
void Assistant::on_btnUploadPHP_clicked()
39 40
{
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
    }
41 56

  
42 57
    m_tools->ftpConnect(ui->leFTPServeur->text(),
43 58
                        ui->leFTPLogin->text(),
......
53 68
    m_tools->parcoursRecursif(dir.absolutePath(),"");
54 69
    //qDebug() << m_fileListToUpload;
55 70
    m_tools->uploadRecursifPHP(ui->leFTPDirectory->text());
56
    connect(m_tools, SIGNAL(signalUpload(int,int)), this, SLOT(updateProgressFichier(int,int)));
71
    connect(m_tools, SIGNAL(signalUpload(int,int,QString)), this, SLOT(updateProgressFichier(int,int,QString)));
57 72
    connect(m_tools, SIGNAL(signalUploadData(int,int)), this, SLOT(updateProgressData(int,int)));
58 73
}
59 74

  
60
void Assistant::updateProgressFichier(int total, int current)
75
void Assistant::updateProgressFichier(int total, int current, QString fileName)
61 76
{
62 77
    ui->pbFTPFichier->setMaximum(total);
63 78
    ui->pbFTPFichier->setValue(current);
......
68 83
    ui->pbFTPProgress->setMaximum(total);
69 84
    ui->pbFTPProgress->setValue(current);
70 85
}
86

  
87
void Assistant::uploadEnd()
88
{
89
    ui->btnUploadPHP->setText(trUtf8("Téléchargement terminé !"));
90
}
assistant.h
1 1
/**
2
  * Classe 
2
  * Classe
3 3
  * @see https://redmine.ryxeo.com/projects/
4 4
  * @author 2012 Eric Seigne <eric.seigne@ryxeo.com>
5 5
  * @see The GNU Public License (GNU/GPL) v3
......
28 28
#include <QFtp>
29 29
#include <QDebug>
30 30
#include <QDir>
31
#include <QTimer>
31 32
#include "tools.h"
33
#include "abuleduapplicationv1.h"
32 34

  
33 35
namespace Ui {
34 36
class Assistant;
......
37 39
class Assistant : public QWizard
38 40
{
39 41
    Q_OBJECT
40
    
42

  
41 43
public:
42 44
    explicit Assistant(QWidget *parent = 0);
43 45
    ~Assistant();
44
    
46

  
45 47
private slots:
46 48
    void on_btnUploadPHP_clicked();
47
    void updateProgressFichier(int total, int current);
49
    void updateProgressFichier(int total, int current, QString fileName);
48 50
    void updateProgressData(int total, int current);
51
    void uploadEnd();
49 52

  
50 53
private:
51 54
    Ui::Assistant *ui;
assistant.ui
53 53
    </item>
54 54
    <item row="0" column="1">
55 55
     <widget class="QLineEdit" name="leFTPLogin">
56
      <property name="toolTip">
57
       <string>Indiquez ici votre identifiant de connexion FTP</string>
58
      </property>
56 59
      <property name="text">
57
       <string>webopenphoto</string>
60
       <string/>
58 61
      </property>
59 62
     </widget>
60 63
    </item>
......
67 70
    </item>
68 71
    <item row="1" column="1">
69 72
     <widget class="QLineEdit" name="leFTPPass">
73
      <property name="toolTip">
74
       <string>Indiquez ici le mot de passe de votre compte FTP</string>
75
      </property>
70 76
      <property name="text">
71
       <string>MowlUcDyach6</string>
77
       <string/>
72 78
      </property>
73 79
      <property name="echoMode">
74 80
       <enum>QLineEdit::PasswordEchoOnEdit</enum>
......
84 90
    </item>
85 91
    <item row="2" column="1">
86 92
     <widget class="QLineEdit" name="leFTPServeur">
93
      <property name="toolTip">
94
       <string>Indiquez ici le nom du serveur FTP</string>
95
      </property>
87 96
      <property name="text">
88 97
       <string>ftpperso.free.fr</string>
89 98
      </property>
......
144 153
   </layout>
145 154
  </widget>
146 155
 </widget>
156
 <tabstops>
157
  <tabstop>leFTPLogin</tabstop>
158
  <tabstop>leFTPPass</tabstop>
159
  <tabstop>leFTPServeur</tabstop>
160
  <tabstop>leFTPDirectory</tabstop>
161
  <tabstop>btnUploadPHP</tabstop>
162
 </tabstops>
147 163
 <resources/>
148 164
 <connections/>
149 165
</ui>
main.cpp
24 24
#include "version.h"
25 25
#include "original.h"
26 26

  
27
void debugOutput(QtMsgType type, const char *msg)
28
 {
29
     switch (type) {
30
     case QtDebugMsg:
31
#ifndef QT_NO_DEBUG
32
         fprintf(stderr, "Debug: %s\n", msg);
33
#endif
34
         break;
35
     case QtWarningMsg:
36
#ifndef QT_NO_DEBUG
37
         fprintf(stderr, "Warning: %s\n", msg);
38
#endif
39
         break;
40
     case QtCriticalMsg:
41
         fprintf(stderr, "Critical: %s\n", msg);
42
         break;
43
     case QtFatalMsg:
44
         fprintf(stderr, "Fatal: %s\n", msg);
45
         abort();
46
     }
47
 }
48

  
27 49
int main(int argc, char *argv[])
28 50
{
51
//    qInstallMsgHandler(debugOutput);
52

  
29 53
    AbulEduApplicationV1 a(argc, argv,VER_INTERNALNAME_STR, VER_PRODUCTVERSION_STR, VER_COMPANYDOMAIN_STR, VER_COMPANYNAME_STR);
30 54
    a.setAbeApplicationLongName(QObject::trUtf8(VER_FILEDESCRIPTION_STR));
31 55
    original w;
original.cpp
1
/** Classe original: nom du projet prototype :)
1
/** Classe RyXeo WebPhotoAlbum: fichier principal de l'application
2 2
  * @see https://redmine.ryxeo.com/projects/
3 3
  * @author 2012 Eric Seigne <eric.seigne@ryxeo.com>
4 4
  * @see The GNU Public License (GNU/GPL) v3
......
77 77

  
78 78
    ui->dateEdit->setDate(QDate::currentDate());
79 79
    m_tools = new tools(m_baseDir, this);
80
    connect(m_tools, SIGNAL(signalUploadEnd()), this, SLOT(uploadEnd()));
80 81

  
81 82
    //============== l'étiquette invitant a déposer des images
82 83
    m_labelDeposez = new QLabel(trUtf8("Glissez-déposez ici les photos que vous voulez ajouter à cet album ..."),ui->lwPictures);
......
447 448
    m_tools->parcoursRecursif(dir.absolutePath(),ui->treeWidget->currentItem()->text(0));
448 449
    //qDebug() << m_fileListToUpload;
449 450
    m_tools->uploadRecursifGallery(ui->leFTPDirectory->text());
450
    connect(m_tools, SIGNAL(signalUpload(int,int)), this, SLOT(updateProgressFichier(int,int)));
451
    connect(m_tools, SIGNAL(signalUpload(int,int,QString)), this, SLOT(updateProgressFichier(int,int,QString)));
451 452
    connect(m_tools, SIGNAL(signalUploadData(int,int)), this, SLOT(updateProgressData(int,int)));
452 453
}
453 454

  
......
457 458
    a->show();
458 459
}
459 460

  
460
void original::updateProgressFichier(int total, int current)
461
void original::updateProgressFichier(int total, int current, QString fileName)
461 462
{
462 463
    ui->pbFTPFichier->setMaximum(total);
463 464
    ui->pbFTPFichier->setValue(current);
465
    ui->textBrowser->append(fileName + "\n");
464 466
}
465 467

  
466 468
void original::updateProgressData(int total, int current)
......
506 508
    }
507 509
    QApplication::restoreOverrideCursor();
508 510
}
511

  
512
void original::uploadEnd()
513
{
514
    ui->textBrowser->append(trUtf8("Téléchargement terminé\n"));
515
}
original.h
1
/**
2
  * Classe
1
/** Classe RyXeo WebPhotoAlbum: fichier principal de l'application
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
......
73 72
//    void processItem(QTreeWidgetItem *item, int column);
74 73
    void on_btnUpload_clicked();
75 74
    void on_action_Assistant_d_installation_triggered();
76
    void updateProgressFichier(int total, int current);
75
    void updateProgressFichier(int total, int current, QString fileName);
77 76
    void updateProgressData(int total, int current);
78 77
    void makeZip(QString repSource, QString destFileName);
78
    void uploadEnd();
79 79

  
80 80
private:
81 81
    Ui::original *ui;
original.ui
74 74
      </widget>
75 75
      <widget class="QTabWidget" name="tabWidget">
76 76
       <property name="currentIndex">
77
        <number>0</number>
77
        <number>2</number>
78 78
       </property>
79 79
       <widget class="QWidget" name="tabProprietes">
80 80
        <attribute name="title">
......
217 217
         <item row="0" column="1">
218 218
          <widget class="QLineEdit" name="leFTPLogin">
219 219
           <property name="text">
220
            <string>webopenphoto</string>
220
            <string/>
221 221
           </property>
222 222
          </widget>
223 223
         </item>
......
231 231
         <item row="1" column="1">
232 232
          <widget class="QLineEdit" name="leFTPPass">
233 233
           <property name="text">
234
            <string>MowlUcDyach6</string>
234
            <string/>
235 235
           </property>
236 236
           <property name="echoMode">
237 237
            <enum>QLineEdit::PasswordEchoOnEdit</enum>
......
269 269
         <item row="6" column="1">
270 270
          <widget class="QPushButton" name="btnUpload">
271 271
           <property name="text">
272
            <string>Upload gallerie en cours</string>
272
            <string>&amp;Télécharger la gallerie en cours</string>
273 273
           </property>
274 274
          </widget>
275 275
         </item>
......
320 320
     <x>0</x>
321 321
     <y>0</y>
322 322
     <width>843</width>
323
     <height>23</height>
323
     <height>25</height>
324 324
    </rect>
325 325
   </property>
326 326
   <widget class="QMenu" name="menu_Fichier">
tools.cpp
145 145

  
146 146
int tools::nbTotalUpload()
147 147
{
148
    return m_fileListToUpload.count();
148
    return m_fileListToUpload.count()+2;
149 149
}
150 150

  
151 151
int tools::nbResteUpload()
......
178 178
            }
179 179
        }
180 180
        m_currentFTPFileUpload++;
181
        emit signalUpload(nbTotalUpload(), m_currentFTPFileUpload);
181
        emit signalUpload(nbTotalUpload(), m_currentFTPFileUpload, cmd.at(1));
182
    }
183
    else {
184
        emit signalUploadEnd();
182 185
    }
183 186
}
184 187

  
tools.h
1
/**
2
  * Classe 
1
/** Classe tools: regroupe ce qui est mutualisable entre assistant et appli
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
......
41 40
    explicit tools(QDir basedir, QObject *parent = 0);
42 41

  
43 42
signals:
44
    void signalUpload(int,int);
43
    void signalUpload(int total, int current, QString fileName);
45 44
    void signalUploadData(int,int);
45
    void signalUploadEnd();
46 46

  
47 47
public slots:
48 48
    void ftpConnect(QString serveur, QString login, QString passwd);

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux