parametragemodele.cpp 14.7 KB
Newer Older
1
#include"parametragemodele.h"
Maxime Goret's avatar
Maxime Goret committed
2
#include <autocell.h>
3
#include <Automate.h>
Maxime Goret's avatar
merge  
Maxime Goret committed
4
#include <autosql.h>
Maxime Goret's avatar
Merge  
Maxime Goret committed
5

6
7
8

NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
    this->setWindowTitle("Paramétrage d'un nouveau modèle");
Maxime Goret's avatar
Maxime Goret committed
9
    this->setMinimumSize(850, 650);
10

11
12
13
14
15
    general = new QGridLayout;
    this->setLayout(general);

    //définition de la frame paramétrage du modèle

16
    fenetre_init = new QWidget;
17
    fenetre_init->setStyleSheet("background-color: rgb(204, 209, 209)");
Maxime Goret's avatar
Maxime Goret committed
18
    fenetre_init->setFixedWidth(410);
19
    label_init = new QLabel("Configuration du modèle :");
20
21
22

    form_init = new QGridLayout(fenetre_init);

23
    form_choix = new QFormLayout;
24
25

    form_init->addWidget(label_init, 0, 0, 1, 2);
26
    form_init->addLayout(form_choix, 1, 0, 8, 2);
27

28
29
    // infos sur l'automate
    QString nomDefaut = "Nouvel automate";
Leon Do Castelo's avatar
Leon Do Castelo committed
30
    nom_automate = new QLineEdit(nomDefaut);
31
    QString auteurDefaut = "Anonym";
Leon Do Castelo's avatar
Leon Do Castelo committed
32
    auteur = new QLineEdit(auteurDefaut);
33
    QString anneeDefaut = "2000";
Leon Do Castelo's avatar
Leon Do Castelo committed
34
    annee = new QLineEdit(anneeDefaut);
35
    QString descDefaut = "Nouvel automate créé par l'utilisateur";
Leon Do Castelo's avatar
Leon Do Castelo committed
36
    description = new QLineEdit(descDefaut);
37
    // nb d'états
Leon Do Castelo's avatar
Leon Do Castelo committed
38
    nb_etats = new QSpinBox;
Leon Do Castelo's avatar
Leon Do Castelo committed
39
    nb_etats->setRange(2, 8);
Maxime Goret's avatar
Merge  
Maxime Goret committed
40
    etat = new QLabel("Nombre d'états :");
41

42
    //choisir un voisinage
43
    liste_voisinage = new QComboBox;
44

45

Maxime Goret's avatar
Maxime Goret committed
46
47

    liste_voisinage->setPlaceholderText("--- select ---");
48
    liste_voisinage->setCurrentIndex(-1);
Maxime Goret's avatar
Maxime Goret committed
49

50

51
52
53
    connect(liste_voisinage, SIGNAL(currentTextChanged(const QString&)), this, SLOT(paramVoisinage(const QString&)));

    //choisir une règle de transition
Maxime Goret's avatar
Maxime Goret committed
54

55
    //connect(liste_regle_transition, SIGNAL(currentIndexChanged(int)), liste_voisinage, SLOT(setCurrentIndex(int)));
Maxime Goret's avatar
Merge  
Maxime Goret committed
56

57
58

    bouton_valide = new QPushButton("Valider");
Maxime Goret's avatar
Maxime Goret committed
59

Maxime Goret's avatar
Maxime Goret committed
60
61
62
63
    layoutvalid = new QHBoxLayout;

    boutonEtat = new QPushButton("Etats");

Maxime Goret's avatar
Merge  
Maxime Goret committed
64
65
66
67
    layoutEtat = new QHBoxLayout;
    layoutEtat->addWidget(etat);
    layoutEtat->addWidget(nb_etats);

Maxime Goret's avatar
Merge  
Maxime Goret committed
68

Maxime Goret's avatar
merge  
Maxime Goret committed
69
70
71
72
73
74


    valider_Etat = new QPushButton("Valider le nombre d'états");



Maxime Goret's avatar
Merge  
Maxime Goret committed
75

Maxime Goret's avatar
Maxime Goret committed
76
    connect(boutonEtat, SIGNAL(clicked()), this, SLOT(parametrerEtats()));
Maxime Goret's avatar
Merge  
Maxime Goret committed
77

