Ecran-DARTS  1.1
BTS SNIR LaSalle Avignon 2021
ihmDarts.h
Aller à la documentation de ce fichier.
1 #ifndef DARTS_H
2 #define DARTS_H
3 
13 #include <QtWidgets>
14 
19 #define PLEIN_ECRAN
20 
25 #define AVEC_BLUETOOTH
26 
27 // Index des trois écrans de l'IHM
32 #define ECRAN_ACCUEIL 0
33 
37 #define ECRAN_PARTIE 1
38 
42 #define ECRAN_FIN 2
43 
47 #define NB_ECRANS 3
48 
52 #define TAILLE_POLICE_TYPE_JEU 40
53 
57 #define TAILLE_POLICE_VOLEE 60
58 
62 #define TAILLE_POLICE_SCORE 70
63 
67 #define TAILLE_POLICE_NOM_JOUEUR 60
68 
72 #define HAUTEUR_TYPE_JEU 10
73 
77 #define LARGEUR_NOM_JOUEUR 38
78 
82 #define HAUTEUR_NOM_JOUEUR 17
83 
87 #define LARGEUR_ICONE_JOUEUR 12
88 
92 #define LARGEUR_VOLEE_JOUEUR 32
93 
97 #define LARGEUR_SCORE_JOUEUR 15
98 
102 #define LARGEUR_CIBLE 20
103 
107 #define HAUTEUR_CIBLE 35
108 
112 #define NB_JOUEURS_MAX 5
113 
117 #define POLICE_NOM_APPLICATION 80
118 
122 #define POLICE_MESSAGE_ACCUEIL 50
123 
127 #define POLICE_MESSAGE_FIN 60
128 
132 #define POLICE_GAGNANT 60
133 
137 #define FIXER_HAUTEUR_LABEL 12
138 
142 #define LARGEUR_ICONE_DARTS 15
143 
147 #define HAUTEUR_ICONE_DARTS 25
148 
152 #define TEST_SCORE_VAUT_ZERO 0
153 
157 #define TEST_ID 2
158 
159 class Statistiques;
160 class Communication;
161 class Partie;
162 
168 class IhmDARTS : public QWidget
169 {
170  Q_OBJECT
171 
172  private:
176 
180 
181  // Les widgets
182  QStackedWidget *ecranDARTS;
186 
187  QLabel *labelNbJoueurs;
188  QLabel *labelGagnant;
192  QLabel *labelTypeDeJeu;
193  //QLabel *labelNbManchesGagnerDeChaqueJoueur;//!<Le nombre de manches gagnées par chaque joueur
194  //QLabel *labelPlusHauteVolee;//!<La plus haute volée
195  //QLabel *labelMoyenneVoleesDeChaqueJoueur;//!<La moyenne des volées de chaque joueur
198  QVector<QLabel*> labelsNomJoueur;
199  QVector<QLabel*> labelIconeJoueur;
200  QVector<QLabel*> labelsVoleeJoueur;
201  QVector<QLabel*> labelsScoreJoueur;
202 
203  void creerWidgets();
204  void initialiserWidgets();
205  void fixerLargeurLabel(QLabel *label, int proportion);
206  void fixerHauteurLabel(QLabel *label, int proportion);
207  void montrerJoueur(int indexJoueur);
208  void cacherJoueur(int indexJoueur);
209  void cacherJoueurs();
210  void placerWidgets();
212  void placerWidgetsEcranPartie();
213  void placerWidgetsEcranFin();
214  void initialiserEvenements();
215  void creerRaccourcisClavier();
217  void reinitialiserScore();
218  void afficherEcranFin();
219  QString determinerMultiplicateur(int multiplicateur);
220  void afficherVolee(int idTouche, int valeurTouche, QString strMultiplicateur);
221 
222 public:
223  IhmDARTS(QWidget *parent = nullptr);
224  ~IhmDARTS();
225 
226  public slots:
227  void selectionnerEcran(int indexEcran);
228  void allerPageSuivante();
229  void allerPagePrecedente();
230  void afficherAttenteConnexion();
232  void afficherEcranPartie();
233  void afficherDebutPartie(QString typePartie, int nbJoueurs);
234  void afficherListeJoueurs(QStringList listeJoueurs);
235  void afficherTouche(int idTouche, int valeurTouche, int multiplicateur);
236  void gererFinPartie(QString leGagnant);
237  void allerJoueurPrecedent();
238  void allerJoueurSuivant();
239  void afficherTypeJeuEtScore(QString typePartie, int score);
240 
241  signals:
242 
243 };
244 
245 #endif // DARTS_H
IhmDARTS::IhmDARTS
IhmDARTS(QWidget *parent=nullptr)
Constructeur de la classe IhmDARTS.
Definition: ihmDarts.cpp:23
IhmDARTS::afficherAttenteConnexion
void afficherAttenteConnexion()
Affiche en attente de connextion.
Definition: ihmDarts.cpp:109
IhmDARTS::selectionnerJoueurCourant
void selectionnerJoueurCourant()
Méthode qui selectionner le joueur Courant.
Definition: ihmDarts.cpp:702
QWidget
IhmDARTS::placerWidgetsEcranAccueil
void placerWidgetsEcranAccueil()
Méthode qui place les widgets de l'écran d'accueil.
Definition: ihmDarts.cpp:390
IhmDARTS::labelNbJoueurs
QLabel * labelNbJoueurs
Le label du nombres de joueurs.
Definition: ihmDarts.h:187
IhmDARTS::afficherListeJoueurs
void afficherListeJoueurs(QStringList listeJoueurs)
Affiche la liste des joueurs.
Definition: ihmDarts.cpp:622
IhmDARTS::afficherEcranFin
void afficherEcranFin()
Definition: ihmDarts.cpp:718
IhmDARTS::partie
Partie * partie
objet partie
Definition: ihmDarts.h:175
IhmDARTS::fixerLargeurLabel
void fixerLargeurLabel(QLabel *label, int proportion)
Méthode qui fixe la largeur des labels.
Definition: ihmDarts.cpp:300
IhmDARTS::labelIconeDarts
QLabel * labelIconeDarts
Definition: ihmDarts.h:196
IhmDARTS::initialiserEvenements
void initialiserEvenements()
Méthode qui initialise les évenements.
Definition: ihmDarts.cpp:475
IhmDARTS::afficherTypeJeuEtScore
void afficherTypeJeuEtScore(QString typePartie, int score)
Definition: ihmDarts.cpp:553
IhmDARTS::determinerMultiplicateur
QString determinerMultiplicateur(int multiplicateur)
Definition: ihmDarts.cpp:726
IhmDARTS::statistiques
Statistiques * statistiques
objet statistiques
Definition: ihmDarts.h:173
IhmDARTS::labelNomApplication
QLabel * labelNomApplication
Le label du nom de l'application.
Definition: ihmDarts.h:191
IhmDARTS::afficherEcranPartie
void afficherEcranPartie()
Affiche l'écrant partie.
Definition: ihmDarts.cpp:134
Communication
Definition: communication.h:74
IhmDARTS::placerWidgets
void placerWidgets()
Méthode qui place les widgets.
Definition: ihmDarts.cpp:370
IhmDARTS::montrerJoueur
void montrerJoueur(int indexJoueur)
Méthode qui montre les joueurs.
Definition: ihmDarts.cpp:325
IhmDARTS::initialiserWidgets
void initialiserWidgets()
Méthode qui initialise les widjets.
Definition: ihmDarts.cpp:184
IhmDARTS
Déclaration de la classe IhmDARTS.
Definition: ihmDarts.h:168
IhmDARTS::cacherJoueur
void cacherJoueur(int indexJoueur)
Méthode qui cache les joueurs.
Definition: ihmDarts.cpp:341
IhmDARTS::nbJoueurs
int nbJoueurs
Definition: ihmDarts.h:178
IhmDARTS::afficherAttenteDebutPartie
void afficherAttenteDebutPartie()
Affiche en attente de debut de partie.
Definition: ihmDarts.cpp:120
Statistiques
Definition: statistiques.h:15
IhmDARTS::placerWidgetsEcranPartie
void placerWidgetsEcranPartie()
Méthode qui place les widgets de l'écran partie.
Definition: ihmDarts.cpp:417
IhmDARTS::allerPageSuivante
void allerPageSuivante()
Affiche la page suivante.
Definition: ihmDarts.cpp:83
IhmDARTS::allerPagePrecedente
void allerPagePrecedente()
Affiche la page precdente.
Definition: ihmDarts.cpp:95
IhmDARTS::fixerHauteurLabel
void fixerHauteurLabel(QLabel *label, int proportion)
Méthode qui fixe la hauteur des labels.
Definition: ihmDarts.cpp:313
IhmDARTS::selectionnerEcran
void selectionnerEcran(int indexEcran)
sélectionne l'ecran
Definition: ihmDarts.cpp:72
IhmDARTS::labelTypeDeJeu
QLabel * labelTypeDeJeu
Le label du type de jeu.
Definition: ihmDarts.h:192
IhmDARTS::labelsScoreJoueur
QVector< QLabel * > labelsScoreJoueur
Un conteneur qui contient le score des joueurs.
Definition: ihmDarts.h:201
IhmDARTS::ecranDARTS
QStackedWidget * ecranDARTS
la pile d'écrans
Definition: ihmDarts.h:182
IhmDARTS::ecranAccueil
QWidget * ecranAccueil
l'écran d'accueil (attente)
Definition: ihmDarts.h:183
IhmDARTS::labelsNomJoueur
QVector< QLabel * > labelsNomJoueur
Un conteneur qui contient le nom des joueurs.
Definition: ihmDarts.h:198
IhmDARTS::ecranFin
QWidget * ecranFin
l'écran de fin (avec statistiques)
Definition: ihmDarts.h:185
IhmDARTS::cacherJoueurs
void cacherJoueurs()
Méthode qui cache les joueurs.
Definition: ihmDarts.cpp:356
IhmDARTS::labelMessageFin
QLabel * labelMessageFin
Le label du message de fin.
Definition: ihmDarts.h:189
IhmDARTS::afficherDebutPartie
void afficherDebutPartie(QString typePartie, int nbJoueurs)
affiche le debut de la partie
Definition: ihmDarts.cpp:534
Partie
Déclaration de la classe Partie.
Definition: partie.h:30
IhmDARTS::placerWidgetsEcranFin
void placerWidgetsEcranFin()
Méthode qui place les widgets de l'écran de fin.
Definition: ihmDarts.cpp:445
IhmDARTS::creerWidgets
void creerWidgets()
Méthode qui crée les widjets.
Definition: ihmDarts.cpp:144
IhmDARTS::allerJoueurPrecedent
void allerJoueurPrecedent()
Sélectionne le joueur précedent.
Definition: ihmDarts.cpp:652
IhmDARTS::communication
Communication * communication
objet communication
Definition: ihmDarts.h:174
IhmDARTS::allerJoueurSuivant
void allerJoueurSuivant()
Sélectionne le joueur suivant.
Definition: ihmDarts.cpp:678
IhmDARTS::afficherVolee
void afficherVolee(int idTouche, int valeurTouche, QString strMultiplicateur)
Definition: ihmDarts.cpp:596
IhmDARTS::partieTerminee
bool partieTerminee
Permet de voire si la partie est terminée.
Definition: ihmDarts.h:179
IhmDARTS::labelGagnant
QLabel * labelGagnant
Le label du joueurs gagnant.
Definition: ihmDarts.h:188
IhmDARTS::labelMessageAccueil
QLabel * labelMessageAccueil
Le label du message d'accueil.
Definition: ihmDarts.h:190
IhmDARTS::creerRaccourcisClavier
void creerRaccourcisClavier()
Méthode qui cree les raccourcis clavier.
Definition: ihmDarts.cpp:494
IhmDARTS::labelIconeJoueur
QVector< QLabel * > labelIconeJoueur
Un conteneur qui contient l'icone des joueurs.
Definition: ihmDarts.h:199
IhmDARTS::ecranPartie
QWidget * ecranPartie
l'écran d'affichage de partie
Definition: ihmDarts.h:184
IhmDARTS::afficherTouche
void afficherTouche(int idTouche, int valeurTouche, int multiplicateur)
Affiche la touche.
Definition: ihmDarts.cpp:573
IhmDARTS::labelIconeDartsEcranFin
QLabel * labelIconeDartsEcranFin
Definition: ihmDarts.h:197
IhmDARTS::labelsVoleeJoueur
QVector< QLabel * > labelsVoleeJoueur
Un conteneur qui contient la volee des joueurs.
Definition: ihmDarts.h:200
IhmDARTS::gererFinPartie
void gererFinPartie(QString leGagnant)
Gère la fin de la partie.
Definition: ihmDarts.cpp:636
IhmDARTS::joueurCourant
int joueurCourant
index du tireur
Definition: ihmDarts.h:177
IhmDARTS::~IhmDARTS
~IhmDARTS()
Déstructeur de la classe IhmDARTS.
Definition: ihmDarts.cpp:61
IhmDARTS::reinitialiserScore
void reinitialiserScore()
Méthode qui réinitialiser de score.
Definition: ihmDarts.cpp:712