-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormInteraction.cpp
121 lines (113 loc) · 2.46 KB
/
FormInteraction.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
* @file FormInteraction.cpp
* @class FormInteraction
* @brief Classe FormInteraction
* @author Bahous Mohamed Aymene
* @author Annane Mohamed
* @author Binome
* @date 16/12/2022
* Jalon final
*/
#include "FormInteraction.h"
#include "ui_FormInteraction.h"
FormInteraction::FormInteraction(QWidget *parent) :
QWidget(parent),
ui(new Ui::FormInteraction)
{
ui->setupUi(this);
ui->AjoutButton->setEnabled(false);
}
FormInteraction::~FormInteraction()
{
delete ui;
}
/**
*@fn on_AnnulerButton_clicked()
*@author Annane Mohamed
*@author Bahous Mohamed Aymene
*@brief permet de fermer le widget
*@return rien
*/
void FormInteraction::on_AnnulerButton_clicked()
{
this -> close();
}
/**
*@fn on_saveIButton_clicked()
*@author Annane Mohamed
*@author Bahous Mohamed Aymene
*@brief permet d'enregistrer l'interaction
*@return rien
*/
void FormInteraction::on_saveIButton_clicked()
{
I=new Interaction();
I->setContent(ui->titreEdit->text().toStdString());
emit envoyerInteraction(I);
ui->saveIButton->setEnabled(false);
ui->AjoutButton->setEnabled(true);
ui->m1Label->setText("Interaction ajouter avec succes");
}
/**
*@fn on_AjoutButton_clicked()
*@author Annane Mohamed
*@author Bahous Mohamed Aymene
*@brief permet d'ajouter l'interaction
*@return rien
*/
void FormInteraction::on_AjoutButton_clicked()
{
QString tache=ui->contenu->toPlainText();
string sx=tache.toStdString();
string todo;
string date;
bool verifd=false;
__SIZE_TYPE__ i=0; int nb=0;
while(nb<3 && i<sx.size())
{
if(sx[i]=='@')
{
nb++;
i=i+5;
}
else
{
if(nb==1)
{
todo+=sx[i];
}
if(nb==2)
{
date+=sx[i];
verifd=true;
}
}
i++;
}
if(verifd)
{
T=new Tache(todo,date);
}
else
{
T=new Tache(todo,I->getDI());
}
emit envoyerTache(T);
ui->contenu->clear();
ui->m2Label->setText("Tache ajouter avec succes");
}
/**
*@fn on_newIButton_clicked()
*@author Annane Mohamed
*@author Bahous Mohamed Aymene
*@brief permet de reinitialiser les champs d'ecriture dans le widget
*@return rien
*/
void FormInteraction::on_newIButton_clicked()
{
ui->AjoutButton->setEnabled(false);
ui->saveIButton->setEnabled(true);
ui->titreEdit->clear();
ui->m1Label->clear();
ui->m2Label->clear();
}