Maxime Goret's avatar
Maxime Goret committed
78
    connect(bouton_valide, SIGNAL(clicked()), this, SLOT(validerParametrage()));
Maxime Goret's avatar
merge  
Maxime Goret committed
79
80
    connect(valider_Etat, SIGNAL(clicked()), this, SLOT(changerEtatDefault()));

81

Maxime Goret's avatar
Maxime Goret committed
82
    //ajout regle :
83
84
85
86
    form_choix->addRow("Nom automate :", nom_automate);
    form_choix->addRow("Auteur :", auteur);
    form_choix->addRow("Année :", annee);
    form_choix->addRow("Description :", description);
Maxime Goret's avatar
Merge  
Maxime Goret committed
87
    form_choix->addRow(layoutEtat);
Maxime Goret's avatar
merge  
Maxime Goret committed
88
89
90
91
92
93
94
    form_choix->addRow(valider_Etat);



    //form_choix->addRow("Etat défaut :", etat_default);


Maxime Goret's avatar
Maxime Goret committed
95

96
    general->addWidget(fenetre_init, 0, 0, 9, 1);
97
98

    //définition de la frame contenant la grille de sélection du voisinage
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    fenetre_param = new QWidget;
    fenetre_param->setFixedWidth(500);
    label_param = new QLabel("Paramétrer votre choix :");

    form_param = new QGridLayout(fenetre_param);
    form_rayon = new QFormLayout;
    rayon = new QSpinBox;

    general->addWidget(label_param, 0, 1, 1, 1);
    general->addWidget(fenetre_param, 1, 1, 8, 1);

    /*
    form_param->addWidget(label_param, 0, 0, 1, 1);
    form_param->addLayout(form_rayon, 1, 0, 8, 1);

    general->addWidget(fenetre_param, 0, 1, 9, 1);
    */
116

Maxime Goret's avatar
Maxime Goret committed
117

118
119
}

Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
120
void NouveauModele::parametrerEtats() {
Luning Yang's avatar
Luning Yang committed
121
    paramAlpha.reset(new ParamAlpha(nb_etats->value(), this));
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
122
123
124
	paramAlpha->show();
}

125
126
void NouveauModele::paramVoisinage(const QString& choix_voisinage){
    if(choix_voisinage == "Voisinage de von Neumann" || choix_voisinage == "Voisinage de Moore"){
Maxime Goret's avatar
Maxime Goret committed
127
        if (form_rayon != nullptr) delete form_rayon;
Maxime Goret's avatar
Maxime Goret committed
128
129
        if (grid != nullptr) delete grid;

Maxime Goret's avatar
Maxime Goret committed
130
131
132
        grid = new QTableWidget;
        grid = nullptr;

133
134
135
136
137
138
139
140
141
142
        form_rayon = new QFormLayout;
        rayon = new QSpinBox;

        form_rayon->addRow("Rayon du voisinage :", rayon);
        form_param->addLayout(form_rayon, 0, 0, 1, 1);
        //form_param->addLayout(form_rayon, 1, 0, 8, 1);
    }
    else if(choix_voisinage == "Voisinage arbitraire") {
        this->affGrille();
    }
143
    //else if(choix_voisinage == "--- select ---"){
144
145
        //delete form_rayon;
        //delete grid;
146
    //}
147
148

}
Maxime Goret's avatar
Maxime Goret committed
149

Maxime Goret's avatar
Maxime Goret committed
150
151


152
void NouveauModele::affGrille() {
Maxime Goret's avatar
Maxime Goret committed
153
    if (grid != nullptr) delete grid;
Maxime Goret's avatar
Maxime Goret committed
154
    grid = new QTableWidget(5,5);
Maxime Goret's avatar
Maxime Goret committed
155
    form_param->addWidget(grid, 0, 0, 7, 3);
156
157
158
159
160
161
162
163
164

    grid->horizontalHeader()->setVisible(false); //Pas de nom pour les colonnes.
    grid->verticalHeader()->setVisible(false);
    grid->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //Pas de barre pour scroller.
    grid->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    for(unsigned int i=0; i<5; i++){
        for(unsigned int j=0; j<5; j++)
        {
Maxime Goret's avatar
Maxime Goret committed
165
166
            grid->setRowHeight(j,80);
            grid->setColumnWidth(j,80);
167
168
169
170
171
172
173
174
175
176
177
178
179

            /*
            int x = i-3;
            int y = -1*(j-2);
            std::string co = "(";
            co += x;
            co += ",";
            co += y;
            co += ")";
            QString coordonnees = co;
            */

            grid->setItem(i, j, new QTableWidgetItem);
Maxime Goret's avatar
Maxime Goret committed
180
181
                grid->item(i, j)->setFlags(Qt::ItemIsEnabled);
                grid->item(i,j)->setBackground(Qt::white);
182

Maxime Goret's avatar
Maxime Goret committed
183
            }
184
        }
Maxime Goret's avatar
Maxime Goret committed
185
186
    QColor noir = Qt::black;
    grid->item(2,2)->setBackground(noir);
Maxime Goret's avatar
Maxime Goret committed
187

188
189
190
    connect(grid, SIGNAL(clicked(const QModelIndex&)), this, SLOT(modifGrille(const QModelIndex&)));
}

