Commit 2bbe2ca8 authored by Maxime Goret's avatar Maxime Goret
Browse files

Modif param

parents dcf9500e b75009b4
......@@ -140,6 +140,8 @@ class Automate {
int getYear() const { return year; }
/// Redéfinir le nom de l'automate
void setYear(const int y) { year = y; }
void reinitialiserAutomate();
};
#endif
......@@ -9,7 +9,6 @@
#include <QWidget>
#include <QFormLayout>
#include <reseau_cellule_etats.h>
#include <Automate.h>
class ParamAlpha: public QWidget {
Q_OBJECT
......@@ -25,8 +24,9 @@ class ParamAlpha: public QWidget {
QSpinBox* blue[8];
QPushButton* valider;
public:
ParamAlpha(const int nbEtats);
public slots:
void addEtats(const int nbEtats);
void valide();
};
......
......@@ -2,6 +2,7 @@
#define PARAMETRAGEMODELE_H
#include <reseau_cellule_etats.h>
#include <paramalpha.h>
#include <QObject>
#include <QApplication>
......@@ -69,6 +70,8 @@ class NouveauModele : public QWidget {
//définition de la frame contenant la grille de sélection du voisinage
QTableWidget* grid;
std::unique_ptr<ParamAlpha> paramAlpha;
QPushButton* boutonEtat;
public:
NouveauModele(QWidget* parent = nullptr);
......@@ -78,7 +81,12 @@ public slots:
void affGrille();
void modifGrille(const QModelIndex& index);
void paramRegle(const QString& choix_regle);
<<<<<<< HEAD
void choisirEtatCourant(const QString& validEtat);
=======
void choisirEtatCourant(bool checked);
void parametrerEtats();
>>>>>>> b75009b4f263c0958c988e2906423ed9f3c2a961
};
......
......@@ -72,6 +72,7 @@ class RegleVoisinage{
virtual int getType() const = 0;
/// Renvoie le rayon d'une règle de voisinage, 0 si ce n'est pas pertinant pour ce voisinage (arbitraire, ...)
virtual unsigned int getr() const { return 0; }
virtual ~RegleVoisinage() = default;
};
class RegleVoisinageNeumann : public RegleVoisinage {
......
......@@ -29,3 +29,19 @@ void Automate::nextTimer()
}
}
}
void Automate::reinitialiserAutomate(){
title = "";
delai = 500;
delete fonction;
delete regleVoisinage;
buffer.clear();
itBuffer = buffer.begin();
h = 0;
l = 0;
reseauInit = Reseau(0, 0);
year = 2000;
author = "Anonym";
desc = "";
ensemble.reset();
}
#include <paramalpha.h>
#include <Automate.h>
void ParamAlpha::addEtats(const int nbEtats) {
if(nbEtats <= 0 || nbEtats > 8)
throw "Nombre invalide!";
nb = nbEtats;
ParamAlpha::ParamAlpha(const int nbEtats): QWidget(), nb(nbEtats) {
this->setWindowTitle("Configuration des états");
this->setMinimumSize(900, 700);
......@@ -36,20 +32,20 @@ void ParamAlpha::addEtats(const int nbEtats) {
general->addLayout(form[0], 0, 0, 1, 1);
if(nb >= 2)
general->addLayout(form[0], 0, 1, 1, 1);
general->addLayout(form[1], 0, 1, 1, 1);
if(nb >= 3)
general->addLayout(form[0], 0, 2, 1, 1);
general->addLayout(form[2], 0, 2, 1, 1);
if(nb >= 4)
general->addLayout(form[0], 1, 0, 1, 1);
general->addLayout(form[3], 1, 0, 1, 1);
if(nb >= 5)
general->addLayout(form[0], 1, 1, 1, 1);
general->addLayout(form[4], 1, 1, 1, 1);
if(nb >= 6)
general->addLayout(form[0], 1, 2, 1, 1);
general->addLayout(form[5], 1, 2, 1, 1);
if(nb >= 7)
general->addLayout(form[0], 2, 0, 1, 1);
general->addLayout(form[6], 2, 0, 1, 1);
if(nb == 8)
general->addLayout(form[0], 2, 1, 1, 1);
general->addWidget(valider, 2, 1, 1, 1);
general->addLayout(form[7], 2, 1, 1, 1);
general->addWidget(valider, 2, 2, 1, 1, Qt::AlignBottom);
}
void ParamAlpha::valide() {
......
......@@ -105,9 +105,18 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
general->addWidget(fenetre_param, 0, 1, 9, 1);
*/
boutonEtat = new QPushButton("Etats");
boutonEtat->setFixedWidth(50);
connect(boutonEtat, SIGNAL(clicked()), this, SLOT(parametrerEtats()));
form_choix->addWidget(boutonEtat);
}
void NouveauModele::parametrerEtats() {
paramAlpha.reset(new ParamAlpha(nb_etats->value()));
paramAlpha->show();
}
void NouveauModele::paramVoisinage(const QString& choix_voisinage){
if(choix_voisinage == "Voisinage de von Neumann" || choix_voisinage == "Voisinage de Moore"){
delete form_rayon;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment