-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroler.cpp
161 lines (106 loc) · 3.41 KB
/
controler.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include "controler.h"
controler::controler(Model *model): _model(model)
{
QObject::connect(_model,SIGNAL(newClick(int)),this,SLOT(AppendLine(int)));
}
void controler::displayResults(){
QMultiMap<int,long int> results;
results =_model->getMap();
QMultiMap<int,long int>::const_iterator i = results.find(1);
while (i != results.end() && i.key() == 1) {
qDebug() << i.value();
++i;
}
}
void controler::writeResults(){
QMultiMap<int,long int> results;
results =_model->getMap();
QMultiMap<int,long int>::const_iterator i1 = results.find(1);
QMultiMap<int,long int>::const_iterator i2 = results.find(2);
QMultiMap<int,long int>::const_iterator i3 = results.find(3);
QMultiMap<int,long int>::const_iterator i4 = results.find(4);
QMultiMap<int,long int>::const_iterator i5 = results.find(5);
QMultiMap<int,long int>::const_iterator i6 = results.find(6);
QFile outfile(QString("/home/ethel/qwt-5.2/test-ethel/Vigil_3G/clicks_results.txt"));
if (!outfile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
{
qDebug() << "Unable to create file";
return;
}
QTextStream stream(&outfile);
#if FIRST_TEST
stream << "Type bouton, temps(secondes)\n";
#endif
stream << "\nVIDEO";
stream << "\nCoupures: ";
while (i1 != results.end() && i1.key() == 1) {
stream << i1.value() <<",";
++i1;
}
stream << "\n";
stream << "Qualite Image: ";
while (i2 != results.end() && i2.key() == 2) {
stream << i2.value() <<",";
++i2;
}
stream << "\n";
stream << "Delai Voix: ";
while (i3 != results.end() && i3.key() == 3) {
stream << i3.value() <<",";
++i3;
}
stream << "\nAUDIO";
stream << "\nCoupures:";
while (i4 != results.end() && i4.key() == 4) {
stream << i4.value() <<",";
++i4;
}
stream << "\nEcho: ";
while (i5 != results.end() && i5.key() == 5) {
stream << i5.value() <<",";
++i5;
}
stream << "\nBruit:";
while (i6 != results.end() && i6.key() == 6) {
stream << i6.value() <<",";
++i6;
}
stream << "\n --- Test suivant --- \n";
outfile.close();
}
void controler::quitMyApp(){
//writeResults();
QFile outfile(QString("/home/ethel/qwt-5.2/test-ethel/Vigil_3G/clicks_results.txt"));
if (!outfile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
{
qDebug() << "Unable to create file";
return;
}
QTextStream stream(&outfile);
stream << "--------------Test suivant---------------\n";
outfile.close();
}
void controler::AppendLine(int nbutton){
QMultiMap<int,long int> results;
results =_model->getMap();
QMultiMap<int,long int>::const_iterator i = results.find(nbutton);
QFile outfile(QString("/home/ethel/qwt-5.2/test-ethel/Vigil_3G/clicks_results.txt"));
#if WINDOWS_OS
// QFile outfile(QString("C:\Temp\clicks_results.txt"));
outfile.setFileName("C:\Temp\clicks_results.txt");
#endif
if (!outfile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
{
qDebug() << "Unable to create file";
return;
}
QString type;
if(nbutton <=3){
type ="VIDEO";
}else{
type ="AUDIO";
}
QTextStream stream(&outfile);
stream << i.value();
stream << "," << type << "," << nbutton <<"\n";
}