|
@@ -118,8 +118,10 @@ MaFenetre::MaFenetre() :
|
|
|
QObject::connect (actionNouveau, &QAction::triggered , this , &MaFenetre::init);
|
|
|
QObject::connect (actionOptions , &QAction::triggered , this, &MaFenetre::lancerDialogueOptions);
|
|
|
QObject::connect (actionQuitter , &QAction::triggered , qApp , &QApplication::quit);
|
|
|
- QObject::connect (chrono1, &Chronometre::fin, this, &MaFenetre::afficheGagnant);
|
|
|
- QObject::connect (chrono2, &Chronometre::fin, this, &MaFenetre::afficheGagnant);
|
|
|
+ QObject::connect (chrono1, &Chronometre::fin, chrono2, &Chronometre::declareGagnant);
|
|
|
+ QObject::connect (chrono2, &Chronometre::fin, chrono1, &Chronometre::declareGagnant);
|
|
|
+ QObject::connect (chrono1, &Chronometre::won, this, &MaFenetre::afficheGagnant);
|
|
|
+ QObject::connect (chrono2, &Chronometre::won, this, &MaFenetre::afficheGagnant);
|
|
|
QObject::connect (chrono1, &Chronometre::is_paused, this, &MaFenetre::ajouterTempsJoueur);
|
|
|
QObject::connect (chrono2, &Chronometre::is_paused, this, &MaFenetre::ajouterTempsJoueur);
|
|
|
|
|
@@ -191,13 +193,13 @@ void MaFenetre::arreter () {
|
|
|
etatBoutons (false , false, true);
|
|
|
}
|
|
|
|
|
|
-void MaFenetre::afficheGagnant() {
|
|
|
+void MaFenetre::afficheGagnant(Chronometre *chrono) {
|
|
|
arreter();
|
|
|
if (option->son() == true)
|
|
|
QSound::play(":/ressources/sonnette.wav");
|
|
|
QMessageBox message;
|
|
|
QString texte;
|
|
|
- texte = "Le joueur " + (*chrono1+=*chrono2) + " a gagné au temps.";
|
|
|
+ texte = chrono->nomJoueur() + " a gagné la partie au temps.";
|
|
|
message.setText(texte);
|
|
|
message.setStandardButtons(QMessageBox::Ok);
|
|
|
message.exec();
|