str = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
!context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- universal_switch_auto_move_int = addMenuItem(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT"),
- str, autoMoveIntervalCb, true, context_->us_configuration.auto_move_int_state, autoMoveIntervalCheckboxCb);
- universal_switch_auto_move_int->userdata = this;
- elm_object_item_disabled_set(universal_switch_auto_move_int->item, (Eina_Bool)context_->us_configuration.auto_scan);
+
+ autoMoveInterval_ = genlist_->appendItem({"type1", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT", str,
+ [this](auto item)
+ {
+ setValuePage_ = std::make_unique<SetValuePage>(context_, ValueEditorType::NUMERIC_SWITCH, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT"));
+ setValuePage_->setSwitch(context_->us_configuration.auto_move_int_state);
+ setValuePage_->addValueChangedCb([this](auto val) {
+ this->autoMoveIntervalValueChangedCb(val);
+ });
+ setValuePage_->addSwitchChangedCb([this](auto state) {
+ this->autoMoveIntervalSwitchChangedCb(state);
+ });
+ setValuePage_->setDescription(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_MOVE_INT"));
+ setValuePage_->setRange(RANGE_MIN_AUTO_MOVE_INT, RANGE_MAX_AUTO_MOVE_INT, STEP_AUTO_MOVE_INT);
+ setValuePage_->setValue(context_->us_configuration.auto_move_int_value, "seconds");
+ },
+ [this](auto item)
+ {
+ context_->us_configuration.auto_move_int_state = item->getState();
+ auto str = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ item->setDescription(str);
+ item->update();
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, item->getState());
+ }, GenlistItem::WidgetType::toggle
+ });
+ if (context_->us_configuration.auto_move_int_state) {
+ autoMoveInterval_->setState(true);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.auto_tap_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ autoMoveInterval_->setDescription(str);
+ autoMoveInterval_->update();
+ }
+ if (context_->us_configuration.auto_scan)
+ autoMoveInterval_->disable();
addMenuItem(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD"),
_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD_SUB"), autoTapKBDMenuItemSelected, true, context_->us_configuration.auto_tap_kbd_state, autoTapKbdCheckboxCb);
updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_KBD_STATE, (bool *)&list_item->chk_status, NULL, NULL);
}
-void UniversalSwitchSettingsPage::autoMoveIntervalCb(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_AUTO_MOVE_INT"));
- self->setValuePage_->setSwitch(self->context_->us_configuration.auto_move_int_state);
- self->setValuePage_->addValueChangedCb([self](auto val) {
- self->autoMoveIntervalValueChangedCb(val);
- });
- self->setValuePage_->addSwitchChangedCb([self](auto state) {
- self->autoMoveIntervalSwitchChangedCb(state);
- });
- self->setValuePage_->setDescription(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_MOVE_INT"));
- self->setValuePage_->setRange(RANGE_MIN_AUTO_MOVE_INT, RANGE_MAX_AUTO_MOVE_INT, STEP_AUTO_MOVE_INT);
- self->setValuePage_->setValue(self->context_->us_configuration.auto_move_int_value, "seconds");
-}
-
void UniversalSwitchSettingsPage::autoMoveIntervalSwitchChangedCb(bool state)
{
context_->us_configuration.auto_move_int_state = state;
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, &state, NULL, NULL);
-
- universal_switch_auto_move_int->chk_status = state;
- elm_check_state_set(universal_switch_auto_move_int->eo_check, state);
- universal_switch_auto_move_int->sub_desc = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(universal_switch_auto_move_int->item);
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, state);
+ autoMoveInterval_->setState(state);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ autoMoveInterval_->setDescription(str);
+ autoMoveInterval_->update();
}
void UniversalSwitchSettingsPage::autoTapSwitchChangedCb(bool state)
elm_object_item_disabled_set(self->universal_switch_auto_scan_int->item, (Eina_Bool)!self->context_->us_configuration.auto_scan);
elm_object_item_disabled_set(self->universal_switch_scans_num->item, (Eina_Bool)!self->context_->us_configuration.auto_scan);
- if (self->context_->us_configuration.auto_scan)
+ if (self->context_->us_configuration.auto_scan) {
self->pauseOnFirst_->enable();
- else
+ self->autoMoveInterval_->disable();
+ } else {
self->pauseOnFirst_->disable();
-
- elm_object_item_disabled_set(self->universal_switch_auto_move_int->item, (Eina_Bool)self->context_->us_configuration.auto_scan);
+ self->autoMoveInterval_->enable();
+ }
updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_ENABLED, (bool *)&list_item->chk_status, NULL, NULL);
}
}
}
-void UniversalSwitchSettingsPage::autoMoveIntervalCheckboxCb(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.auto_move_int_state = list_item->chk_status;
-
- self->universal_switch_auto_move_int->sub_desc = getValueUnitText(NULL, &self->context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !self->context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(self->universal_switch_auto_move_int->item);
-
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, (bool *)&list_item->chk_status, NULL, NULL);
-}
-
void UniversalSwitchSettingsPage::autoMoveIntervalValueChangedCb(double value)
{
context_->us_configuration.auto_move_int_value = value;
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_VALUE, NULL, NULL, &value);
+ vconf_set_dbl(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_VALUE, value);
- universal_switch_auto_move_int->sub_desc = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
- !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- elm_genlist_item_update(universal_switch_auto_move_int->item);
+ auto str = getValueUnitText(NULL, &context_->us_configuration.auto_move_int_value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"),
+ !context_->us_configuration.auto_move_int_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
+ autoMoveInterval_->setDescription(str);
+ autoMoveInterval_->update();
}
void UniversalSwitchSettingsPage::onAutoScanItemSelection(void *data, Evas_Object *obj, void *event_info)
self->context_->us_configuration.auto_scan = list_item->chk_status;
elm_object_item_disabled_set(self->universal_switch_auto_scan_int->item, (Eina_Bool)!self->context_->us_configuration.auto_scan);
elm_object_item_disabled_set(self->universal_switch_scans_num->item, (Eina_Bool)!self->context_->us_configuration.auto_scan);
- if (self->context_->us_configuration.auto_scan)
+ if (self->context_->us_configuration.auto_scan) {
self->pauseOnFirst_->enable();
- else
+ self->autoMoveInterval_->disable();
+ } else {
self->pauseOnFirst_->disable();
- elm_object_item_disabled_set(self->universal_switch_auto_move_int->item, (Eina_Bool)self->context_->us_configuration.auto_scan);
+ self->autoMoveInterval_->enable();
+ }
updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_ENABLED, (bool *)&list_item->chk_status, NULL, NULL);
}