Maxime Goret's avatar
Maxime Goret committed
191
192


193
194
195
void NouveauModele::modifGrille(const QModelIndex& index){
    unsigned int i = index.row();
    unsigned int j = index.column();
196

197
    QColor rouge = Qt::red;
Maxime Goret's avatar
Maxime Goret committed
198
199
    QColor blanc = Qt::white;

Maxime Goret's avatar
Maxime Goret committed
200
    if (i == 2 && j == 2){
Maxime Goret's avatar
Maxime Goret committed
201
202
203
204
205
206
       return;
    }else if (grid->item(i,j)->background() == blanc){
         grid->item(i,j)->setBackground(rouge);
    }else if(grid->item(i,j)->background() == rouge){
         grid->item(i,j)->setBackground(blanc);
    }
Maxime Goret's avatar
Maxime Goret committed
207

208
209
}

Maxime Goret's avatar
Maxime Goret committed
210
void NouveauModele::changerVoisinage(){
211

Leon Do Castelo's avatar
Leon Do Castelo committed
212
    Fonction* automateFonction = new Fonction(Automate::getInstance().getEnsemble().getEtat(static_cast<unsigned int>(etat_default->value())));
Leon Do Castelo's avatar
Leon Do Castelo committed
213
    Automate::getInstance().setFonction(automateFonction);
Leon Do Castelo's avatar
Leon Do Castelo committed
214

Maxime Goret's avatar
Maxime Goret committed
215
    //delete liste_voisinage;
Maxime Goret's avatar
Maxime Goret committed
216
    form_choix->removeRow(7);
217
    liste_voisinage = new QComboBox();
Maxime Goret's avatar
Maxime Goret committed
218
    layoutvalid = new QHBoxLayout;
219

Maxime Goret's avatar
Maxime Goret committed
220
221
222
223
224
225
226
227
    liste_voisinage->addItem("Voisinage de Moore");
    liste_voisinage->addItem("Voisinage de von Neumann");
    liste_voisinage->addItem("Voisinage arbitraire");
    liste_voisinage->setCurrentIndex(-1);


    form_choix->insertRow(7, "Voisinage :", liste_voisinage);

228
229
    connect(liste_voisinage, SIGNAL(currentTextChanged(const QString&)), this, SLOT(paramVoisinage(const QString&)));
}
Maxime Goret's avatar
Maxime Goret committed
230

Maxime Goret's avatar
Maxime Goret committed
231
232
233
234
235
236
237
238
239
240
241
242
243

void NouveauModele::choisirEtatCourant(const QString& validEtat){

    if (validEtat == "Oui"){

        if (fin != nullptr) delete fin;
        if (next != nullptr) delete next;
        if (layouth5 != nullptr) delete layouth5;
        if (layouth6 != nullptr) delete layouth6;
        if (layoutv2 != nullptr) delete layoutv2;
        if (etatCourant2 != nullptr) delete etatCourant2;
        if (numEtatCourant != nullptr) delete numEtatCourant;

Maxime Goret's avatar
Maxime Goret committed
244

Maxime Goret's avatar
Maxime Goret committed
245
246
247
248
249
250
251
252
        layouth6 = new QHBoxLayout;
        layouth5 = new QHBoxLayout;
        layoutv2 = new QVBoxLayout;


        fin = new QPushButton("Terminer");
        next = new QPushButton("Règle suivante");

Maxime Goret's avatar
Maxime Goret committed
253
        form_choix->insertRow(9,layoutv2);
Maxime Goret's avatar
Maxime Goret committed
254
255
256
257
258
259
        layoutv2->addLayout(layouth5);
        layoutv2->addLayout(layouth6);

        etatCourant2 = new QLabel("Etat Courant : ");

        numEtatCourant = new QSpinBox;
Maxime Goret's avatar
Maxime Goret committed
260
        numEtatCourant->setRange(0,nb_etats->value()-1);
Maxime Goret's avatar
Maxime Goret committed
261
262
263
264
265
266

        layouth5->addWidget(etatCourant2);
        layouth5->addWidget(numEtatCourant);

        layouth6->addWidget(fin);
        layouth6->addWidget(next);
Maxime Goret's avatar
Maxime Goret committed
267
268


Maxime Goret's avatar
Maxime Goret committed
269
        connect(next, SIGNAL(clicked()), this, SLOT(addRegle()));
Maxime Goret's avatar
Maxime Goret committed
270
271
        connect(fin, SIGNAL(clicked()), this, SLOT(validation()));

Maxime Goret's avatar
Maxime Goret committed
272
273
274
275
276
277
278
279
280
281
282
283

    }else{


       if (fin != nullptr) delete fin;
       if (next != nullptr) delete next;
       if (layouth5 != nullptr) delete layouth5;
       if (layouth6 != nullptr) delete layouth6;
       if (layoutv2 != nullptr) delete layoutv2;
       if (etatCourant2 != nullptr) delete etatCourant2;
       if (numEtatCourant != nullptr) delete numEtatCourant;

Maxime Goret's avatar
Maxime Goret committed
284

Maxime Goret's avatar
Maxime Goret committed
285
286
287
288
289
290
291
292
293
294
295
296
297
       numEtatCourant = new QSpinBox;
       numEtatCourant = nullptr;

       layouth6 = new QHBoxLayout;
       layouth5 = new QHBoxLayout;
       layoutv2 = new QVBoxLayout;


       etatCourant2 = new QLabel("Etat Courant non pris en compte ");

       fin = new QPushButton("Terminer");
       next = new QPushButton("Règle suivante");

Maxime Goret's avatar
Maxime Goret committed
298
       form_choix->insertRow(9,layoutv2);
Maxime Goret's avatar
Maxime Goret committed
299
300
       layoutv2->addLayout(layouth5);
       layoutv2->addLayout(layouth6);
Maxime Goret's avatar
Maxime Goret committed
301
302


Maxime Goret's avatar
Maxime Goret committed
303
       layouth5->addWidget(etatCourant2);
Maxime Goret's avatar
Maxime Goret committed
304

Maxime Goret's avatar
Maxime Goret committed
305
306
307
       layouth6->addWidget(fin);
       layouth6->addWidget(next);

Maxime Goret's avatar
Maxime Goret committed
308

Maxime Goret's avatar
Maxime Goret committed
309
       connect(next, SIGNAL(clicked()), this, SLOT(addRegle()));
Maxime Goret's avatar
Maxime Goret committed
310
311
       connect(fin, SIGNAL(clicked()), this, SLOT(validation()));

Maxime Goret's avatar
Maxime Goret committed
312
313
314
315
316
317

    }


}

