This repository was archived by the owner on Aug 13, 2018. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodifiersaison.cpp
More file actions
Latest commit
60 lines (54 loc) · 1.23 KB
/
Copy pathmodifiersaison.cpp
File metadata and controls
60 lines (54 loc) · 1.23 KB
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
#include"modifiersaison.h"
#include"ui_modifiersaison.h"
ModifierSaison::ModifierSaison(QWidget *parent) :
QDialog(parent),
ui(new Ui::ModifierSaison),
b(0),sai(NULL)
{
ui->setupUi(this);
this->connect();
}
ModifierSaison::ModifierSaison(Saison& s, QWidget *parent) :
QDialog(parent),
ui(new Ui::ModifierSaison),
b(1),sai(&s)
{
ui->setupUi(this);
ui->Nom->setText(sai->getNom());
ui->Nom->setDisabled(1);
ui->Description->setText(sai->getDescription());
this->connect();
}
voidModifierSaison::connect()
{
QObject::connect(ui->Valider, SIGNAL(clicked()), this, SLOT(ok()) );
QObject::connect(ui->Annuler, SIGNAL(clicked()), this, SLOT(cancel()) );
}
voidModifierSaison::ok()
{
try
{
if(b)
{
sai->setDescription(ui->Description->toPlainText());
}
else
{
sai=newSaison(ui->Nom->text().toStdString(), ui->Description->toPlainText().toStdString());
delete sai;
}
this->close();
}
catch(std::exception& e)
{
QMessageBox::warning(this, "Erreur", e.what());
}
}
voidModifierSaison::cancel()
{
this->close();
}
ModifierSaison::~ModifierSaison()
{
delete ui;
}