-
Notifications
You must be signed in to change notification settings - Fork 0
/
parametrage.cpp
80 lines (62 loc) · 1.67 KB
/
parametrage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/***************************************************************
* Name: parametrage.cpp
* Author: Samuel HENTRICS LOISTINE, Ahmed FAKHFAKH, Cédric ETCHEPARE
* Created: 2022-05-29
* Description : Permet le paramètrage du jeu
**************************************************************/
#include "parametrage.h"
#include "ui_parametrage.h"
#include <QMessageBox>
#include <QPushButton>
#include <QIntValidator>
///* ---- PARTIE VUE ---------------------------
Parametrage::Parametrage(QWidget *parent) :
QDialog(parent),
ui(new Ui::Parametrage)
{
ui->setupUi(this);
// Activation des connexions
QObject::connect(ui->leNom,SIGNAL(textChanged(const QString&)),this,SLOT(verifierNom()));
}
Parametrage::~Parametrage()
{
delete ui;
}
///* Setters
void Parametrage::setNom(QString nom){
ui->leNom->setText(nom);
}
void Parametrage::setPoints(unsigned int points){
ui->lePoints->setValue(points);
}
void Parametrage::setTemps(unsigned int temps){
ui->leTemps->setValue(temps);
}
///* Getters
QString Parametrage::getNom()
{
return ui->leNom->text();
}
unsigned int Parametrage::getPoints()
{
return ui->lePoints->value() ;
}
unsigned int Parametrage::getTemps()
{
return ui->leTemps->value() ;
}
///* Slots privés
void Parametrage::verifierNom()
{
QString nom = ui->leNom->text();
if (nom==""){
QMessageBox msgBox;
msgBox.setWindowTitle("Saisie Impossible");
msgBox.setText("Votre nom ne peut être vide.");
msgBox.exec();
ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true);
}
else{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}