str = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
!context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- universal_switch_tap_duration = addMenuItem(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"),
- str, tapDurationCb, true, context_->us_configuration.tap_duration_state, tapDurationCheckboxCb);
- universal_switch_tap_duration->userdata = this;
+
+ tapDuration_ = genlist_->appendItem({"type1", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION", str,
+ [this](auto item)
+ {
+ setValuePage_ = std::make_unique<SetValuePage>(context_, ValueEditorType::NUMERIC_SWITCH, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"));
+ setValuePage_->setSwitch(context_->us_configuration.tap_duration_state);
+ setValuePage_->addValueChangedCb([this](auto val) {
+ this->tapDurationValueChangedCb(val);
+ });
+ setValuePage_->addSwitchChangedCb([this](auto state) {
+ this->tapDurationSwitchChangedCb(state);
+ });
+ setValuePage_->setDescription(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_TAP_DURATION"));
+ setValuePage_->setRange(RANGE_MIN_TAP_DURATION, RANGE_MAX_TAP_DURATION, STEP_TAP_DURATION);
+ setValuePage_->setValue(context_->us_configuration.tap_duration_value, "seconds");
+ },
+ [this](auto item)
+ {
+ context_->us_configuration.tap_duration_state = item->getState();
+ auto str = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ item->setDescription(str);
+ item->update();
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, item->getState());
+ }, GenlistItem::WidgetType::toggle
+ });
+
+ if (context_->us_configuration.tap_duration_state) {
+ tapDuration_->setState(true);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ tapDuration_->setDescription(str);
+ tapDuration_->update();
+ }
str = getValueUnitText(NULL, &context_->us_configuration.sgl_iaction_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
!context_->us_configuration.sgl_iaction_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_STATE, (bool *)&list_item->chk_status, NULL, NULL);
}
-void UniversalSwitchSettingsPage::tapDurationCb(void *data, Evas_Object *obj, void *event_info)
-{
- auto self = static_cast<UniversalSwitchSettingsPage *>(data);
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-
- self->setValuePage_ = std::make_unique<SetValuePage>(self->context_, ValueEditorType::NUMERIC_SWITCH, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"));
- self->setValuePage_->setSwitch(self->context_->us_configuration.tap_duration_state);
- self->setValuePage_->addValueChangedCb([self](auto val) {
- self->tapDurationValueChangedCb(val);
- });
- self->setValuePage_->addSwitchChangedCb([self](auto state) {
- self->tapDurationSwitchChangedCb(state);
- });
- self->setValuePage_->setDescription(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_TAP_DURATION"));
- self->setValuePage_->setRange(RANGE_MIN_TAP_DURATION, RANGE_MAX_TAP_DURATION, STEP_TAP_DURATION);
- self->setValuePage_->setValue(self->context_->us_configuration.tap_duration_value, "seconds");
-}
-
void UniversalSwitchSettingsPage::tapDurationSwitchChangedCb(bool state)
{
context_->us_configuration.tap_duration_state = state;
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, &state, NULL, NULL);
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, state);
- universal_switch_tap_duration->chk_status = state;
- elm_check_state_set(universal_switch_tap_duration->eo_check, state);
- universal_switch_tap_duration->sub_desc = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(universal_switch_tap_duration->item);
+ tapDuration_->setState(state);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ tapDuration_->setDescription(str);
+ tapDuration_->update();
}
void UniversalSwitchSettingsPage::tapDurationValueChangedCb(double value)
{
context_->us_configuration.tap_duration_value = value;
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_VALUE, NULL, NULL, &value);
-
- universal_switch_tap_duration->sub_desc = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(universal_switch_tap_duration->item);
-}
-
-void UniversalSwitchSettingsPage::tapDurationCheckboxCb(void *data, Evas_Object *obj, void *event_info)
-{
- retm_if(data == NULL, "Data parameter is NULL");
- auto list_item = static_cast<GenGroupItemData *>(data);
- auto self = static_cast<UniversalSwitchSettingsPage *>(list_item->userdata);
-
- list_item->chk_status = elm_check_state_get(obj);
- self->context_->us_configuration.tap_duration_state = list_item->chk_status;
-
- self->universal_switch_tap_duration->sub_desc = getValueUnitText(NULL, &self->context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !self->context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(self->universal_switch_tap_duration->item);
+ vconf_set_dbl(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_VALUE, value);
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, (bool *)&list_item->chk_status, NULL, NULL);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.tap_duration_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.tap_duration_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ tapDuration_->setDescription(str);
+ tapDuration_->update();
}
void UniversalSwitchSettingsPage::pauseOnFirstSwitchChangedCb(bool state)