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
94d7f8c8
Commit
94d7f8c8
authored
Jun 12, 2021
by
Maxime Goret
Browse files
Param modele
parent
e19cf0c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/parametragemodele.h
View file @
94d7f8c8
...
...
@@ -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 @
94d7f8c8
...
...
@@ -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 @
94d7f8c8
...
...
@@ -220,7 +220,7 @@ void NouveauModele::modifGrille(const QModelIndex& index){
}
void
NouveauModele
::
changerVoisinage
(
const
QString
&
choix_regle
){
void
NouveauModele
::
changerVoisinage
(){
//delete liste_voisinage;
form_choix
->
removeRow
(
7
);
...
...
@@ -229,27 +229,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
&
)));
}
...
...
@@ -267,8 +255,6 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
if
(
numEtatCourant
!=
nullptr
)
delete
numEtatCourant
;
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
...
...
@@ -277,13 +263,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
;
...
...
@@ -297,6 +280,8 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
connect
(
next
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
addRegle
()));
connect
(
fin
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
validation
()));
}
else
{
...
...
@@ -309,6 +294,7 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
if
(
etatCourant2
!=
nullptr
)
delete
etatCourant2
;
if
(
numEtatCourant
!=
nullptr
)
delete
numEtatCourant
;
numEtatCourant
=
new
QSpinBox
;
numEtatCourant
=
nullptr
;
...
...
@@ -322,7 +308,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
);
...
...
@@ -333,25 +319,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
);
...
...
@@ -362,13 +344,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
;
...
...
@@ -385,13 +362,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
);
...
...
@@ -431,17 +407,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
(){
...
...
@@ -480,28 +454,7 @@ void NouveauModele::validerParametrage(){
nvAutocell->show();*/
}
void
NouveauModele
::
changerRegle
(){
if
(
liste_regle_transition
!=
nullptr
)
form_choix
->
removeRow
(
6
);
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
(
"Game Life"
);
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
;
...
...
@@ -514,3 +467,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
.
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