README
[n9profile] / profil.cpp
1 #include "profil.h"
2
3
4 Profil::Profil(QString name)
5 {
6     m_name_of_profile = name;
7
8     list_of_profile_values.clear();
9
10     ringing_alert_tone.key = QString("ringing.alert.tone");
11     ringing_alert_tone.type = QString("SOUNDFILE");
12     list_of_profile_values.append(&ringing_alert_tone);
13
14     ringing_alert_type.key = QString("ringing.alert.type");
15     ringing_alert_type.type = QString("STRING \"Ringing\" \"Silent\"");
16     list_of_profile_values.append(&ringing_alert_type);
17
18     ringing_alert_volume.key = QString("ringing.alert.volume");
19     ringing_alert_volume.type = QString("INTEGER 0-100");
20     list_of_profile_values.append(&ringing_alert_volume);
21
22     calendar_alarm_enabled.key = QString("calendar.alarm.enabled");
23     calendar_alarm_enabled.type = QString("BOOLEAN");
24     list_of_profile_values.append(&calendar_alarm_enabled);
25
26     clock_alarm_enabled.key = QString("clock.alarm.enabled");
27     clock_alarm_enabled.type = QString("BOOLEAN");
28     list_of_profile_values.append(&clock_alarm_enabled);
29
30     email_alert_tone.key = QString("email.alert.tone");
31     email_alert_tone.type = QString("SOUNDFILE");
32     list_of_profile_values.append(&email_alert_tone);
33
34     email_alert_volume.key = QString("email.alert.volume");
35     email_alert_volume.type = QString("INTEGER 0-100");
36     list_of_profile_values.append(&email_alert_volume);
37
38     im_alert_tone.key = QString("im.alert.tone");
39     im_alert_tone.type = QString("SOUNDFILE");
40     list_of_profile_values.append(&im_alert_tone);
41
42     im_alert_volume.key = QString("im.alert.volume");
43     im_alert_volume.type = QString("INTEGER 0-100");
44     list_of_profile_values.append(&im_alert_volume);
45
46     keypad_sound_level.key = QString("keypad.sound.level");
47     keypad_sound_level.type = QString("INTEGER 0-2");
48     list_of_profile_values.append(&keypad_sound_level);
49
50
51
52
53     sms_alert_tone.key = QString("sms.alert.tone");
54     sms_alert_tone.type = QString("SOUNDFILE");
55     list_of_profile_values.append(&sms_alert_tone);
56
57     sms_alert_volume.key = QString("sms.alert.volume");
58     sms_alert_volume.type = QString("INTEGER 0-100");
59     list_of_profile_values.append(&sms_alert_volume);
60
61     system_sound_level.key = QString("system.sound.level");
62     system_sound_level.type = QString("INTEGER 0-2");
63     list_of_profile_values.append(&system_sound_level);
64
65     touchscreen_sound_level.key = QString("touchscreen.sound.level");
66     touchscreen_sound_level.type = QString("INTEGER 0-2");
67     list_of_profile_values.append(&touchscreen_sound_level);
68
69     vibrating_alert_enabled.key = QString("vibrating.alert.enabled");
70     vibrating_alert_enabled.type = QString("BOOLEAN");
71     list_of_profile_values.append(&vibrating_alert_enabled);
72 }
73
74 QList<ProfileValue* >* Profil::ListOfValues()
75 {
76     return &list_of_profile_values;
77 }
78
79 bool Profil::SetValue(QString key, QString value)
80 {
81     QList<ProfileValue *>* p_profile_values =  ListOfValues();
82
83     for (int i = 0; i < p_profile_values->size(); ++i) {
84         if(p_profile_values->at(i)->key == key )//kdyz je proměnná bool
85         {
86             p_profile_values->at(i)->value = QVariant(value);
87             return true;
88         }
89     }
90     return false;
91 }
92
93 QString Profil::GetName()
94 {
95     return m_name_of_profile;
96 }
97
98 void  Profil::SetName(QString name)
99 {
100     m_name_of_profile = name;
101 }
102
103 QVariant  Profil::GetCalendarAlarmEnabled()
104 {
105     return calendar_alarm_enabled.value;
106 }
107
108 QVariant  Profil::GetClockAlarmEnabled()
109 {
110     return clock_alarm_enabled.value;
111 }
112
113 QVariant  Profil::GetEmailAlertTone()
114 {
115     return email_alert_tone.value;
116 }
117
118 QVariant  Profil::GetEmailAlertVolume()
119 {
120     return email_alert_volume.value;
121 }
122
123 QVariant  Profil::GetImAlertTone()
124 {
125     return im_alert_tone.value;
126 }
127
128 QVariant  Profil::GetImAlertVolume()
129 {
130     return im_alert_volume.value;
131 }
132
133 QVariant  Profil::GetKeypadSoundLevel()
134 {
135     return keypad_sound_level.value;
136 }
137
138 QVariant  Profil::GetRingingAlertTone()
139 {
140     return ringing_alert_tone.value;
141 }
142
143 QVariant  Profil::GetRingingAlertType()
144 {
145     return ringing_alert_type.value;
146 }
147
148 QVariant  Profil::GetRingingAlertVolume()
149 {
150     return ringing_alert_volume.value;
151 }
152
153 QVariant  Profil::GetSmsAlertTone()
154 {
155     return sms_alert_tone.value;
156 }
157
158 QVariant  Profil::GetSmsAlertVolume()
159 {
160     return sms_alert_volume.value;
161 }
162
163 QVariant  Profil::GetSystemSoundLevel()
164 {
165     return system_sound_level.value;
166 }
167
168 QVariant  Profil::GetTouchscreenSoundLevel()
169 {
170     return touchscreen_sound_level.value;
171 }
172
173 QVariant  Profil::GetVibratingAlertEnabled()
174 {
175     return vibrating_alert_enabled.value;
176 }
177
178
179 void  Profil::SetCalendarAlarmEnabled(QVariant a)
180 {
181     calendar_alarm_enabled.value = a;
182 }
183
184 void  Profil::SetClockAlarmEnabled(QVariant a)
185 {
186     clock_alarm_enabled.value = a;
187 }
188
189 void  Profil::SetEmailAlertTone(QVariant a)
190 {
191     email_alert_tone.value = a;
192 }
193
194 void  Profil::SetEmailAlertVolume(QVariant a)
195 {
196     email_alert_volume.value = a;
197 }
198 void  Profil::SetImAlertTone(QVariant a)
199 {
200     im_alert_tone.value = a;
201 }
202
203 void  Profil::SetImAlertVolume(QVariant a)
204 {
205     im_alert_volume.value = a;
206 }
207
208 void  Profil::SetKeypadSoundLevel(QVariant a)
209 {
210     keypad_sound_level.value = a;
211 }
212
213 void  Profil::SetRingingAlertTone(QVariant a)
214 {
215     ringing_alert_tone.value = a;
216 }
217
218 void  Profil::SetRingingAlertType(QVariant a)
219 {
220     ringing_alert_type.value = a;
221 }
222
223 void  Profil::SetRingingAlertVolume(QVariant a)
224 {
225     ringing_alert_volume.value = a;
226 }
227
228 void  Profil::SetSmsAlertTone(QVariant a)
229 {
230     sms_alert_tone.value = a;
231 }
232
233 void  Profil::SetSmsAlertVolume(QVariant a )
234 {
235     sms_alert_volume.value = a;
236 }
237
238 void  Profil::SetSystemSoundLevel(QVariant a)
239 {
240     system_sound_level.value = a;
241 }
242 void Profil::SetTouchscreenSoundLevel(QVariant a)
243 {
244     touchscreen_sound_level.value = a;
245 }
246
247 void  Profil::SetVibratingAlertEnabled(QVariant a)
248 {
249     vibrating_alert_enabled.value = a;
250 }
251 Profil::~Profil()
252 {
253
254 }