Maxime Goret's avatar
Maxime Goret committed
318
void NouveauModele::paramRegle() {
Maxime Goret's avatar
merge  
Maxime Goret committed
319

Maxime Goret's avatar
Maxime Goret committed
320
321
322
323
324
    seuilMax = new QLabel("Seuil Max : ");
    seuilMin = new QLabel("Seuil Min : ");
    destination = new QLabel("Destination : ");
    etatCourant = new QLabel("Etat Courant : ");

Maxime Goret's avatar
merge  
Maxime Goret committed
325
    etatDest = new QSpinBox;
Leon Do Castelo's avatar
Leon Do Castelo committed
326
    etatDest->setRange(0, nb_etats->value()-1);
Maxime Goret's avatar
Maxime Goret committed
327
328
329
330
331
332

    valid_Etat = new QComboBox;
    valid_Etat->addItem("Oui");
    valid_Etat->addItem("Non");
    valid_Etat->setCurrentIndex(-1);

Maxime Goret's avatar
merge  
Maxime Goret committed
333

Maxime Goret's avatar
Maxime Goret committed
334
335
336
337
338
339
340
341
342
343
344
        seuilValidator=new QIntValidator;

        if(layouth1 != nullptr) delete layouth1;
        if(layouth2 != nullptr) delete layouth2;
        if(layouth3 != nullptr) delete layouth3;
        if(layouth4 != nullptr) delete layouth4;
        if(layoutv != nullptr) delete layoutv;
        if(layouth5 != nullptr) delete layouth5;
        if(layouth6 != nullptr) delete layouth6;
        if(layoutv2 != nullptr) delete layoutv2;

Maxime Goret's avatar
Maxime Goret committed
345

Maxime Goret's avatar
Merge  
Maxime Goret committed
346
        layoutv = new QVBoxLayout;
Maxime Goret's avatar
Maxime Goret committed
347
348
349
350
351
        layouth1 = new QHBoxLayout;
        layouth2 = new QHBoxLayout;
        layouth3 = new QHBoxLayout;
        layouth4 = new QHBoxLayout;

Maxime Goret's avatar
Maxime Goret committed
352
353
354
        layouth6 = new QHBoxLayout;
        layouth5 = new QHBoxLayout;
        layoutv2 = new QVBoxLayout;
Maxime Goret's avatar
Merge  
Maxime Goret committed
355

Maxime Goret's avatar
Maxime Goret committed
356

Maxime Goret's avatar
Maxime Goret committed
357
        form_choix->insertRow(8,layoutv);
Maxime Goret's avatar
Maxime Goret committed
358
359
360
        layoutv->addLayout(layouth1);
        layoutv->addLayout(layouth2);
        layoutv->addLayout(layouth3);
Maxime Goret's avatar
Maxime Goret committed
361
        layoutv->addLayout(layouth4);
Maxime Goret's avatar
Maxime Goret committed
362
363
364
365
366
367



        seuilValidator->setRange(0,1);

        layouth1->addWidget(seuilMin);
368
        for(int i=0; i<8; i++) {
Maxime Goret's avatar
Maxime Goret committed
369
370
371
372
373
374
375
376
377
378
379
380
            numSeuilMin[i]=new QLineEdit;
            numSeuilMin[i]->setFixedWidth(22);
            numSeuilMin[i]->setMaxLength(2);
            numSeuilMin[i]->setText("-1");
            numSeuilMin[i]->setValidator(seuilValidator);
            if (i<nb_etats->value()){
            layouth1->addWidget(numSeuilMin[i]);
            }
         }


         layouth2->addWidget(seuilMax);
381
         for(int i=0; i<8; i++) {
Maxime Goret's avatar
Maxime Goret committed
382
383
384
385
386
387
388
389
390
391
392
393
394
395
             numSeuilMax[i]=new QLineEdit;
             numSeuilMax[i]->setFixedWidth(22);
             numSeuilMax[i]->setMaxLength(2);
             numSeuilMax[i]->setText("-1");
             numSeuilMax[i]->setValidator(seuilValidator);
             if (i<nb_etats->value()){
             layouth2->addWidget(numSeuilMax[i]);
             }
         }
         layouth3->addWidget(destination);
         layouth3->addWidget(etatDest);

         layouth4->addWidget(etatCourant);
         layouth4->addWidget(valid_Etat);
Maxime Goret's avatar
Merge  
Maxime Goret committed
396

Maxime Goret's avatar
Maxime Goret committed
397
         connect(valid_Etat, SIGNAL(currentTextChanged(const QString&)), this, SLOT(choisirEtatCourant(const QString&)));
Maxime Goret's avatar
Maxime Goret committed
398

Maxime Goret's avatar
Maxime Goret committed
399
400
401
402
403
}



void NouveauModele::addRegle(){
Leon Do Castelo's avatar
Leon Do Castelo committed
404
405
406
407
408
409
410
411
412
413
    if(valid_Etat->currentIndex()==(-1));
    else
    {
        int min[8], max[8];

        for(int i = 0; i<8; i++)
        {
            min[i] = numSeuilMin[i]->text().toInt();
            max[i] = numSeuilMax[i]->text().toInt();
        }
Maxime Goret's avatar
Maxime Goret committed
414

Leon Do Castelo's avatar
Leon Do Castelo committed
415
416
417
418
419
420
421
422
        if(valid_Etat->currentIndex()==1)
            Automate::getInstance().getFonction().ajouterRegle(Automate::getInstance().getEnsemble().getEtat(etatDest->value()), min, max);

        else
            Automate::getInstance().getFonction().ajouterRegle(Automate::getInstance().getEnsemble().getEtat(etatDest->value()), min, max, numEtatCourant->value());

        paramRegle();
    }
Maxime Goret's avatar
Maxime Goret committed
423
424
}

Leon Do Castelo's avatar
Leon Do Castelo committed
425
426
427
428
429
430
431
void NouveauModele::validerParametrage(){

    Automate::getInstance().setTitle(nom_automate->text().toStdString());
    Automate::getInstance().setAuthor(auteur->text().toStdString());
    Automate::getInstance().setDesc(description->text().toStdString());
    Automate::getInstance().setYear(annee->text().toInt());

Leon Do Castelo's avatar
Leon Do Castelo committed
432
433
434
435
    Reseau* reseauInit = new Reseau(9,10);
    reseauInit = &reseauInit->setAleatoire();
    Automate::getInstance().setReseauInit(*reseauInit);

Leon Do Castelo's avatar
Leon Do Castelo committed
436
    Automate::getInstance().getFonction().setEtatDefaut(Automate::getInstance().getEnsemble().getEtat(etat_default->value()));
Leon Do Castelo's avatar
Leon Do Castelo committed
437

Leon Do Castelo's avatar
Leon Do Castelo committed
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
    if(liste_voisinage->currentIndex()==-1);
    else
        if(liste_voisinage->currentIndex()==0) //moore
        {
            RegleVoisinageMoore *regle_voisins = new RegleVoisinageMoore;
            regle_voisins->setr(rayon->value());
            Automate::getInstance().setRegleVoisinage(regle_voisins);
            Database::getInstance().saveAutomaton(Automate::getInstance());
            this->close();
        }
    else
        if(liste_voisinage->currentIndex()==1) //von neumann
        {
            RegleVoisinageNeumann *regle_voisins = new RegleVoisinageNeumann;
            regle_voisins->setr(rayon->value());
            Automate::getInstance().setRegleVoisinage(regle_voisins);
            Database::getInstance().saveAutomaton(Automate::getInstance());
            this->close();
        }
    else //arbitraire
        {
            RegleVoisinageArbitraire *regle_voisins = new RegleVoisinageArbitraire;
460
	    regle_voisins->getVoisinage(grid);
Leon Do Castelo's avatar
Leon Do Castelo committed
461
462
463
464
            Automate::getInstance().setRegleVoisinage(regle_voisins);
            Database::getInstance().saveAutomaton(Automate::getInstance());
            this->close();
        }
Leon Do Castelo's avatar
Leon Do Castelo committed
465
}
Maxime Goret's avatar
Maxime Goret committed
466

Maxime Goret's avatar
Merge  
Maxime Goret committed
467

Maxime Goret's avatar
merge  
Maxime Goret committed
468
469
470
471
472
473
474
475
476
477
478
479
480


void NouveauModele::changerEtatDefault(){
    etat_default = new QSpinBox;
    etat_default->setRange(0,(nb_etats->value())-1);

    valider_EtatDefault = new QPushButton("Valider l'état de défaut");

    form_choix->removeRow(6);
    form_choix->addRow("Etat défaut : ",etat_default);
    form_choix->addRow(valider_EtatDefault);
    connect(valider_EtatDefault, SIGNAL(clicked()), this, SLOT(parametrerEtats()));
}
Maxime Goret's avatar
Maxime Goret committed
481
482

void NouveauModele::validation(){
Leon Do Castelo's avatar
Leon Do Castelo committed
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
    if(valid_Etat->currentIndex()==(-1));
    else
    {
        int min[8], max[8];

        for(int i = 0; i<8; i++)
        {
            min[i] = numSeuilMin[i]->text().toInt();
            max[i] = numSeuilMax[i]->text().toInt();
        }

        if(valid_Etat->currentIndex()==1)
            Automate::getInstance().getFonction().ajouterRegle(Automate::getInstance().getEnsemble().getEtat(etatDest->value()), min, max);

        else
            Automate::getInstance().getFonction().ajouterRegle(Automate::getInstance().getEnsemble().getEtat(etatDest->value()), min, max, numEtatCourant->value());
    }

    //bouton_valide = new QPushButton("Valider");
Maxime Goret's avatar
Maxime Goret committed
502
503
    form_choix->addRow(bouton_valide);
}