Browse Source

Ménage et mini corrections

Francois Drouhard 6 years ago
parent
commit
c9e57d2440
3 changed files with 9 additions and 10 deletions
  1. 4 5
      Dialog.cpp
  2. 1 1
      Dialog.h
  3. 4 4
      MaFenetre.cpp

+ 4 - 5
Dialog.cpp

@@ -2,7 +2,6 @@
 #include "options.h"
 #include <QBoxLayout>
 #include <QLineEdit>
-//#include <QSpinBox>
 #include <QTimeEdit>
 #include <QTime>
 #include <QDialogButtonBox>
@@ -18,7 +17,7 @@ Dialog::Dialog(Options *option, QWidget *parent) :
     QVBoxLayout *layoutDialog     = new QVBoxLayout;
     QFormLayout *layoutForm       = new QFormLayout;
     QDialogButtonBox *boutonJouer = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-    checkBoxSon      = new QCheckBox();
+    checkBoxSon                   = new QCheckBox();
     checkBoxSon->setChecked(_option->son());
     spinTempsDepart               = new QTimeEdit;
     spinTempsDepart->setTime(_option->tempsDepart());
@@ -39,7 +38,7 @@ Dialog::Dialog(Options *option, QWidget *parent) :
     layoutDialog->addWidget(boutonJouer);
     setLayout(layoutDialog);
 
-    QObject::connect(boutonJouer , SIGNAL(accepted()) , this, SLOT(valider()));
+    QObject::connect(boutonJouer , SIGNAL(accepted()) , this, SLOT(accept()));
     QObject::connect(boutonJouer , SIGNAL(rejected()) , this, SLOT(close()));
 }
 
@@ -47,10 +46,10 @@ Dialog::~Dialog() {
 
 }
 
-void Dialog::valider() {
+void Dialog::accept() {
     _option->setNomJoueur1(joueur1LineEdit->text());
     _option->setNomJoueur2(joueur2LineEdit->text());
     _option->setTempsDepart(spinTempsDepart->time());
     _option->setSon(checkBoxSon->isChecked());
-    this->accept();
+    QDialog::accept();
 }

+ 1 - 1
Dialog.h

@@ -18,7 +18,7 @@ public:
 signals:
 
 public slots:
-    void valider();
+    void accept();
 
 private:
     Options  * _option;

+ 4 - 4
MaFenetre.cpp

@@ -58,10 +58,10 @@ MaFenetre::MaFenetre(Options* mesOptions) :
     ///////////////////////////// Menus ////////////////////////////
     QMenu *menuFichier = menuBar()->addMenu("&Fichier");
     QAction *actionNouveau = new QAction ("&Nouveau" , this);
-    QAction *actionChangerNom = new QAction ("&Options...", this);
+    QAction *actionOptions = new QAction ("&Options...", this);
     QAction *actionQuitter = new QAction ("&Quitter" , this);
     menuFichier->addAction(actionNouveau);
-    menuFichier->addAction(actionChangerNom);
+    menuFichier->addAction(actionOptions);
     menuFichier->addSeparator();
     menuFichier->addAction(actionQuitter);
 
@@ -98,7 +98,7 @@ MaFenetre::MaFenetre(Options* mesOptions) :
     QObject::connect (boutonInverser , SIGNAL(clicked()) , this , SLOT(inverser()));
     QObject::connect (boutonArreter , SIGNAL(clicked()), this, SLOT (arreter()));
     QObject::connect (actionNouveau, SIGNAL(triggered()) , this , SLOT(init()));
-    QObject::connect (actionChangerNom , SIGNAL(triggered()), this, SLOT(lancerDialogueOptions()));
+    QObject::connect (actionOptions , SIGNAL(triggered()), this, SLOT(lancerDialogueOptions()));
     QObject::connect (actionQuitter , SIGNAL(triggered()) , qApp , SLOT(quit()));
     QObject::connect (chrono1, SIGNAL(fin()), this, SLOT(arreter()));
     QObject::connect (chrono2, SIGNAL(fin()), this, SLOT(arreter()));
@@ -160,7 +160,7 @@ void MaFenetre::init () {
 }
 
 void MaFenetre::lancerDialogueOptions() {
-    Dialog dialog(option);
+    Dialog dialog (option);
     if (dialog.exec()) {
         chrono1->modifierNomJoueur(option->nomJoueur1());
         chrono1->definirTemps(option->tempsDepart());