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
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
3e74229c
Commit
3e74229c
authored
May 15, 2021
by
Eugene Pin
Browse files
Modification UI et création de nouvelles connections
#31
parent
a4edf363
Pipeline
#77952
passed with stages
in 17 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
forms/interface.ui
View file @
3e74229c
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
10
75
</width>
<height>
6
16
</height>
<width>
10
89
</width>
<height>
6
53
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -291,6 +291,16 @@ pattern recorded :</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"validateGridDim"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
OK
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
...
...
@@ -411,6 +421,9 @@ pattern recorded :</string>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"neighborhoodComboBox"
>
<property
name=
"currentIndex"
>
<number>
0
</number>
</property>
<item>
<property
name=
"text"
>
<string>
Von Neumann
</string>
...
...
@@ -437,6 +450,9 @@ pattern recorded :</string>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"cusumNeighborhoodButton"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
Custom neighborhood
</string>
</property>
...
...
@@ -506,7 +522,11 @@ pattern recorded :</string>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QLineEdit"
name=
"radiusLineEdit"
/>
<widget
class=
"QLineEdit"
name=
"radiusLineEdit"
>
<property
name=
"text"
>
<string>
1
</string>
</property>
</widget>
</item>
</layout>
</item>
...
...
@@ -548,8 +568,8 @@ pattern recorded :</string>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
10
75
</width>
<height>
2
5
</height>
<width>
10
89
</width>
<height>
2
6
</height>
</rect>
</property>
</widget>
...
...
include/interface.hpp
View file @
3e74229c
...
...
@@ -5,6 +5,7 @@
#include <QGraphicsScene>
#include <QFileDialog>
#include "property.hpp"
...
...
@@ -21,11 +22,34 @@ public:
~
MainWindow
();
private
slots
:
//! \brief Connection entre le slider et le spinBox pour la vitesse d'exectution de la simulation
void
on_simSpeedSpinbox_valueChanged
(
int
arg1
);
//! \brief Connection entre le slider et le spinBox pour la vitesse d'exectution de la simulation
void
on_simSpeedSlider_valueChanged
(
int
value
);
//! \brief Ouverture d'un pattern depuis le navigateur de fichier
void
on_openPatternButton_clicked
();
//! \brief Ouverture d'une règle depuis le navigateur de fichier
void
on_openRuleButton_clicked
();
//! \brief Envoie un signal lors du changement de voisinage. Lorsque Custom est sélectionné, le bouton "Custom Neighborhood" est actif
void
on_neighborhoodComboBox_currentTextChanged
(
const
QString
&
arg1
);
//! \brief Active le bouton pour valider la dimension de la grille lors d'une modification dans le Line Edit
void
on_heightLineEdit_textChanged
(
const
QString
&
arg1
);
//! \brief Active le bouton pour valider la dimension de la grille lors d'une modification dans le Line Edit
void
on_widthLineEdit_textChanged
(
const
QString
&
arg1
);
//! \brief Envoie le signal que la dimension de la grille a été modifié
void
on_validateGridDim_clicked
();
private:
QValidator
*
intValidator
;
Ui
::
MainWindow
*
ui
;
};
#endif // MAINWINDOW_HPP
include/vonNeumannNeighborhoodRule.hpp
View file @
3e74229c
...
...
@@ -26,7 +26,7 @@ public:
//! \return L'ensemble des voisins de la cellule à 'pos'
Neighborhood
getNeighborhood
(
const
Grid
&
grid
,
Coord
pos
)
const
;
//! \brief Retourne 'format' de
Moore
dans un vecteur (méthode dérivée)
//! \brief Retourne 'format' de
VonNeumann
dans un vecteur (méthode dérivée)
//! \return Retourne les formats de voisinage possible dans un std::vector.
std
::
vector
<
NeighborhoodFormat
>
getFormats
()
const
;
};
...
...
src/interface.cpp
View file @
3e74229c
...
...
@@ -6,6 +6,12 @@ MainWindow::MainWindow(QWidget *parent)
,
ui
(
new
Ui
::
MainWindow
)
{
ui
->
setupUi
(
this
);
// Validator pour entrer la taille de la grille et le rayon
intValidator
=
new
QIntValidator
(
1
,
1000
,
this
);
ui
->
heightLineEdit
->
setValidator
(
intValidator
);
ui
->
widthLineEdit
->
setValidator
(
intValidator
);
ui
->
radiusLineEdit
->
setValidator
(
intValidator
);
}
MainWindow
::~
MainWindow
()
...
...
@@ -13,6 +19,8 @@ MainWindow::~MainWindow()
delete
ui
;
}
/// Connections
void
MainWindow
::
on_simSpeedSpinbox_valueChanged
(
int
arg1
)
{
ui
->
simSpeedSlider
->
setValue
(
arg1
);
...
...
@@ -22,3 +30,54 @@ void MainWindow::on_simSpeedSlider_valueChanged(int value)
{
ui
->
simSpeedSpinbox
->
setValue
(
value
);
}
void
MainWindow
::
on_openPatternButton_clicked
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open File"
),
"/home"
,
tr
(
"PatternFile (*.pat)"
));
if
(
fileName
==
""
){
// L'utilisateur a annulé la recherche
}
// Indiquer qu'un nouveau pattern vient d'être ouvert
}
void
MainWindow
::
on_openRuleButton_clicked
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open File"
),
"/home"
,
tr
(
"RuleFile (*.rule)"
));
if
(
fileName
==
""
){
// L'utilisateur a annulé la recherche
}
// Indiquer qu'une nouvelle règle vient d'être ouverte. La règle est sauvegardé, donc on peut lancer la simulation
}
void
MainWindow
::
on_neighborhoodComboBox_currentTextChanged
(
const
QString
&
arg1
)
{
if
(
arg1
==
"Von Neumann"
){
ui
->
cusumNeighborhoodButton
->
setEnabled
(
false
);
// Utiliser la règle de voisinage VonNeumann
}
if
(
arg1
==
"Moore"
){
ui
->
cusumNeighborhoodButton
->
setEnabled
(
false
);
// Utiliser la règle de voisinage Moore
}
if
(
arg1
==
"Custom"
){
ui
->
cusumNeighborhoodButton
->
setEnabled
(
true
);
}
}
void
MainWindow
::
on_heightLineEdit_textChanged
(
const
QString
&
arg1
)
{
ui
->
validateGridDim
->
setEnabled
(
true
);
}
void
MainWindow
::
on_widthLineEdit_textChanged
(
const
QString
&
arg1
)
{
ui
->
validateGridDim
->
setEnabled
(
true
);
}
void
MainWindow
::
on_validateGridDim_clicked
()
{
// Appliquer la dimension à la grille
ui
->
validateGridDim
->
setEnabled
(
false
);
}
Write
Preview
Markdown
is supported
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