itemPtr->genlist_ = this;
itemPtr->objItem_ = elm_genlist_item_append(uniqueObj_.get(), itc.get(), itemPtr.get(), parentPtr, type, GenlistItem::onItemSelection, itemPtr.get());
- if (!itemPtr->onSelection_)
+ if (!itemPtr->onItemSelection_)
elm_genlist_item_select_mode_set(itemPtr->objItem_, ELM_OBJECT_SELECT_MODE_NONE);
items_.push_back(std::move(itemPtr));
: style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), type_(type)
{}
-GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, Type type)
- : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onSelection_(std::move(onSelection)), type_(type)
+GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onItemSelection, Type type)
+ : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onItemSelection_(std::move(onItemSelection)), type_(type)
{}
-GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, WidgetType type)
- : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onSelection_(std::move(onSelection)), widgetType_(type)
+GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onItemSelection, WidgetType type)
+ : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onItemSelection_(std::move(onItemSelection)), widgetType_(type)
{}
-GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, std::string iconPath, WidgetType type)
- : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onSelection_(std::move(onSelection)), iconPath_(std::move(iconPath)), widgetType_(type)
+GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onItemSelection, std::string iconPath, WidgetType type)
+ : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onItemSelection_(std::move(onItemSelection)), iconPath_(std::move(iconPath)), widgetType_(type)
+{}
+
+GenlistItem::GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onItemSelection, std::function<void(GenlistItem *)> onContentSelection, WidgetType type)
+ : style_(std::move(style)), text_(std::move(text)), description_(std::move(desc)), onItemSelection_(std::move(onItemSelection)), onContentSelection_(std::move(onContentSelection)), widgetType_(type)
{}
void GenlistItem::setText(const TranslatedString &text)
elm_atspi_accessible_relationship_append(objItem_, ELM_ATSPI_RELATION_CONTROLLER_FOR, check->getObject());
check->setEvasSmartCallback("changed", [this]() {
- onSelection_(this);
+ if (onContentSelection_)
+ onContentSelection_(this);
+ else
+ onItemSelection_(this);
});
return check->getObject();
check->setPassEvents(true);
check->setEvasSmartCallback("changed", [this]() {
- SETTING_TRACE_ERROR("smart callback \"changed\"");
- onSelection_(this);
+ if (onContentSelection_)
+ onContentSelection_(this);
+ else
+ onItemSelection_(this);
});
return check->getObject();
SETTING_TRACE_ERROR(".");
auto self = static_cast<GenlistItem *>(data);
- if (self->widgetType_ == WidgetType::toggle || self->widgetType_ == WidgetType::check) {
+ if ((self->widgetType_ == WidgetType::toggle || self->widgetType_ == WidgetType::check) && !self->onContentSelection_) {
self->state_ = !self->state_;
elm_genlist_item_fields_update(self->objItem_, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
}
- if (self->onSelection_)
- self->onSelection_(self);
+ if (self->onItemSelection_)
+ self->onItemSelection_(self);
elm_genlist_item_selected_set(self->objItem_, EINA_FALSE);
}
\ No newline at end of file
GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, Type type = Type::regular);
GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, WidgetType type);
GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onSelection, std::string iconPath, WidgetType type = WidgetType::icon);
+ GenlistItem(std::string style, TranslatedString text, TranslatedString desc, std::function<void(GenlistItem *)> onItemSelection, std::function<void(GenlistItem *)> onWidgetSelection, WidgetType type);
void setText(const TranslatedString &text);
void setDescription(const TranslatedString &desc);
std::string style_;
TranslatedString text_;
TranslatedString description_;
- std::function<void(GenlistItem *)> onSelection_;
+ std::function<void(GenlistItem *)> onItemSelection_;
+ std::function<void(GenlistItem *)> onContentSelection_;
Genlist *genlist_ = nullptr;
Eina_Bool state_ = EINA_FALSE;
std::string iconPath_;
str = getBoleanText(context_->us_configuration.feedback_voice_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON"),
_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- universal_switch_feedback_voice = addMenuItem(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE"),
- str, feedbackVoiceCb, true, context_->us_configuration.feedback_voice_state, feedbackVoiceCheckboxCb);
- universal_switch_feedback_voice->userdata = this;
- vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, syncVoiceFeedbackWithVconf, universal_switch_feedback_voice);
- if (vconf_ret)
- SETTING_TRACE_ERROR("FAIL: vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE)");
+
+ universal_switch_feedback_voice = genlist_->appendItem({"type1", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE", str,
+ [this](auto item)
+ {
+ feedbackVoiceCb(this, nullptr, nullptr);
+ },
+ [this](auto item)
+ {
+ if (context_) {
+ context_->us_configuration.feedback_voice_state = item->getState();
+
+ item->setDescription(context_->us_configuration.feedback_voice_state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
+ item->update();
+ }
+
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, item->getState());
+ }, GenlistItem::WidgetType::toggle
+ });
+ universal_switch_feedback_voice->setState(context_->us_configuration.feedback_voice_state);
}
void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
self->nestedSetValuePage_->setSwitch(self->context_->us_configuration.feedback_voice_state);
self->nestedSetValuePage_->setDescription(_("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_VOICE"));
self->nestedSetValuePage_->addSwitchChangedCb([self](auto state) {
- self->feedbackVoiceSwitchChangedCb(state);
+ self->universal_switch_feedback_voice->setDescription(state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
+ self->universal_switch_feedback_voice->setState(state);
+ self->universal_switch_feedback_voice->update();
+ self->context_->us_configuration.feedback_voice_state = state;
+ vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, state);
});;
int vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, SetValuePage::syncPageWithVconf, self->nestedSetValuePage_.get());
if (vconf_ret)
elm_genlist_item_update(universal_switch_feedback_voice_speech_rate->item);
}
-void UniversalSwitchSettingsPage::feedbackVoiceSwitchChangedCb(bool state)
-{
- const char *str = NULL;
-
- context_->us_configuration.feedback_voice_state = state;
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, &state, NULL, NULL);
-
- if (context_->us_configuration.feedback_voice_state)
- str = _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON");
- else
- str = _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-
- universal_switch_feedback_voice->chk_status = state;
- elm_check_state_set(universal_switch_feedback_voice->eo_check, state);
- universal_switch_feedback_voice->sub_desc = str ? str : std::string{};
- elm_genlist_item_update(universal_switch_feedback_voice->item);
-}
-
-void UniversalSwitchSettingsPage::feedbackVoiceCheckboxCb(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);
-
- if (self->context_) {
- self->context_->us_configuration.feedback_voice_state = list_item->chk_status;
-
- const char *str = getBoleanText(self->context_->us_configuration.feedback_voice_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON"),
- _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
- self->universal_switch_feedback_voice->sub_desc = str ? str : std::string{};
- elm_genlist_item_update(self->universal_switch_feedback_voice->item);
- }
-
- updateVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, (bool *)&list_item->chk_status, NULL, NULL);
-}
-
void UniversalSwitchSettingsPage::feedbackSoundCb(void *data, Evas_Object *obj, void *event_info)
{
auto self = static_cast<UniversalSwitchSettingsPage *>(data);
retv_if(ad == NULL, EINA_TRUE);
vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_ENABLED, syncAutoScanWithVconf);
vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND_STATE, syncSoundFeedbackWithVconf);
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE, syncVoiceFeedbackWithVconf);
-
return EINA_TRUE;
}
elm_naviframe_item_pop(ad->md.getNaviframe()->getObject());
}
-void UniversalSwitchSettingsPage::syncVoiceFeedbackWithVconf(keynode_t *node, void *user_data)
-{
- syncCheckboxWithVconf(node, user_data, feedbackVoiceCheckboxCb);
-}
-
void UniversalSwitchSettingsPage::syncSoundFeedbackWithVconf(keynode_t *node, void *user_data)
{
syncCheckboxWithVconf(node, user_data, feedbackSoundCheckboxCb);
void feedbackVoiceItemOptionsRequestCb(int option_id);
void feedbackVoiceSpeechVolumeChangedCb(int item_id);
void feedbackVoiceSpeechRateChangedCb(int item_id);
- void feedbackVoiceSwitchChangedCb(bool state);
- static void feedbackVoiceCheckboxCb(void *data, Evas_Object *obj, void *event_info);
static void feedbackSoundCb(void *data, Evas_Object *obj, void *event_info);
void feedbackSoundItemOptionsRequestCb(int option_id);
void feedbackSoundVolumeChangedCb(int item_id);
static void ctxPopupDelCb(void *data, Evas_Object *obj, void *event_info);
static Eina_Bool naviframPopCb(void *data, Elm_Object_Item *it);
static void backCb(void *data, Evas_Object *obj, void *event_info);
- static void syncVoiceFeedbackWithVconf(keynode_t *node, void *user_data);
static void syncSoundFeedbackWithVconf(keynode_t *node, void *user_data);
static void syncAutoScanWithVconf(keynode_t *node, void *user_data);
static void syncCheckboxWithVconf(keynode_t *node, void *user_data, SettingCallback cb_func);
GenGroupItemData *universal_switch_feedback_cursor_cl;
GenGroupItemData *universal_switch_feedback_sound_volume;
GenGroupItemData *universal_switch_feedback_sound;
- GenGroupItemData *universal_switch_feedback_voice;
+ GenlistItem *universal_switch_feedback_voice;
GenGroupItemData *universal_switch_feedback_voice_speech_rate;
GenGroupItemData *universal_switch_feedback_voice_speech_volume;
GenGroupItemData *universal_switch_auto_move_int;