N9profile
[n9profile] / profil.cpp
diff --git a/profil.cpp b/profil.cpp
new file mode 100644 (file)
index 0000000..342a2db
--- /dev/null
@@ -0,0 +1,254 @@
+#include "profil.h"
+
+
+Profil::Profil(QString name)
+{
+    m_name_of_profile = name;
+
+    list_of_profile_values.clear();
+
+    ringing_alert_tone.key = QString("ringing.alert.tone");
+    ringing_alert_tone.type = QString("SOUNDFILE");
+    list_of_profile_values.append(&ringing_alert_tone);
+
+    ringing_alert_type.key = QString("ringing.alert.type");
+    ringing_alert_type.type = QString("STRING \"Ringing\" \"Silent\"");
+    list_of_profile_values.append(&ringing_alert_type);
+
+    ringing_alert_volume.key = QString("ringing.alert.volume");
+    ringing_alert_volume.type = QString("INTEGER 0-100");
+    list_of_profile_values.append(&ringing_alert_volume);
+
+    calendar_alarm_enabled.key = QString("calendar.alarm.enabled");
+    calendar_alarm_enabled.type = QString("BOOLEAN");
+    list_of_profile_values.append(&calendar_alarm_enabled);
+
+    clock_alarm_enabled.key = QString("clock.alarm.enabled");
+    clock_alarm_enabled.type = QString("BOOLEAN");
+    list_of_profile_values.append(&clock_alarm_enabled);
+
+    email_alert_tone.key = QString("email.alert.tone");
+    email_alert_tone.type = QString("SOUNDFILE");
+    list_of_profile_values.append(&email_alert_tone);
+
+    email_alert_volume.key = QString("email.alert.volume");
+    email_alert_volume.type = QString("INTEGER 0-100");
+    list_of_profile_values.append(&email_alert_volume);
+
+    im_alert_tone.key = QString("im.alert.tone");
+    im_alert_tone.type = QString("SOUNDFILE");
+    list_of_profile_values.append(&im_alert_tone);
+
+    im_alert_volume.key = QString("im.alert.volume");
+    im_alert_volume.type = QString("INTEGER 0-100");
+    list_of_profile_values.append(&im_alert_volume);
+
+    keypad_sound_level.key = QString("keypad.sound.level");
+    keypad_sound_level.type = QString("INTEGER 0-2");
+    list_of_profile_values.append(&keypad_sound_level);
+
+
+
+
+    sms_alert_tone.key = QString("sms.alert.tone");
+    sms_alert_tone.type = QString("SOUNDFILE");
+    list_of_profile_values.append(&sms_alert_tone);
+
+    sms_alert_volume.key = QString("sms.alert.volume");
+    sms_alert_volume.type = QString("INTEGER 0-100");
+    list_of_profile_values.append(&sms_alert_volume);
+
+    system_sound_level.key = QString("system.sound.level");
+    system_sound_level.type = QString("INTEGER 0-2");
+    list_of_profile_values.append(&system_sound_level);
+
+    touchscreen_sound_level.key = QString("touchscreen.sound.level");
+    touchscreen_sound_level.type = QString("INTEGER 0-2");
+    list_of_profile_values.append(&touchscreen_sound_level);
+
+    vibrating_alert_enabled.key = QString("vibrating.alert.enabled");
+    vibrating_alert_enabled.type = QString("BOOLEAN");
+    list_of_profile_values.append(&vibrating_alert_enabled);
+}
+
+QList<ProfileValue* >* Profil::ListOfValues()
+{
+    return &list_of_profile_values;
+}
+
+bool Profil::SetValue(QString key, QString value)
+{
+    QList<ProfileValue *>* p_profile_values =  ListOfValues();
+
+    for (int i = 0; i < p_profile_values->size(); ++i) {
+        if(p_profile_values->at(i)->key == key )//kdyz je proměnná bool
+        {
+            p_profile_values->at(i)->value = QVariant(value);
+            return true;
+        }
+    }
+    return false;
+}
+
+QString Profil::GetName()
+{
+    return m_name_of_profile;
+}
+
+void  Profil::SetName(QString name)
+{
+    m_name_of_profile = name;
+}
+
+QVariant  Profil::GetCalendarAlarmEnabled()
+{
+    return calendar_alarm_enabled.value;
+}
+
+QVariant  Profil::GetClockAlarmEnabled()
+{
+    return clock_alarm_enabled.value;
+}
+
+QVariant  Profil::GetEmailAlertTone()
+{
+    return email_alert_tone.value;
+}
+
+QVariant  Profil::GetEmailAlertVolume()
+{
+    return email_alert_volume.value;
+}
+
+QVariant  Profil::GetImAlertTone()
+{
+    return im_alert_tone.value;
+}
+
+QVariant  Profil::GetImAlertVolume()
+{
+    return im_alert_volume.value;
+}
+
+QVariant  Profil::GetKeypadSoundLevel()
+{
+    return keypad_sound_level.value;
+}
+
+QVariant  Profil::GetRingingAlertTone()
+{
+    return ringing_alert_tone.value;
+}
+
+QVariant  Profil::GetRingingAlertType()
+{
+    return ringing_alert_type.value;
+}
+
+QVariant  Profil::GetRingingAlertVolume()
+{
+    return ringing_alert_volume.value;
+}
+
+QVariant  Profil::GetSmsAlertTone()
+{
+    return sms_alert_tone.value;
+}
+
+QVariant  Profil::GetSmsAlertVolume()
+{
+    return sms_alert_volume.value;
+}
+
+QVariant  Profil::GetSystemSoundLevel()
+{
+    return system_sound_level.value;
+}
+
+QVariant  Profil::GetTouchscreenSoundLevel()
+{
+    return touchscreen_sound_level.value;
+}
+
+QVariant  Profil::GetVibratingAlertEnabled()
+{
+    return vibrating_alert_enabled.value;
+}
+
+
+void  Profil::SetCalendarAlarmEnabled(QVariant a)
+{
+    calendar_alarm_enabled.value = a;
+}
+
+void  Profil::SetClockAlarmEnabled(QVariant a)
+{
+    clock_alarm_enabled.value = a;
+}
+
+void  Profil::SetEmailAlertTone(QVariant a)
+{
+    email_alert_tone.value = a;
+}
+
+void  Profil::SetEmailAlertVolume(QVariant a)
+{
+    email_alert_volume.value = a;
+}
+void  Profil::SetImAlertTone(QVariant a)
+{
+    im_alert_tone.value = a;
+}
+
+void  Profil::SetImAlertVolume(QVariant a)
+{
+    im_alert_volume.value = a;
+}
+
+void  Profil::SetKeypadSoundLevel(QVariant a)
+{
+    keypad_sound_level.value = a;
+}
+
+void  Profil::SetRingingAlertTone(QVariant a)
+{
+    ringing_alert_tone.value = a;
+}
+
+void  Profil::SetRingingAlertType(QVariant a)
+{
+    ringing_alert_type.value = a;
+}
+
+void  Profil::SetRingingAlertVolume(QVariant a)
+{
+    ringing_alert_volume.value = a;
+}
+
+void  Profil::SetSmsAlertTone(QVariant a)
+{
+    sms_alert_tone.value = a;
+}
+
+void  Profil::SetSmsAlertVolume(QVariant a )
+{
+    sms_alert_volume.value = a;
+}
+
+void  Profil::SetSystemSoundLevel(QVariant a)
+{
+    system_sound_level.value = a;
+}
+void Profil::SetTouchscreenSoundLevel(QVariant a)
+{
+    touchscreen_sound_level.value = a;
+}
+
+void  Profil::SetVibratingAlertEnabled(QVariant a)
+{
+    vibrating_alert_enabled.value = a;
+}
+Profil::~Profil()
+{
+
+}