1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| #include <QApplication>
#include <QDirIterator>
#include <QWidget>
#include <QPushButton>
#include <QLCDNumber>
#include <QSlider>
#include <QLabel>
#include <QProgressBar>
#include <QMessageBox>
#include <windows.h>
#include <QFile>
#include <QString>
#include <QFileDialog>
#include <QObject>
#include "fenetre.h"
#define WIDTH 75
#define SPACE 20
MaFenetre::MaFenetre() : QWidget()
{
// DIMENSION DE LA FENETRE
int ResX = (int)(0.33*GetSystemMetrics(SM_CXSCREEN));
int ResY = (int)(0.16*GetSystemMetrics(SM_CYSCREEN));
// ON FIXE LES DIMENSIONS POUR QUE LA FENETRE NE SOIT PLUS REDIMENSIONEE
setFixedSize(ResX, ResY);
// VARIABLES QUI VONT CONTENIR LES CHEMINS DES DOSSIERS A ENVOYER OU RECUPERER
char ALCATEL[999];
char D2A[999];
char EASY[999];
char MATRAPARALLELE[999];
char SAUVMATRA[999];
char VOCALD6[999];
char XS[999];
char XS2[999];
char copy_alcatel[999];
char copy_d2a[999];
char copy_easy[999];
char copy_matraparallele[999];
char copy_sauvmatra[999];
char copy_vocald6[999];
char copy_xs[999];
char copy_xs2[999];
// CHEMIN DES DOSSIERS A ENVOYER OU RECUPERER CONTENU DANS LE .INI
GetPrivateProfileStringA("section", "ALCATEL" , "", ALCATEL , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "D2A" , "", D2A , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "EASY" , "", EASY , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "MATRAPARALLELE", "", MATRAPARALLELE, 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "SAUVMATRA" , "", SAUVMATRA , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "VOCALD6" , "", VOCALD6 , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "XS" , "", XS , 999, ".//setup.ini" );
GetPrivateProfileStringA("section", "XS2" , "", XS2 , 999, ".//setup.ini" );
// TITRE
QLabel *titre = new QLabel("<SMALL><strong>SAUVEGARDE AUTOMATIQUES DES DONNEÉS</strong></SMALL>", this);
titre->move( (ResX - titre->minimumSizeHint().width())/2,0.1*ResY );
// AFFICHAGE DES BOUTONS
bouton0 = new QPushButton("ARRETER", this);
bouton1 = new QPushButton("QUITTER", this);
// POSITION DES BOUTONS DANS LA FENETRE
bouton0->setGeometry ( (int)((ResX-(2*WIDTH+SPACE))/2) , (int)(0.8*ResY), WIDTH, SPACE );
bouton1->setGeometry ( (int)((ResX-(2*WIDTH+SPACE))/2+WIDTH+SPACE), (int)(0.8*ResY), WIDTH, SPACE );
// BARRE DE PROGRESSION
QProgressBar *ProgressBar= new QProgressBar(this);
ProgressBar->setGeometry ( 0.1*ResX, 50, 0.8*ResX, 0.1*ResY );
ProgressBar->setRange( 0, 100 );
ProgressBar->setValue( 80 );
sprintf(copy_alcatel ,"xcopy %s c:\\SAVE /S /E /D ", ALCATEL);
sprintf(copy_d2a ,"xcopy %s c:\\SAVE /S /E /D ", D2A);
sprintf(copy_easy ,"xcopy %s c:\\SAVE /S /E /D ", EASY);
sprintf(copy_matraparallele,"xcopy %s c:\\SAVE /S /E /D ", MATRAPARALLELE);
sprintf(copy_sauvmatra ,"xcopy \"%s\" c:\\SAVE /S /E /D ", SAUVMATRA);
sprintf(copy_vocald6 ,"xcopy \"%s\" c:\\SAVE /S /E /D ", VOCALD6);
sprintf(copy_xs ,"xcopy %s c:\\SAVE /S /E /D ", XS);
sprintf(copy_xs2 ,"xcopy %s c:\\SAVE /S /E /D ", XS2);
system(copy_alcatel);
ProgressBar->setValue( 12 );
system(copy_d2a);
ProgressBar->setValue( 24 );
system(copy_easy);
ProgressBar->setValue( 36 );
system(copy_matraparallele);
ProgressBar->setValue( 48 );
system(copy_sauvmatra);
ProgressBar->setValue( 60 );
system(copy_vocald6);
ProgressBar->setValue( 72 );
system(copy_xs);
ProgressBar->setValue( 84 );
system(copy_xs2);
ProgressBar->setValue( 100 );
// SIGNAUX
QObject::connect(bouton0, SIGNAL(clicked()) , qApp, SLOT( aboutQt() ) );
QObject::connect(bouton1, SIGNAL(clicked()) , qApp, SLOT( quit() ) );
} |
Partager