Skip to content
GitLab
Menu
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
7db3dfe5
Verified
Commit
7db3dfe5
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Merge branch 'master' of gitlab.utc.fr:rdelaage/lo21-projet
parents
f9745ea1
2368b743
Pipeline
#79780
passed with stage
in 15 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.DS_Store
View file @
7db3dfe5
No preview for this file type
includes/parametragemodele.h
View file @
7db3dfe5
...
...
@@ -109,20 +109,21 @@ public:
NouveauModele
(
QWidget
*
parent
=
nullptr
);
public
slots
:
void
paramVoisinage
(
const
QString
&
choix_voisinage
);
void
changerVoisinage
(
const
QString
&
choix_regle
);
void
changerVoisinage
();
void
affGrille
();
void
modifGrille
(
const
QModelIndex
&
index
);
void
paramRegle
(
const
QString
&
choix_regle
);
void
paramRegle
();
void
validerParametrage
();
void
choisirEtatCourant
(
const
QString
&
validEtat
);
void
parametrerEtats
();
void
addRegle
();
void
changerRegle
();
void
changerEtatDefault
();
void
validation
();
// void validerParametrage();
...
...
src/paramalpha.cpp
View file @
7db3dfe5
...
...
@@ -30,7 +30,9 @@ ParamAlpha::ParamAlpha(const int nbEtats, const QWidget *parent): QWidget(), nb(
}
connect
(
valider
,
SIGNAL
(
clicked
()),
parent
,
SLOT
(
changerRegle
()));
connect
(
valider
,
SIGNAL
(
clicked
()),
parent
,
SLOT
(
changerVoisinage
()));
connect
(
valider
,
SIGNAL
(
clicked
()),
parent
,
SLOT
(
paramRegle
()));
connect
(
valider
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
valide
()));
...
...
src/parametragemodele.cpp
View file @
7db3dfe5
...
...
@@ -209,7 +209,7 @@ void NouveauModele::modifGrille(const QModelIndex& index){
}
void
NouveauModele
::
changerVoisinage
(
const
QString
&
choix_regle
){
void
NouveauModele
::
changerVoisinage
(){
//delete liste_voisinage;
form_choix
->
removeRow
(
7
);
...
...
@@ -218,27 +218,15 @@ void NouveauModele::changerVoisinage(const QString& choix_regle){
if
(
choix_regle
==
"Life Game"
){
//liste_voisinage->addItem("--- select ---");
liste_voisinage
->
addItem
(
"Voisinage de von Neumann"
);
liste_voisinage
->
addItem
(
"Voisinage arbitraire"
);
liste_voisinage
->
setCurrentIndex
(
-
1
);
}
else
if
(
choix_regle
==
"Langston's Loop"
){
liste_voisinage
->
addItem
(
"Voisinage de Moore"
);
liste_voisinage
->
addItem
(
"Voisinage arbitraire"
);
liste_voisinage
->
setCurrentIndex
(
-
1
);
}
else
if
(
choix_regle
==
"Brian's brain"
||
choix_regle
==
"Circulaire de Griffeath"
||
choix_regle
==
"Nouvelle fonction de transition"
){
//liste_voisinage->addItem("--- select ---");
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
(
8
,
"Voisinage :"
,
liste_voisinage
);
layoutvalid
->
addWidget
(
bouton_valide
);
form_choix
->
addRow
(
layoutvalid
);
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
);
connect
(
liste_voisinage
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramVoisinage
(
const
QString
&
)));
}
...
...
@@ -256,8 +244,6 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
if
(
numEtatCourant
!=
nullptr
)
delete
numEtatCourant
;
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
...
...
@@ -266,13 +252,10 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
fin
=
new
QPushButton
(
"Terminer"
);
next
=
new
QPushButton
(
"Règle suivante"
);
form_choix
->
add
Row
(
layoutv2
);
form_choix
->
insert
Row
(
9
,
layoutv2
);
layoutv2
->
addLayout
(
layouth5
);
layoutv2
->
addLayout
(
layouth6
);
etatCourant2
=
new
QLabel
(
"Etat Courant : "
);
numEtatCourant
=
new
QSpinBox
;
...
...
@@ -286,6 +269,8 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
connect
(
next
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
addRegle
()));
connect
(
fin
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
validation
()));
}
else
{
...
...
@@ -298,6 +283,7 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
if
(
etatCourant2
!=
nullptr
)
delete
etatCourant2
;
if
(
numEtatCourant
!=
nullptr
)
delete
numEtatCourant
;
numEtatCourant
=
new
QSpinBox
;
numEtatCourant
=
nullptr
;
...
...
@@ -311,7 +297,7 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
fin
=
new
QPushButton
(
"Terminer"
);
next
=
new
QPushButton
(
"Règle suivante"
);
form_choix
->
add
Row
(
layoutv2
);
form_choix
->
insert
Row
(
9
,
layoutv2
);
layoutv2
->
addLayout
(
layouth5
);
layoutv2
->
addLayout
(
layouth6
);
...
...
@@ -322,25 +308,21 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
layouth6
->
addWidget
(
next
);
connect
(
next
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
addRegle
()));
connect
(
fin
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
validation
()));
}
}
void
NouveauModele
::
paramRegle
(
const
QString
&
choix_regle
)
{
void
NouveauModele
::
paramRegle
()
{
seuilMax
=
new
QLabel
(
"Seuil Max : "
);
seuilMin
=
new
QLabel
(
"Seuil Min : "
);
destination
=
new
QLabel
(
"Destination : "
);
etatCourant
=
new
QLabel
(
"Etat Courant : "
);
etat_d
=
new
QLabel
(
"Etat défault : "
);
etat_default
=
new
QSpinBox
;
etat_default
->
setRange
(
0
,(
nb_etats
->
value
())
-
1
);
etatDest
=
new
QSpinBox
;
etatDest
->
setRange
(
0
,
nb_etats
->
value
()
-
1
);
...
...
@@ -351,13 +333,8 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
valid_Etat
->
setCurrentIndex
(
-
1
);
if
(
choix_regle
==
"Nouvelle fonction de transition"
)
{
seuilValidator
=
new
QIntValidator
;
//if(layouth != nullptr) delete layouth;
if
(
layouth1
!=
nullptr
)
delete
layouth1
;
if
(
layouth2
!=
nullptr
)
delete
layouth2
;
if
(
layouth3
!=
nullptr
)
delete
layouth3
;
...
...
@@ -374,13 +351,12 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
layouth3
=
new
QHBoxLayout
;
layouth4
=
new
QHBoxLayout
;
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
//layouth6 = new QHBoxLayout;
//layouth5 = new QHBoxLayout;
//layoutv2 = new QVBoxLayout;
form_choix
->
addRow
(
layoutv
);
form_choix
->
insertRow
(
8
,
layoutv
);
layoutv
->
addLayout
(
layouth1
);
layoutv
->
addLayout
(
layouth2
);
layoutv
->
addLayout
(
layouth3
);
...
...
@@ -420,17 +396,15 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
layouth4
->
addWidget
(
etatCourant
);
layouth4
->
addWidget
(
valid_Etat
);
//layouth->addWidget(etat_d);
//layouth->addWidget(etat_default);
connect
(
valid_Etat
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
choisirEtatCourant
(
const
QString
&
)));
}
}
void
NouveauModele
::
addRegle
(){
paramRegle
(
"Nouvelle fonction de transition"
);
paramRegle
();
}
void
NouveauModele
::
validerParametrage
(){
...
...
@@ -469,26 +443,8 @@ void NouveauModele::validerParametrage(){
nvAutocell->show();*/
}
void
NouveauModele
::
changerRegle
(){
if
(
liste_regle_transition
!=
nullptr
)
form_choix
->
removeRow
(
8
);
liste_regle_transition
=
new
QComboBox
;
liste_regle_transition
->
setPlaceholderText
(
"--- 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
->
insertRow
(
8
,
"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
)));
}
void
NouveauModele
::
changerEtatDefault
(){
etat_default
=
new
QSpinBox
;
...
...
@@ -501,3 +457,8 @@ void NouveauModele::changerEtatDefault(){
form_choix
->
addRow
(
valider_EtatDefault
);
connect
(
valider_EtatDefault
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
parametrerEtats
()));
}
void
NouveauModele
::
validation
(){
bouton_valide
=
new
QPushButton
(
"Valider"
);
form_choix
->
addRow
(
bouton_valide
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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