Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
edc6282b
Verified
Commit
edc6282b
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Merge branch 'master' of gitlab.utc.fr:rdelaage/lo21-projet
parents
11625a21
47ec7938
Pipeline
#79730
passed with stage
in 16 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cellulut.pro.user
View file @
edc6282b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.0, 2021-06-12T
09:50:20
. -->
<!-- Written by QtCreator 4.15.0, 2021-06-12T
10:29:37
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
includes/parametragemodele.h
View file @
edc6282b
...
...
@@ -47,7 +47,7 @@ class NouveauModele : public QWidget {
QSpinBox
*
nb_etats
;
QComboBox
*
liste_voisinage
;
QComboBox
*
liste_regle_transition
;
QComboBox
*
liste_regle_transition
=
nullptr
;
QPushButton
*
bouton_valide
;
QHBoxLayout
*
layoutvalid
=
nullptr
;
...
...
@@ -60,6 +60,7 @@ class NouveauModele : public QWidget {
QLabel
*
etatCourant
;
QLabel
*
etatCourant2
=
nullptr
;
QLabel
*
etat_d
=
nullptr
;
QLabel
*
etat
;
QComboBox
*
valid_Etat
;
QSpinBox
*
numEtatCourant
=
nullptr
;
...
...
@@ -83,6 +84,8 @@ class NouveauModele : public QWidget {
QHBoxLayout
*
layouth5
=
nullptr
;
QHBoxLayout
*
layouth6
=
nullptr
;
QHBoxLayout
*
layoutEtat
;
//définition de la frame paramétrage du choix
QWidget
*
fenetre_param
;
QGridLayout
*
form_param
;
...
...
@@ -113,6 +116,7 @@ public slots:
void
parametrerEtats
();
void
addRegle
();
void
changerRegle
();
// void validerParametrage();
...
...
includes/reseau_cellule_etats.h
View file @
edc6282b
...
...
@@ -77,4 +77,5 @@ public:
Reseau
(
const
Reseau
&
);
~
Reseau
();
Reseau
&
operator
=
(
const
Reseau
&
r
);
bool
operator
==
(
const
Reseau
&
r
);
};
src/autocell.cpp
View file @
edc6282b
...
...
@@ -168,6 +168,7 @@ AutoCell::AutoCell(QWidget* parent):QWidget(parent)
button_reinitialiser
->
setFixedWidth
(
200
);
grid_run_control
->
addWidget
(
matriceTorique
,
1
,
0
,
1
,
2
);
grid_run_control
->
addWidget
(
lab_time_step
,
2
,
0
);
grid_run_control
->
addWidget
(
spin_time_step
,
2
,
1
);
grid_run_control
->
addWidget
(
button_prev
,
3
,
0
);
grid_run_control
->
addWidget
(
button_run
,
3
,
1
);
...
...
src/paramalpha.cpp
View file @
edc6282b
#include
<paramalpha.h>
#include
<Automate.h>
#include
<parametragemodele.h>
ParamAlpha
::
ParamAlpha
(
const
int
nbEtats
)
:
QWidget
(),
nb
(
nbEtats
)
{
this
->
setWindowTitle
(
"Configuration des états"
);
...
...
@@ -27,6 +28,7 @@ ParamAlpha::ParamAlpha(const int nbEtats): QWidget(), nb(nbEtats) {
form
[
i
]
->
addRow
(
"Vert:"
,
green
[
i
]);
form
[
i
]
->
addRow
(
"Bleu:"
,
blue
[
i
]);
}
connect
(
valider
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changerRegle
()));
connect
(
valider
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
valide
()));
...
...
@@ -46,13 +48,18 @@ ParamAlpha::ParamAlpha(const int nbEtats): QWidget(), nb(nbEtats) {
if
(
nb
==
8
)
general
->
addLayout
(
form
[
7
],
2
,
1
,
1
,
1
);
general
->
addWidget
(
valider
,
2
,
2
,
1
,
1
,
Qt
::
AlignBottom
);
}
void
ParamAlpha
::
valide
()
{
Automate
::
getInstance
().
getEnsemble
();
Automate
::
getInstance
().
getEnsemble
().
reset
();
for
(
int
i
=
0
;
i
<
nb
;
++
i
)
{
Automate
::
getInstance
().
getEnsemble
().
ajouterEtat
(
i
,
label
[
i
]
->
text
().
toStdString
(),
red
[
i
]
->
value
(),
green
[
i
]
->
value
(),
blue
[
i
]
->
value
());
}
this
->
close
();
}
src/parametragemodele.cpp
View file @
edc6282b
#include
"parametragemodele.h"
#include
<autocell.h>
#include
<Automate.h>
#include
<autosql.h>
NouveauModele
::
NouveauModele
(
QWidget
*
parent
)
:
QWidget
()
{
...
...
@@ -48,6 +49,7 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
nb_etats
=
new
QSpinBox
;
nb_etats
->
setRange
(
2
,
8
);
nom_modele
=
new
QLineEdit
(
"Nouveau modèle"
);
etat
=
new
QLabel
(
"Nombre d'états :"
);
//choisir un voisinage
liste_voisinage
=
new
QComboBox
;
...
...
@@ -61,22 +63,9 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
connect
(
liste_voisinage
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramVoisinage
(
const
QString
&
)));
//choisir une règle de transition
liste_regle_transition
=
new
QComboBox
;
liste_regle_transition
->
setPlaceholderText
(
"--- select ---"
);
//liste_regle_transition->addItem("--- select ---");
liste_regle_transition
->
addItem
(
"Life Game"
);
liste_regle_transition
->
addItem
(
"Langston's Loop"
);
liste_regle_transition
->
addItem
(
"Brian's brain"
);
liste_regle_transition
->
addItem
(
"Circulaire de Griffeath"
);
liste_regle_transition
->
addItem
(
"Nouvelle fonction de transition"
);
liste_regle_transition
->
setCurrentIndex
(
-
1
);
//connect(liste_regle_transition, SIGNAL(currentIndexChanged(int)), liste_voisinage, SLOT(setCurrentIndex(int)));
connect
(
liste_regle_transition
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
changerVoisinage
(
const
QString
&
)));
connect
(
liste_regle_transition
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramRegle
(
const
QString
)));
bouton_valide
=
new
QPushButton
(
"Valider"
);
...
...
@@ -84,7 +73,13 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
boutonEtat
=
new
QPushButton
(
"Etats"
);
layoutEtat
=
new
QHBoxLayout
;
layoutEtat
->
addWidget
(
etat
);
layoutEtat
->
addWidget
(
nb_etats
);
layoutEtat
->
addWidget
(
boutonEtat
);
connect
(
boutonEtat
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
parametrerEtats
()));
connect
(
boutonEtat
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changerRegle
()));
connect
(
bouton_valide
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
validerParametrage
()));
//ajout regle :
...
...
@@ -93,12 +88,7 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
form_choix
->
addRow
(
"Auteur :"
,
auteur
);
form_choix
->
addRow
(
"Année :"
,
annee
);
form_choix
->
addRow
(
"Description :"
,
description
);
//form_choix->addRow("Etat par défaut", etat_defaut);
form_choix
->
addRow
(
"Nombre d'états :"
,
nb_etats
);
form_choix
->
addRow
(
"Règle de transition :"
,
liste_regle_transition
);
//form_choix->addRow(layoutvalid);
//layoutvalid->addWidget(bouton_valide);
//layoutvalid->addWidget(boutonEtat);
form_choix
->
addRow
(
layoutEtat
);
general
->
addWidget
(
fenetre_init
,
0
,
0
,
9
,
1
);
...
...
@@ -243,7 +233,6 @@ void NouveauModele::changerVoisinage(const QString& choix_regle){
}
form_choix
->
insertRow
(
8
,
"Voisinage :"
,
liste_voisinage
);
layoutvalid
->
addWidget
(
bouton_valide
);
layoutvalid
->
addWidget
(
boutonEtat
);
form_choix
->
addRow
(
layoutvalid
);
connect
(
liste_voisinage
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramVoisinage
(
const
QString
&
)));
}
...
...
@@ -357,7 +346,7 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
if
(
choix_regle
==
"Nouvelle fonction de transition"
)
{
seuilValidator
=
new
QIntValidator
;
//
if(layouth != nullptr) delete layouth;
if
(
layouth
!=
nullptr
)
delete
layouth
;
if
(
layouth1
!=
nullptr
)
delete
layouth1
;
if
(
layouth2
!=
nullptr
)
delete
layouth2
;
if
(
layouth3
!=
nullptr
)
delete
layouth3
;
...
...
@@ -471,3 +460,24 @@ void NouveauModele::validerParametrage(){
nvAutocell->show();*/
}
void
NouveauModele
::
changerRegle
(){
if
(
liste_regle_transition
!=
nullptr
)
delete
liste_regle_transition
;
liste_regle_transition
=
new
QComboBox
;
liste_regle_transition
->
setPlaceholderText
(
"--- select ---"
);
//liste_regle_transition->addItem("--- select ---");
std
::
vector
<
QString
>
automates
=
Database
::
getInstance
().
getAutomates
();
for
(
size_t
i
=
0
;
i
<
automates
.
size
();
i
++
){
liste_regle_transition
->
addItem
(
automates
[
i
]);
}
liste_regle_transition
->
addItem
(
"Nouvelle fonction de transition"
);
liste_regle_transition
->
setCurrentIndex
(
-
1
);
form_choix
->
addRow
(
"Règle de transition : "
,
liste_regle_transition
);
connect
(
liste_regle_transition
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
changerVoisinage
(
const
QString
&
)));
connect
(
liste_regle_transition
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramRegle
(
const
QString
)));
}
src/reseau_cellule_etats.cpp
View file @
edc6282b
...
...
@@ -132,3 +132,11 @@ Reseau& Reseau::operator=(const Reseau& init_grille) {
return
*
this
;
}
bool
Reseau
::
operator
==
(
const
Reseau
&
r
){
if
(
static_cast
<
int
>
(
hauteur
)
!=
r
.
getHauteur
()
||
static_cast
<
int
>
(
largeur
)
!=
r
.
getLargeur
())
return
false
;
for
(
unsigned
int
i
=
0
;
hauteur
;
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
largeur
;
j
++
)
if
(
reseau
[
i
][
j
].
getIndEtat
()
!=
r
.
getReseau
()[
i
][
j
].
getIndEtat
())
return
false
;
return
true
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment