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
11625a21
Verified
Commit
11625a21
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Resolve save grid and Grille attribute set
parent
fb38fd85
Changes
3
Hide whitespace changes
Inline
Side-by-side
application.db
View file @
11625a21
No preview for this file type
src/autocell.cpp
View file @
11625a21
...
...
@@ -150,7 +150,7 @@ AutoCell::AutoCell(QWidget* parent):QWidget(parent)
spin_time_step
->
setFixedWidth
(
70
);
spin_time_step
->
setValue
(
1000
);
spin_time_step
->
setRange
(
500
,
2500
);
connect
(
spin_time_step
,
SIGNAL
(
valueChanged
(
int
i
)),
this
,
SLOT
(
changeDelai
(
int
i
)));
connect
(
spin_time_step
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
changeDelai
(
int
)));
button_prev
=
new
QPushButton
(
"<<"
);
button_prev
->
setStyleSheet
(
"background-color: rgb(255,255,255)"
);
button_prev
->
setFixedSize
(
40
,
40
);
...
...
@@ -167,7 +167,7 @@ AutoCell::AutoCell(QWidget* parent):QWidget(parent)
button_reinitialiser
->
setStyleSheet
(
"background-color: rgb(255,255,255)"
);
button_reinitialiser
->
setFixedWidth
(
200
);
grid_run_control
->
addWidget
(
matriceTorique
,
1
,
0
,
Qt
::
AlignCenter
);
grid_run_control
->
addWidget
(
matriceTorique
,
1
,
0
,
1
,
2
);
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
);
...
...
@@ -208,8 +208,9 @@ AutoCell::AutoCell(QWidget* parent):QWidget(parent)
general
->
addWidget
(
win_notice
,
0
,
2
,
3
,
1
);
};
void
AutoCell
::
afficherGrille
(
Reseau
*
G
rille
)
void
AutoCell
::
afficherGrille
(
Reseau
*
g
rille
)
{
Grille
.
reset
(
new
Reseau
(
*
grille
));
win_grid
=
new
QWidget
;
int
l
=
Grille
->
getLargeur
();
...
...
@@ -279,28 +280,28 @@ void AutoCell::initialiserGrille(){
return
;
}
this
->
Grille
.
reset
(
new
Reseau
(
h
,
l
)
)
;
Reseau
grille
=
Reseau
(
h
,
l
);
if
(
check_aleatoire
->
isChecked
())
G
rille
->
setAleatoire
();
g
rille
.
setAleatoire
();
QString
nom_grille
=
list_grids
->
currentText
();
if
(
check_load_grid
->
isChecked
())
{
this
->
Grille
.
reset
(
new
Reseau
(
Database
::
getInstance
().
getReseau
(
listeGrille
[
list_grids
->
currentIndex
()
*
2
].
toInt
()))
)
;
grille
=
Reseau
(
Database
::
getInstance
().
getReseau
(
listeGrille
[
list_grids
->
currentIndex
()
*
2
].
toInt
()));
QString
str_largeur
;
//str_largeur.setNum(listeGrille[list_grids->currentIndex()*2].toInt());
QString
str_hauteur
;
//edit_largeur->setText(str_largeur);
edit_largeur
->
setText
(
str_largeur
.
setNum
(
G
rille
->
getLargeur
(),
10
));
edit_hauteur
->
setText
(
str_hauteur
.
setNum
(
G
rille
->
getHauteur
(),
10
));
edit_largeur
->
setText
(
str_largeur
.
setNum
(
g
rille
.
getLargeur
(),
10
));
edit_hauteur
->
setText
(
str_hauteur
.
setNum
(
g
rille
.
getHauteur
(),
10
));
}
//réinitialiser l'automate
Automate
::
getInstance
().
reset
();
this
->
afficherGrille
(
this
->
Grille
.
get
()
);
Automate
::
getInstance
().
setReseauInit
(
*
G
rille
);
this
->
afficherGrille
(
&
grille
);
Automate
::
getInstance
().
setReseauInit
(
g
rille
);
Automate
::
getInstance
().
initialiserBuffer
();
};
void
AutoCell
::
RAZ
(){
...
...
src/autosql.cpp
View file @
11625a21
...
...
@@ -485,7 +485,7 @@ void Database::stockerReseau(const Reseau& reseau, const QString& nomReseau, con
int
idReseau
=
query
.
value
(
0
).
toInt
()
+
1
;
//Insertion du tuple dans reseaux
query
.
prepare
(
"INSERT INTO reseaux VALUES (:id,
'
:nom
'
, :h, :l,
'
:automate
'
)"
);
query
.
prepare
(
"INSERT INTO reseaux VALUES (:id, :nom, :h, :l, :automate)"
);
query
.
bindValue
(
":id"
,
idReseau
);
query
.
bindValue
(
":nom"
,
nomReseau
);
query
.
bindValue
(
":h"
,
reseau
.
getHauteur
());
...
...
@@ -502,7 +502,7 @@ void Database::stockerReseau(const Reseau& reseau, const QString& nomReseau, con
query
.
bindValue
(
":reseau"
,
idReseau
);
query
.
bindValue
(
":etat"
,
reseau
.
getReseau
()[
i
][
j
].
getIndEtat
());
query
.
bindValue
(
":x"
,
i
);
query
.
bindValue
(
":
x
"
,
j
);
query
.
bindValue
(
":
y
"
,
j
);
query
.
exec
();
}
}
...
...
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