Replace char* with std::string 77/202677/10
authorTomasz Jeschke <t.jeschke@samsung.com>
Mon, 1 Apr 2019 14:09:58 +0000 (16:09 +0200)
committerTomasz Jeschke <t.jeschke@samsung.com>
Mon, 8 Apr 2019 11:35:57 +0000 (13:35 +0200)
Change-Id: I010b789017cd8ee68d6f370f9d7833716a04ccd7

17 files changed:
src/AccessoriesSwitchesPage.cpp
src/AccessoriesSwitchesPage.hpp
src/AddSwitchPage.cpp
src/SetValuePage.cpp
src/SetValuePage.hpp
src/SwitchesPage.cpp
src/UniversalSwitchPage.cpp
src/UniversalSwitchSettingsPage.cpp
src/UniversalSwitchSettingsPage.hpp
src/UpdateSwitchPage.cpp
src/UpdateSwitchPage.hpp
src/VConf.cpp
src/Widget.hpp
src/setting-accessibility-universal-switch-dbus.cpp
src/setting-accessibility-universal-switch-dbus.h
src/setting-accessibility.h
src/utils.hpp

index 29d03c7925929e89ef8f8dba8a2072e169c02be6..95098fb12d10a6d4fff0b4d559bc1113d6620ed5 100644 (file)
@@ -50,14 +50,15 @@ void AccessoriesSwitchesPage::attachActionCallback(UniversalSwitchCb cb, void *c
        accessories_switch_added_cb_data = cbData;
 }
 
-void AccessoriesSwitchesPage::captureSwitchCb(void *user_data, const char *switch_id)
+void AccessoriesSwitchesPage::captureSwitchCb(void *user_data, const std::string &switch_id)
 {
-       RETURN_IF(!user_data, "Input argument is NULL");
-       RETURN_IF(!switch_id, "switch_id is NULL");
+       RETURN_IF(!user_data, "Input argument user_data is NULL");
+       RETURN_IF(switch_id.empty(), "Input argument switch_id is an empty string");
+
        auto self = static_cast<AccessoriesSwitchesPage *>(user_data);
 
        for (auto &it : self->context_.config.configuration_items) {
-               if (strlen(switch_id) == it->switch_id.size() && strncmp(switch_id, it->switch_id.c_str(), strlen(switch_id)) == 0) {
+               if (switch_id == it->switch_id) {
                        self->alreadyMappedSwitchPopup();
                        return;
                }
index 7638f847944f7c2d9ea7af1d33d56612d416541d..4d2ccb7b1ddd19667f526aa550e0e3a3462285ea 100644 (file)
@@ -38,7 +38,7 @@ class AccessoriesSwitchesPage
        void attachActionCallback(UniversalSwitchCb cb, void *cbData);
 
        private:
-       static void captureSwitchCb(void *user_data, const char *switch_id);
+       static void captureSwitchCb(void *user_data, const std::string &switch_id);
        static void accessorySwitchActionCb(const std::string &action, void *user_data);
        static Eina_Bool renewCaptureSwitchCb(void *data, Elm_Object_Item *it);
        void alreadyMappedSwitchPopup(); // TODO rename
index 70148ec5b6247e5f13a754f1aaba96e5118b2f3a..71804b5cace6e4f2cc4b93e063760a337de65614 100644 (file)
@@ -57,10 +57,11 @@ void AddSwitchPage::attachCallbackOnSwitchAttach(UniversalSwitchCb cb, void *cbD
 }
 
 void AddSwitchPage::disableSwitchProviderWhenAllSwitchesConfigured(
-       UniversalSwitchSwitchProvider *switchProvider, GenlistItem *switchProviderView)
+       UniversalSwitchSwitchProvider *switchProvider,
+       GenlistItem *switchProviderView)
 {
        auto allSwitches = setting_accessibility_universal_switch_dbus_config_get_switches(
-               &context_.config, switchProvider->info->id.c_str());
+               &context_.config, switchProvider->info->id);
        if (areAllSwitchesConfigured(context_.config.configuration_items, allSwitches))
                switchProviderView->disable();
 }
index fe3bc65984de4c418892601d8ebde77802e90ff6..f38ffc532d214171fb3b7b07c2c28ad6f13aa274 100644 (file)
 #include <sstream>
 
 #define EDJ_SET_VALUE "edje/accessibility-settings-set-value.edj"
-#define GRP_SET_VALUE_NUMERIC "set-value-numeric"
-#define GRP_SET_VALUE_NUMERIC_SWITCH "set-value-numeric-switch"
-#define GRP_SET_VALUE_SWITCHES "set-value-switches"
-#define GRP_SET_VALUE_LIST_SWITCH "set-value-list-switch"
-#define PRT_SET_VALUE_LIST "set-value-list"
-#define PRT_SET_VALUE_SWITCH_LABEL "set-value-switch-label"
-#define PRT_SET_VALUE_SWITCH "set-value-switch"
-#define PRT_SET_VALUE_VALUE "set-value-value"
-#define PRT_SET_VALUE_SELECTOR "set-value-selector"
-#define PRT_SET_VALUE_RANGE "set-value-range"
-#define PRT_SET_VALUE_DESC "set-value-desc"
-
-SetValuePage::SetValuePage(ValueEditorType type, const char *title, NaviframeItem targetItem)
+
+SetValuePage::SetValuePage(ValueEditorType type, TranslatedString title, NaviframeItem targetItem)
        : context_(Singleton<AppContext>::instance()), naviframeItem_(targetItem)
 {
-       const char *layout_grp = NULL;
-       RETURN_IF(!title, "Title parameter is NULL");
+       auto layoutGroup = std::string{};
+       RETURN_IF(title.empty(), "Title parameter is NULL");
 
        switch (type) {
        case ValueEditorType::NUMERIC:
-               layout_grp = GRP_SET_VALUE_NUMERIC;
+               layoutGroup = "set-value-numeric";
                break;
        case ValueEditorType::NUMERIC_SWITCH:
-               layout_grp = GRP_SET_VALUE_NUMERIC_SWITCH;
+               layoutGroup = "set-value-numeric-switch";
                break;
        case ValueEditorType::RADIOS:
        case ValueEditorType::SWITCHES:
-               layout_grp = GRP_SET_VALUE_SWITCHES;
+               layoutGroup = "set-value-switches";
                break;
        case ValueEditorType::LIST_SWITCH:
-               layout_grp = GRP_SET_VALUE_LIST_SWITCH;
+               layoutGroup = "set-value-list-switch";
                break;
        default:
-               layout_grp = GRP_SET_VALUE_NUMERIC;
-               DEBUG("Unrecognized layout type!");
+               layoutGroup = "set-value-numeric";
+               ERROR("Unrecognized layout type");
        }
        auto naviframe = context_.getNaviframe();
-       layout_ = createLayout(naviframe, layout_grp);
+       layout_ = createLayout(naviframe, layoutGroup);
 
        switch (type) {
        case ValueEditorType::NUMERIC:
@@ -73,18 +62,18 @@ SetValuePage::SetValuePage(ValueEditorType type, const char *title, NaviframeIte
        case ValueEditorType::NUMERIC_SWITCH:
                createScroller();
                check_ = Widget::make<Check>(layout_, false, "on&off", [this]() { checkStateChangedCb(); });
-               layout_->setPartContent(PRT_SET_VALUE_SWITCH, check_);
+               layout_->setPartContent("set-value-switch", check_);
                check_->setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                break;
        case ValueEditorType::RADIOS:
-               genlist_ = createGenlist(layout_, NULL);
+               genlist_ = createGenlist(layout_, {});
                break;
        case ValueEditorType::SWITCHES:
-               genlist_ = createGenlist(layout_, NULL);
+               genlist_ = createGenlist(layout_, {});
                break;
        case ValueEditorType::LIST_SWITCH:
                check_ = Widget::make<Check>(layout_, false, "on&off", [this]() { checkStateChangedCb(); });
-               layout_->setPartContent(PRT_SET_VALUE_SWITCH, check_);
+               layout_->setPartContent("set-value-switch", check_);
                check_->setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                genlist_ = createGenlist(layout_, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_OPTIONS"));
                break;
@@ -95,7 +84,7 @@ SetValuePage::SetValuePage(ValueEditorType type, const char *title, NaviframeIte
        auto prevBtn = Widget::make<Button>(
                naviframe, [naviframe]() { naviframe->popBack(); }, std::string{}, Button::BACK_BUTTON_ARROW_STYLE);
 
-       naviframe->pushBack(title,
+       naviframe->pushBack(std::move(title),
                layout_,
                [this]() {
                        vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE,
@@ -117,9 +106,9 @@ SetValuePage::SetValuePage(ValueEditorType type, const char *title, NaviframeIte
                prevBtn);
 }
 
-void SetValuePage::setDescription(const char *description)
+void SetValuePage::setDescription(const std::string &description)
 {
-       layout_->setPartText(PRT_SET_VALUE_DESC, description);
+       layout_->setPartText("set-value-desc", description);
 }
 
 void SetValuePage::setRange(double min, double max, double step)
@@ -157,7 +146,7 @@ void SetValuePage::setRange(double min, double max, double step)
 
        out << std::fixed << "Accepted range: " << min << " to " << max; // TODO translation
 
-       layout_->setPartText(PRT_SET_VALUE_RANGE, out.str());
+       layout_->setPartText("set-value-range", out.str());
 }
 
 void SetValuePage::setValue(double value, const std::string &units)
@@ -176,9 +165,9 @@ void SetValuePage::setSwitch(bool state)
        check_->setState(state);
 
        if (state)
-               layout_->setPartText(PRT_SET_VALUE_SWITCH_LABEL, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON");
+               layout_->setPartText("set-value-switch-label", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON");
        else
-               layout_->setPartText(PRT_SET_VALUE_SWITCH_LABEL, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
+               layout_->setPartText("set-value-switch-label", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
 }
 
 void SetValuePage::addRadioItem(const std::string &caption, int id, bool selected)
@@ -193,7 +182,7 @@ void SetValuePage::addRadioItem(const std::string &caption, int id, bool selecte
        item->setId(id);
 }
 
-GenlistItem *SetValuePage::addRadioListItem(const char *main_text, const char *sub_text, int option_id)
+GenlistItem *SetValuePage::addRadioListItem(const std::string &main_text, const std::string &sub_text, int option_id)
 {
        auto opt_item = new OptionsItem;
        opt_item->self = this;
@@ -253,7 +242,7 @@ void SetValuePage::callRadioItemChangeCbAndPopNaviframe(GenlistItem *item)
        context_.getNaviframe()->popBack(naviframeItem_);
 }
 
-Genlist *SetValuePage::createGenlist(Widget *parent, const char *title)
+Genlist *SetValuePage::createGenlist(Widget *parent, TranslatedString title)
 {
        RETURN_DEFAULT_IF(!parent, "Input parameter is nullptr");
 
@@ -261,10 +250,10 @@ Genlist *SetValuePage::createGenlist(Widget *parent, const char *title)
        genlist->setMode(ELM_LIST_COMPRESS);
        genlist->setStyle("dialogue");
 
-       if (title)
-               genlist->appendItem({"group_index", title});
+       if (!title.empty())
+               genlist->appendItem({"group_index", std::move(title)});
 
-       parent->setPartContent(PRT_SET_VALUE_LIST, genlist);
+       parent->setPartContent("set-value-list", genlist);
 
        return genlist;
 }
@@ -277,7 +266,7 @@ void SetValuePage::createScroller()
        scroller_->blockScrolling(ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL);
        scroller_->setRelativeSize(1.0, 0.2);
        scroller_->setPageScrollLimit(1, 1);
-       layout_->setPartContent(PRT_SET_VALUE_SELECTOR, scroller_);
+       layout_->setPartContent("set-value-selector", scroller_);
        box_ = Widget::make<Box>(scroller_);
        box_->setHomogeneousDimensions();
        box_->setAlignHint(0.0, 0.0);
@@ -288,16 +277,13 @@ void SetValuePage::createScroller()
        });
 }
 
-Layout *SetValuePage::createLayout(Widget *parent, const std::string &layout_grp)
+Layout *SetValuePage::createLayout(Widget *parent, const std::string &layoutGroup)
 {
-       char *res_path = app_get_resource_path();
-       std::string edj_path;
-       if (res_path) {
-               edj_path = std::string{res_path} + std::string{EDJ_SET_VALUE};
-               free(res_path);
-       }
+       auto resPath = std::string{app_get_resource_path()};
+       auto edjPath = resPath + "edje/accessibility-settings-set-value.edj";
+
        auto layout = Widget::make<Layout>(parent);
-       layout->setFile(edj_path, layout_grp);
+       layout->setFile(edjPath, layoutGroup);
        layout->setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        return layout;
@@ -313,7 +299,7 @@ void SetValuePage::displayValue(double value)
 
        out << std::fixed << value << " " << units_; // TODO translation
 
-       layout_->setPartText(PRT_SET_VALUE_VALUE, out.str());
+       layout_->setPartText("set-value-value", out.str());
 }
 
 void SetValuePage::checkStateChangedCb()
@@ -321,9 +307,9 @@ void SetValuePage::checkStateChangedCb()
        auto state = check_->getState();
 
        if (state)
-               layout_->setPartText(PRT_SET_VALUE_SWITCH_LABEL, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON");
+               layout_->setPartText("set-value-switch-label", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON");
        else
-               layout_->setPartText(PRT_SET_VALUE_SWITCH_LABEL, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
+               layout_->setPartText("set-value-switch-label", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
 
        if (genlist_) {
                Elm_Object_Item *item = elm_genlist_first_item_get(genlist_->getObject());
index 16546a5dcc3d99935b114711e0e68a17f425abff..ea277fafbb5b6dc1639dcd9af1042ca85daf5c89 100644 (file)
@@ -53,13 +53,13 @@ using RequestListItemOptionsCb = std::function<void(int)>;
 class SetValuePage
 {
        public:
-       SetValuePage(ValueEditorType type, const char *title, NaviframeItem targetItem = {});
-       void setDescription(const char *description);
+       SetValuePage(ValueEditorType type, TranslatedString title, NaviframeItem targetItem = {});
+       void setDescription(const std::string &description);
        void setRange(double min, double max, double step);
        void setValue(double value, const std::string &units);
        void setSwitch(bool state);
        void addRadioItem(const std::string &caption, int id, bool selected);
-       GenlistItem *addRadioListItem(const char *main_text, const char *sub_text, int option_id);
+       GenlistItem *addRadioListItem(const std::string &main_text, const std::string &sub_text, int option_id);
        void addValueChangedCb(ChangeValueCb cb);
        void addSwitchChangedCb(ChangeSwitchCb cb);
        void addRadioItemChangedCb(ChangeRadioItemCb cb);
@@ -68,9 +68,9 @@ class SetValuePage
 
        private:
        void callRadioItemChangeCbAndPopNaviframe(GenlistItem *item);
-       Genlist *createGenlist(Widget *parent, const char *title);
+       Genlist *createGenlist(Widget *parent, TranslatedString title);
        void createScroller();
-       Layout *createLayout(Widget *parent, const std::string &layout_grp);
+       Layout *createLayout(Widget *parent, const std::string &layoutGroup);
        void displayValue(double value);
        void checkStateChangedCb();
        static void backCb(void *data, Evas_Object *obj, void *event_info);
index 7e1db03dca1058ec309be43e760410bd38e5b002..404d61308989f31821c2ef43213eaa0cf5da2876 100644 (file)
@@ -93,36 +93,45 @@ void SwitchesPage::createSwitchesGroup()
 }
 
 void SwitchesPage::switchUpdatedCb(
-       void *data, const std::string &switch_id, const std::string &switch_action, const std::string &switch_name)
+       void *data,
+       const std::string &switch_id,
+       const std::string &switch_action,
+       const std::string &switch_name)
 {
        RETURN_IF(!data, "Input parameter is NULL");
        auto self = static_cast<SwitchesPage *>(data);
 
        DEBUG("Switch updated, id: %s, name: %s, action: %s.", switch_id.c_str(), switch_name.c_str(), switch_action.c_str());
        setting_accessibility_universal_switch_dbus_config_updateSwitchConfigurationItem(
-               &self->context_.config, switch_id.c_str(), switch_name.c_str(), switch_action.c_str());
+               &self->context_.config, switch_id, switch_name, switch_action);
        self->updateSwitchesList();
 }
 
 void SwitchesPage::switchRemovedCb(
-       void *data, const std::string &switch_id, const std::string &switch_action, const std::string &switch_name)
+       void *data,
+       const std::string &switch_id,
+       const std::string &switch_action,
+       const std::string &switch_name)
 {
        RETURN_IF(!data, "Input parameter is NULL");
        auto self = static_cast<SwitchesPage *>(data);
 
        DEBUG("Switch removed, name: %s, id: %s, action: %s.", switch_name.c_str(), switch_id.c_str(), switch_action.c_str());
-       setting_accessibility_universal_switch_dbus_config_removeSwitchConfigurationItem(&self->context_.config, switch_id.c_str());
+       setting_accessibility_universal_switch_dbus_config_removeSwitchConfigurationItem(&self->context_.config, switch_id);
        self->updateSwitchesList();
 }
 
 void SwitchesPage::addSwitchCb(
-       void *data, const std::string &switch_id, const std::string &switch_action, const std::string &switch_name)
+       void *data,
+       const std::string &switch_id,
+       const std::string &switch_action,
+       const std::string &switch_name)
 {
        RETURN_IF(!data, "Input parameter is NULL");
        auto self = static_cast<SwitchesPage *>(data);
 
        DEBUG("Add switch, id: %s, name: %s, action: %s.", switch_id.c_str(), switch_name.c_str(), switch_action.c_str());
        setting_accessibility_universal_switch_dbus_config_addSwitchConfigurationItem(
-               &self->context_.config, switch_id.c_str(), switch_name.c_str(), switch_action.c_str());
+               &self->context_.config, switch_id, switch_name, switch_action);
        self->updateSwitchesList();
 }
\ No newline at end of file
index 7702787a5f8aa00c08f0467fdee33f5072e3f413..2b5d70424e25d1b721f56f599d3b16320e30a353 100644 (file)
@@ -113,13 +113,16 @@ void UniversalSwitchPage::displayAddSwitchPopup()
 }
 
 void UniversalSwitchPage::onNewSwitchAddition(
-       void *data, const std::string &switch_id, const std::string &switch_action, const std::string &switch_name)
+       void *data,
+       const std::string &switch_id,
+       const std::string &switch_action,
+       const std::string &switch_name)
 {
        RETURN_IF(!data, "Input parameter is NULL");
        auto self = static_cast<UniversalSwitchPage *>(data);
        // TODO Try to use service which is independent from specific view
        setting_accessibility_universal_switch_dbus_config_addSwitchConfigurationItem(
-               &self->context_.config, switch_id.c_str(), switch_name.c_str(), switch_action.c_str());
+               &self->context_.config, switch_id, switch_name, switch_action);
        int switch_count = setting_accessibility_universal_switch_dbus_config_get_switch_count(&self->context_.config);
 
        if (switch_count == 1)
index dc96b92e69aca1cc4542f2a00cb16ccfd973f038..e9bea5ed91d5d2380f9cee493d2245f0ea5ad1d2 100644 (file)
@@ -29,9 +29,6 @@
 
 #define CTXPOPUP_DATA_AD "__CTXPOPUP_DATA_AD"
 
-#define CURSOR_COLORS_COUNT 6
-#define MEDIA_LEVEL_COUNT 9
-
 #define RANGE_MIN_AUTO_SCAN_INTERVAL 0.5
 #define RANGE_MAX_AUTO_SCAN_INTERVAL 9.9
 #define RANGE_MIN_SCANS_NUM 1
@@ -89,62 +86,42 @@ enum class VoiceFeedbackAttribute : int
        VOLUME
 };
 
-typedef struct _key_id_pair
+enum class ManageMenuOption : int
 {
-       const char *key;
-       int id;
-} key_id_pair_t;
-
-// TODO: change fields keeping color id in whole project to unsigned int
-key_id_pair_t _cursor_color[CURSOR_COLORS_COUNT] = {
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_RED", static_cast<int>(0xff0000ff)},
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_ORANGE", static_cast<int>(0xff0080ff)},
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_YELLOW", static_cast<int>(0xff00ffff)},
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GREEN", static_cast<int>(0xff00ff00)},
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_BLUE", static_cast<int>(0xffff0000)},
-       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GRAY", static_cast<int>(0xff808080)},
+       GESTURES,
+       ACTIONS,
+       SETTINGS,
+       RECENT_APPS,
+       HOME_SCREEN,
+       BACK,
+       BUTTONS_AND_KEYS,
+       CONTEXTUAL_MENU
 };
 
-key_id_pair_t _media_level[MEDIA_LEVEL_COUNT] = {
-       {
-               .key = "100%",
-               .id = 100,
-       },
-       {
-               .key = "87%",
-               .id = 87,
-       },
-       {
-               .key = "75%",
-               .id = 75,
-       },
-       {
-               .key = "62%",
-               .id = 62,
-       },
-       {
-               .key = "50%",
-               .id = 50,
-       },
-       {
-               .key = "37%",
-               .id = 37,
-       },
-       {
-               .key = "25%",
-               .id = 25,
-       },
-       {
-               .key = "12%",
-               .id = 12,
-       },
-       {
-               .key = "0%",
-               .id = 0,
-       },
+using KeyIdPairs = std::vector<std::pair<std::string, unsigned int>>;
+
+KeyIdPairs cursorColors = {
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_RED", 0xff0000ff},
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_ORANGE", 0xff0080ff},
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_YELLOW", 0xff00ffff},
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GREEN", 0xff00ff00},
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_BLUE", 0xffff0000},
+       {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GRAY", 0xff808080},
+};
+
+KeyIdPairs mediaLevel = {
+       {"100%", 100},
+       {"87%", 87},
+       {"75%", 75},
+       {"62%", 62},
+       {"50%", 50},
+       {"37%", 37},
+       {"25%", 25},
+       {"12%", 12},
+       {"0%", 0},
 };
 
-std::pair<std::string, ManageMenuOption> _manage_options[] = {
+std::vector<std::pair<std::string, ManageMenuOption>> manageOptions = {
        {
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_GESTURES",
                ManageMenuOption::GESTURES,
@@ -179,14 +156,15 @@ std::pair<std::string, ManageMenuOption> _manage_options[] = {
        },
 };
 
-const char *_manage_options_key_array[] = {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_GESTURES,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_ACTIONS,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_SETTINGS,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_RECENT_APPS,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_HOMESCREEN,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_BACK,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_KEYS,
-       VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_CONTEXTUAL_MENU};
+const std::vector<std::string> manageOptionsVConfKeys = {
+       "db/setting/accessibility/universal-switch/SHOW_GESTURES_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_ACTIONS_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_SETTINGS_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_RECENT_APPS_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_HOME_SCREEN_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_BACK_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_BUTTONS_AND_KEYS_MENU_ITEM",
+       "db/setting/accessibility/universal-switch/SHOW_CONTEXTUAL_MENU"};
 
 UniversalSwitchSettingsPage::UniversalSwitchSettingsPage()
        : context_(Singleton<AppContext>::instance())
@@ -218,33 +196,24 @@ void UniversalSwitchSettingsPage::createManageGroup()
 
 void UniversalSwitchSettingsPage::createFeedbackGroup()
 {
-       const char *str = "Undefined";
        genlist_->appendItem({"group_index", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK"});
 
-       for (auto i = 0u; i < CURSOR_COLORS_COUNT; i++)
-               if (_cursor_color[i].id == context_.us_configuration.cursor_color) {
-                       str = _cursor_color[i].key;
-                       break;
-               }
-
        cursorColor_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL",
-               str,
+               findCursorColor(),
                [this](auto item) {
-                       setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL"));
+                       setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL");
                        setValuePage_->addRadioItemChangedCb([this](auto val) {
                                this->cursorColorListItemChangedCb(val);
                        });
 
-                       for (auto i = 0u; i < CURSOR_COLORS_COUNT; i++)
-                               setValuePage_->addRadioItem(_cursor_color[i].key, i, _cursor_color[i].id == context_.us_configuration.cursor_color);
+                       for (auto i = 0u; i < cursorColors.size(); i++)
+                               setValuePage_->addRadioItem(cursorColors[i].first, i, cursorColors[i].second == static_cast<unsigned int>(context_.us_configuration.cursor_color));
                }});
 
-       str = getBoleanText(context_.us_configuration.feedback_sound_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON"), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
-
        feedbackSound_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND",
-               str,
+               context_.us_configuration.feedback_sound_state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF",
                [this](auto item) { feedbackSoundCb(this, nullptr, nullptr); },
                [this](auto item) {
                        context_.us_configuration.feedback_sound_state = item->getState();
@@ -257,11 +226,9 @@ void UniversalSwitchSettingsPage::createFeedbackGroup()
        if (context_.us_configuration.feedback_sound_state)
                feedbackSound_->setState(true);
 
-       str = getBoleanText(context_.us_configuration.feedback_voice_state, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON"), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"));
-
        feedbackVoice_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE",
-               str,
+               context_.us_configuration.feedback_voice_state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF",
                [this](auto item) { feedbackVoiceCb(this, nullptr, nullptr); },
                [this](auto item) {
                        context_.us_configuration.feedback_voice_state = item->getState();
@@ -527,7 +494,7 @@ void UniversalSwitchSettingsPage::createScanningGroup()
        if (context_.us_configuration.auto_scan)
                item->setState(true);
 
-       str = getValueUnitText(NULL, &context_.us_configuration.auto_scan_interval, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"), false, NULL);
+       str = getValueUnitText(NULL, &context_.us_configuration.auto_scan_interval, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"), false, {});
        autoScanInterval_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN_INT",
                str,
@@ -542,7 +509,7 @@ void UniversalSwitchSettingsPage::createScanningGroup()
        if (!context_.us_configuration.auto_scan)
                autoScanInterval_->disable();
 
-       str = getValueUnitText(&context_.us_configuration.auto_scan_num, NULL, NULL, false, NULL);
+       str = getValueUnitText(&context_.us_configuration.auto_scan_num, NULL, {}, false, {});
        scansNum_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_NUM_OF_SCANS",
                str,
@@ -572,7 +539,7 @@ void UniversalSwitchSettingsPage::createScanningGroup()
                        this->createScanDirectionCtxPopup();
                }});
 
-       str = getValueUnitText(&context_.us_configuration.scan_pt_speed, NULL, NULL, false, NULL);
+       str = getValueUnitText(&context_.us_configuration.scan_pt_speed, NULL, {}, false, {});
        scanSpeed_ = genlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_PT_SPEED",
                str,
@@ -621,18 +588,10 @@ TranslatedString UniversalSwitchSettingsPage::getScanMethodText(ScanMethod metho
        }
 }
 
-const char *UniversalSwitchSettingsPage::getBoleanText(bool bvalue, const char *t_str, const char *f_str)
-{
-       if (bvalue)
-               return t_str;
-       else
-               return f_str;
-}
-
-std::string UniversalSwitchSettingsPage::getValueUnitText(int *ivalue, double *dvalue, const char *units, bool def_trigger, const char *def)
+std::string UniversalSwitchSettingsPage::getValueUnitText(int *ivalue, double *dvalue, const std::string &units, bool def_trigger, const std::string &def)
 {
        if (def_trigger)
-               return def ? def : std::string{};
+               return def;
 
        std::stringstream ss;
 
@@ -643,7 +602,7 @@ std::string UniversalSwitchSettingsPage::getValueUnitText(int *ivalue, double *d
                ss << std::fixed << *dvalue;
        }
 
-       if (units)
+       if (!units.empty())
                ss << " " << units;
 
        return ss.str();
@@ -675,7 +634,9 @@ void UniversalSwitchSettingsPage::getVconfSettings()
        context_.us_configuration.feedback_voice_state = DEFAULT_FEEDBACK_VOICE_STATE;
        context_.us_configuration.feedback_voice_speech_rate = DEFAULT_FEEDBACK_VOICE_SPEECH_RATE;
        context_.us_configuration.feedback_voice_speech_volume = DEFAULT_FEEDBACK_VOICE_SPEECH_VOLUME;
-       for (auto ii = 0u; ii < UniversalSwitchConfiguration::MANAGE_OPTIONS_COUNT; ++ii)
+
+       ASSERT(manageOptionsVConfKeys.size() == UniversalSwitchConfiguration::MANAGE_OPTIONS_COUNT, "Wrong number of VConf keys");
+       for (auto ii = 0u; ii < manageOptionsVConfKeys.size(); ++ii)
                context_.us_configuration.manage_options_state[ii] = DEFAULT_MANAGE_OPTIONS_VALUE;
 
        getVconfValue(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_ENABLED,
@@ -764,34 +725,34 @@ void UniversalSwitchSettingsPage::getVconfSettings()
                VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_RATE);
        context_.us_configuration.feedback_voice_speech_volume = getAndConvertVconfValue(
                VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_VOLUME);
-       for (auto ii = 0u; ii < UniversalSwitchConfiguration::MANAGE_OPTIONS_COUNT; ++ii)
-               getVconfValue(_manage_options_key_array[ii], &context_.us_configuration.manage_options_state[ii], NULL, NULL);
+       for (auto i = 0u; i < manageOptionsVConfKeys.size(); ++i)
+               getVconfValue(manageOptionsVConfKeys[i], &context_.us_configuration.manage_options_state[i], NULL, NULL);
 }
 
-int UniversalSwitchSettingsPage::getAndConvertVconfValue(const char *key)
+int UniversalSwitchSettingsPage::getAndConvertVconfValue(const std::string &key)
 {
-       double value;
+       auto value = 0.0;
        getVconfValue(key, NULL, NULL, &value);
 
        return value * 100;
 }
 
-bool UniversalSwitchSettingsPage::getVconfValue(const char *key, bool *bvalue, int *ivalue, double *dvalue)
+bool UniversalSwitchSettingsPage::getVconfValue(const std::string &key, bool *bvalue, int *ivalue, double *dvalue)
 {
-       int ret = VCONF_ERROR;
-       RETURN_DEFAULT_IF(!key, "Key input argument is nullptr");
+       auto ret = VCONF_ERROR;
+       RETURN_DEFAULT_IF(key.empty(), "Key input argument is nullptr");
 
        if (bvalue) {
                int tmp = 0;
-               ret = vconf_get_bool(key, &tmp);
+               ret = vconf_get_bool(key.c_str(), &tmp);
                *bvalue = tmp ? true : false;
-               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key);
+               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key.c_str());
        } else if (ivalue) {
-               ret = vconf_get_int(key, ivalue);
-               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key);
+               ret = vconf_get_int(key.c_str(), ivalue);
+               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key.c_str());
        } else if (dvalue) {
-               ret = vconf_get_dbl(key, dvalue);
-               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key);
+               ret = vconf_get_dbl(key.c_str(), dvalue);
+               PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "Failed to get Universal switch vconf value: %s.", key.c_str());
        } else {
                PRINT_ERROR_MESSAGE_IF(ret != VCONF_OK, "One of the input arguments must not be NULL");
        }
@@ -807,7 +768,7 @@ void UniversalSwitchSettingsPage::updateSwitchesCount(void *data)
        int switch_count = setting_accessibility_universal_switch_dbus_config_get_switch_count(&self->context_.config);
 
        self->switchesItem_->setDescription(
-               getValueUnitText(&switch_count, NULL, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES"), false, NULL));
+               getValueUnitText(&switch_count, NULL, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES"), false, {}));
        self->switchesItem_->update();
 }
 
@@ -817,9 +778,9 @@ void UniversalSwitchSettingsPage::feedbackVoiceCb(void *data, Evas_Object *obj,
        elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
 
        self->nestedSetValuePage_ = std::make_unique<SetValuePage>(
-               ValueEditorType::LIST_SWITCH, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE"));
+               ValueEditorType::LIST_SWITCH, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE");
        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_->setDescription("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_VOICE");
        self->nestedSetValuePage_->addSwitchChangedCb([self](auto state) {
                self->feedbackVoice_->setDescription(
                        state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
@@ -836,13 +797,13 @@ void UniversalSwitchSettingsPage::feedbackVoiceCb(void *data, Evas_Object *obj,
 
        std::string str = std::to_string(self->context_.us_configuration.feedback_voice_speech_rate) + "%";
        self->feedbackVoiceSpeechRate_ = self->nestedSetValuePage_->addRadioListItem(
-               _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE"),
+               "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE",
                str.c_str(),
                static_cast<int>(VoiceFeedbackAttribute::SPEECH_RATE));
 
        str = std::to_string(self->context_.us_configuration.feedback_voice_speech_volume) + "%";
        self->feedbackVoiceSpeechVolume_ = self->nestedSetValuePage_->addRadioListItem(
-               _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME"),
+               "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME",
                str.c_str(),
                static_cast<int>(VoiceFeedbackAttribute::VOLUME));
 
@@ -851,50 +812,46 @@ void UniversalSwitchSettingsPage::feedbackVoiceCb(void *data, Evas_Object *obj,
 
 void UniversalSwitchSettingsPage::feedbackVoiceItemOptionsRequestCb(int option_id)
 {
-       char *page_title = NULL;
-       int sel_value = 0;
+       int selValue = 0;
        auto feedbackType = static_cast<VoiceFeedbackAttribute>(option_id);
        if (feedbackType == VoiceFeedbackAttribute::SPEECH_RATE) {
-               page_title = _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE");
-               sel_value = context_.us_configuration.feedback_voice_speech_rate;
-               setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, page_title);
+               selValue = context_.us_configuration.feedback_voice_speech_rate;
+               setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE");
                setValuePage_->addRadioItemChangedCb([this](auto val) { this->feedbackVoiceSpeechRateChangedCb(val); });
        } else if (feedbackType == VoiceFeedbackAttribute::VOLUME) {
-               page_title = _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME");
-               sel_value = context_.us_configuration.feedback_voice_speech_volume;
-               setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, page_title);
+               selValue = context_.us_configuration.feedback_voice_speech_volume;
+               setValuePage_ = std::make_unique<SetValuePage>(ValueEditorType::RADIOS, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME");
                setValuePage_->addRadioItemChangedCb([this](auto val) { this->feedbackVoiceSpeechVolumeChangedCb(val); });
        } else {
                DEBUG("Wrong voice feedback attribute");
                return;
        }
 
-       int i;
-       for (i = 0; i < MEDIA_LEVEL_COUNT; i++)
-               setValuePage_->addRadioItem(_media_level[i].key, i, _media_level[i].id == sel_value);
+       for (auto i = 0u; i < mediaLevel.size(); i++)
+               setValuePage_->addRadioItem(mediaLevel[i].first, i, mediaLevel[i].second == static_cast<unsigned int>(selValue));
 }
 
-void UniversalSwitchSettingsPage::feedbackVoiceSpeechVolumeChangedCb(int item_id)
+void UniversalSwitchSettingsPage::feedbackVoiceSpeechVolumeChangedCb(size_t item_id)
 {
-       PRINT_ERROR_MESSAGE_IF(item_id < 0 || item_id >= MEDIA_LEVEL_COUNT, "Invalid item_id");
+       PRINT_ERROR_MESSAGE_IF(item_id >= mediaLevel.size(), "Invalid item_id");
 
-       context_.us_configuration.feedback_voice_speech_volume = _media_level[item_id].id;
-       double media_level = _media_level[item_id].id / 100.0;
+       context_.us_configuration.feedback_voice_speech_volume = mediaLevel[item_id].second;
+       double media_level = mediaLevel[item_id].second / 100.0;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_VOLUME, media_level);
 
-       feedbackVoiceSpeechVolume_->setDescription(_media_level[item_id].key ? _media_level[item_id].key : std::string{});
+       feedbackVoiceSpeechVolume_->setDescription(mediaLevel[item_id].first);
        feedbackVoiceSpeechVolume_->update();
 }
 
-void UniversalSwitchSettingsPage::feedbackVoiceSpeechRateChangedCb(int item_id)
+void UniversalSwitchSettingsPage::feedbackVoiceSpeechRateChangedCb(size_t item_id)
 {
-       PRINT_ERROR_MESSAGE_IF(item_id < 0 || item_id >= MEDIA_LEVEL_COUNT, "Invalid item_id");
+       PRINT_ERROR_MESSAGE_IF(item_id >= mediaLevel.size(), "Invalid item_id");
 
-       context_.us_configuration.feedback_voice_speech_rate = _media_level[item_id].id;
-       double media_level = _media_level[item_id].id / 100.0;
+       context_.us_configuration.feedback_voice_speech_rate = mediaLevel[item_id].second;
+       double media_level = mediaLevel[item_id].second / 100.0;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_RATE, media_level);
 
-       feedbackVoiceSpeechRate_->setDescription(_media_level[item_id].key ? _media_level[item_id].key : std::string{});
+       feedbackVoiceSpeechRate_->setDescription(mediaLevel[item_id].first);
        feedbackVoiceSpeechRate_->update();
 }
 
@@ -927,21 +884,20 @@ void UniversalSwitchSettingsPage::feedbackSoundItemOptionsRequestCb(int option_i
                ValueEditorType::RADIOS, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND_VOLUME"));
        setValuePage_->addRadioItemChangedCb([this](auto val) { this->feedbackSoundVolumeChangedCb(val); });
 
-       int i;
-       for (i = 0; i < MEDIA_LEVEL_COUNT; i++)
+       for (auto i = 0u; i < mediaLevel.size(); i++)
                setValuePage_->addRadioItem(
-                       _media_level[i].key, i, _media_level[i].id == context_.us_configuration.feedback_sound_volume);
+                       mediaLevel[i].first, i, mediaLevel[i].second == static_cast<unsigned int>(context_.us_configuration.feedback_sound_volume));
 }
 
-void UniversalSwitchSettingsPage::feedbackSoundVolumeChangedCb(int item_id)
+void UniversalSwitchSettingsPage::feedbackSoundVolumeChangedCb(size_t item_id)
 {
-       PRINT_ERROR_MESSAGE_IF(item_id < 0 || item_id >= MEDIA_LEVEL_COUNT, "Invalid item_id");
+       PRINT_ERROR_MESSAGE_IF(item_id >= mediaLevel.size(), "Invalid item_id");
 
-       context_.us_configuration.feedback_sound_volume = _media_level[item_id].id;
-       double media_level = _media_level[item_id].id / 100.0;
+       context_.us_configuration.feedback_sound_volume = mediaLevel[item_id].second;
+       double media_level = mediaLevel[item_id].second / 100.0;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND_VOLUME, media_level);
 
-       feedbackSoundVolume_->setDescription(_media_level[item_id].key ? _media_level[item_id].key : std::string{});
+       feedbackSoundVolume_->setDescription(mediaLevel[item_id].first);
        feedbackSoundVolume_->update();
 }
 
@@ -954,14 +910,14 @@ void UniversalSwitchSettingsPage::feedbackSoundSwitchChangedCb(bool state)
        feedbackSound_->update();
 }
 
-void UniversalSwitchSettingsPage::cursorColorListItemChangedCb(int item_id)
+void UniversalSwitchSettingsPage::cursorColorListItemChangedCb(size_t item_id)
 {
-       PRINT_ERROR_MESSAGE_IF(item_id < 0 || item_id >= CURSOR_COLORS_COUNT, "Invalid cursor color id");
+       PRINT_ERROR_MESSAGE_IF(item_id >= cursorColors.size(), "Invalid cursor color id");
 
-       context_.us_configuration.cursor_color = _cursor_color[item_id].id;
+       context_.us_configuration.cursor_color = cursorColors[item_id].second;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_CURSOR_COLOR, context_.us_configuration.cursor_color);
 
-       cursorColor_->setDescription(_cursor_color[item_id].key ? _cursor_color[item_id].key : std::string{});
+       cursorColor_->setDescription(cursorColors[item_id].first);
        cursorColor_->update();
 }
 
@@ -1095,7 +1051,7 @@ void UniversalSwitchSettingsPage::scanSpeedChangedCb(double value)
        context_.us_configuration.scan_pt_speed = (int)value;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_PT_SPEED, int_value);
 
-       scanSpeed_->setDescription(getValueUnitText(&int_value, NULL, NULL, false, NULL));
+       scanSpeed_->setDescription(getValueUnitText(&int_value, NULL, {}, false, {}));
        scanSpeed_->update();
 }
 
@@ -1172,7 +1128,7 @@ void UniversalSwitchSettingsPage::scanNumberChangedCb(double value)
        context_.us_configuration.auto_scan_num = (int)value;
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_NUM_OF_SCANS, int_value);
 
-       scansNum_->setDescription(getValueUnitText(&int_value, NULL, NULL, false, NULL));
+       scansNum_->setDescription(getValueUnitText(&int_value, NULL, {}, false, {}));
        scansNum_->update();
 }
 
@@ -1182,7 +1138,7 @@ void UniversalSwitchSettingsPage::autoScanIntervalChangedCb(double value)
        Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_INT, value);
 
        autoScanInterval_->setDescription(
-               getValueUnitText(NULL, &value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"), false, NULL));
+               getValueUnitText(NULL, &value, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"), false, {}));
        autoScanInterval_->update();
 }
 
@@ -1210,14 +1166,14 @@ void UniversalSwitchSettingsPage::onManageMenuOptions()
        auto prevBtn = Widget::make<Button>(
                naviframe, [naviframe, this]() { naviframe->popBack(); }, std::string{}, Button::BACK_BUTTON_ARROW_STYLE);
 
-       for (auto i = 0u; i < utils::lenOf(_manage_options); ++i) {
+       for (auto i = 0u; i < manageOptions.size(); ++i) {
                auto it = genlist->appendItem({"multiline",
-                       _manage_options[i].first,
-                       (i == UniversalSwitchConfiguration::MANAGE_OPTIONS_COUNT - 1) ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU_DESC" : "",
+                       manageOptions[i].first,
+                       (i == manageOptionsVConfKeys.size() - 1) ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU_DESC" : "",
                        [=](auto item) {
                                auto state = item->getState();
                                context_.us_configuration.manage_options_state[i] = state;
-                               Singleton<VConfInterface>::instance().set(_manage_options_key_array[i], state);
+                               Singleton<VConfInterface>::instance().set(manageOptionsVConfKeys[i], state);
                        },
                        GenlistItem::WidgetType::toggle});
 
@@ -1227,3 +1183,13 @@ void UniversalSwitchSettingsPage::onManageMenuOptions()
 
        naviframe->pushBack("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE", genlist, [this]() {}, prevBtn);
 }
+
+std::string UniversalSwitchSettingsPage::findCursorColor()
+{
+       for (auto i = 0u; i < cursorColors.size(); i++)
+               if (cursorColors[i].second == static_cast<unsigned int>(context_.us_configuration.cursor_color)) {
+                       return cursorColors[i].first;
+               }
+
+       return "Undefined";
+}
\ No newline at end of file
index 84bf1f927ff6db31466648af81d235b936b62db4..13f5d0b96b06b79cae06d8ec6cab3ad542ad15f3 100644 (file)
@@ -51,21 +51,20 @@ class UniversalSwitchSettingsPage
        void scanDirectionCtxPopupItemClicked(ScanDirection scan_dir);
        TranslatedString getScanDirectionText(ScanDirection direction);
        TranslatedString getScanMethodText(ScanMethod method);
-       static const char *getBoleanText(bool bvalue, const char *t_str, const char *f_str);
-       static std::string getValueUnitText(int *ivalue, double *dvalue, const char *units, bool def_trigger, const char *def);
+       static std::string getValueUnitText(int *ivalue, double *dvalue, const std::string &units, bool def_trigger, const std::string &def);
        void getVconfSettings();
-       static int getAndConvertVconfValue(const char *key);
-       static bool getVconfValue(const char *key, bool *bvalue, int *ivalue, double *dvalue);
+       static int getAndConvertVconfValue(const std::string &key);
+       static bool getVconfValue(const std::string &key, bool *bvalue, int *ivalue, double *dvalue);
        static void updateSwitchesCount(void *data);
        static void feedbackVoiceCb(void *data, Evas_Object *obj, void *event_info);
        void feedbackVoiceItemOptionsRequestCb(int option_id);
-       void feedbackVoiceSpeechVolumeChangedCb(int item_id);
-       void feedbackVoiceSpeechRateChangedCb(int item_id);
+       void feedbackVoiceSpeechVolumeChangedCb(size_t item_id);
+       void feedbackVoiceSpeechRateChangedCb(size_t item_id);
        static void feedbackSoundCb(void *data, Evas_Object *obj, void *event_info);
        void feedbackSoundItemOptionsRequestCb(int option_id);
-       void feedbackSoundVolumeChangedCb(int item_id);
+       void feedbackSoundVolumeChangedCb(size_t item_id);
        void feedbackSoundSwitchChangedCb(bool state);
-       void cursorColorListItemChangedCb(int item_id);
+       void cursorColorListItemChangedCb(size_t item_id);
        void autoMoveIntervalSwitchChangedCb(bool state);
        void autoTapSwitchChangedCb(bool state);
        void autoTapValueChangedCb(double value);
@@ -80,6 +79,7 @@ class UniversalSwitchSettingsPage
        void autoScanIntervalChangedCb(double value);
        void autoMoveIntervalValueChangedCb(double value);
        void onManageMenuOptions();
+       std::string findCursorColor();
 
        AppContext &context_;
        Genlist *genlist_ = nullptr;
index 9aa5912110a353db795d2742cb96850d1436acd2..a3efb433dbc42c9f66f648720b22c5fd14b10c79 100644 (file)
@@ -90,7 +90,7 @@ void UpdateSwitchPage::createUpdateAccessoriesSwitchPage()
        entry_->moveCursorToEnd();
        layout_->setPartContent(PRT_SET_VALUE_ENTRY, entry_);
 
-       updateAccessoriesActionGenlist_ = createGenlist(layout_, NULL);
+       updateAccessoriesActionGenlist_ = createGenlist(layout_, {});
        updateAccessoriesActionGenlist_->appendItem({"type1",
                "IDS_ACCS_UNIVERSAL_SWITCH_ACTION",
                setting_accessibility_universal_switch_dbus_config_get_activity_name(
@@ -101,7 +101,7 @@ void UpdateSwitchPage::createUpdateAccessoriesSwitchPage()
        naviItem.setPartContent("tabbar", tabbar);
 }
 
-Genlist *UpdateSwitchPage::createGenlist(Widget *parent, const char *title)
+Genlist *UpdateSwitchPage::createGenlist(Widget *parent, std::string title)
 {
        RETURN_DEFAULT_IF(!parent, "Input parameter is nullptr");
 
@@ -109,8 +109,8 @@ Genlist *UpdateSwitchPage::createGenlist(Widget *parent, const char *title)
        genlist->setMode(ELM_LIST_COMPRESS);
        genlist->setStyle("dialogue");
 
-       if (title)
-               genlist->appendItem({"group_index", title});
+       if (!title.empty())
+               genlist->appendItem({"group_index", std::move(title)});
 
        parent->setPartContent(PRT_SET_VALUE_LIST, genlist);
 
index 0778cd0cc0afba4bbabc4dd7ebf750055cd145e6..907d649a1b387415dfe40574d0127ed90fd94d5a 100644 (file)
@@ -41,7 +41,7 @@ class UpdateSwitchPage
        private:
        static void onActionUpdate(const std::string &action, void *user_data);
        void createUpdateAccessoriesSwitchPage();
-       Genlist *createGenlist(Widget *parent, const char *title);
+       Genlist *createGenlist(Widget *parent, std::string title);
        void updateSwitchAction();
        static void updateSwitchChooseAction(const std::string &action, void *user_data);
 
index f362bcf75d6edb18302bbd9f1a918c0f10759e65..bc610c9af8bcc50da34a2a9821d2d62aa7c4ff51 100644 (file)
@@ -201,9 +201,9 @@ class VConfImpl : public VConfInterface
        std::string get(const std::string &key, const std::string &value) const override
        {
                auto k = keyPrefix + key;
-               char *str = vconf_get_str(k.c_str());
-               if (str)
-                       return str;
+               auto vconfStr = vconf_get_str(k.c_str());
+               if (vconfStr)
+                       return std::string{vconfStr};
 
                WARNING("Vconf: cant get value for key: %s, returning default value = %s", k.c_str(), value.c_str());
                return value;
index 30220c6e4ba9c2b80d7b634097ad8a4309aac71b..73acccc36f1358a8bdf2defe8cff8a86c0326a1a 100644 (file)
 #include <utility>
 #include <vector>
 
-namespace event
-{
-       static constexpr const char *CLICKED = "clicked";
-}
-
 class Widget
 {
        public:
index ca07fd28a960326e76b357de1d8b96497654909a..548c71e4fa734f2edc1eb0c33a5ca346f2989b00 100644 (file)
@@ -104,7 +104,8 @@ static void __eldbus_getInfoArray(std::vector<UniversalSwitchInfoType *> &infoTy
 }
 
 static std::vector<UniversalSwitchInfoType *> __eldbus_getAllSwitchesByProviderId(
-       UniversalSwitchEldbus *eldbus, const char *provider_id)
+       UniversalSwitchEldbus *eldbus,
+       const std::string &provider_id)
 {
        Eldbus_Message *req = NULL;
        Eldbus_Message *reply = NULL;
@@ -117,7 +118,7 @@ static std::vector<UniversalSwitchInfoType *> __eldbus_getAllSwitchesByProviderI
                return {};
        }
        iter = eldbus_message_iter_get(req);
-       eldbus_message_iter_arguments_append(iter, "s", provider_id);
+       eldbus_message_iter_arguments_append(iter, "s", provider_id.c_str());
 
        std::vector<UniversalSwitchInfoType *> switches;
        reply = eldbus_proxy_send_and_block(eldbus->proxy, req, ELDBUS_TIMEOUT);
@@ -157,7 +158,7 @@ static std::vector<UniversalSwitchSwitchProvider *> __eldbus_getAllSwitchProvide
                        for (auto &it : switch_providers_info) {
                                auto switch_provider = new UniversalSwitchSwitchProvider;
                                switch_provider->info = it;
-                               switch_provider->switches = __eldbus_getAllSwitchesByProviderId(eldbus, it->id.c_str());
+                               switch_provider->switches = __eldbus_getAllSwitchesByProviderId(eldbus, it->id);
                                switch_providers.push_back(switch_provider);
                        }
                } else
@@ -197,7 +198,8 @@ static std::vector<UniversalSwitchInfoType *> __eldbus_getBindableActivityTypes(
 }
 
 static void __eldbus_getAllSwitchConfigurationItemsArray(
-       std::vector<UniversalSwitchConfigurationItem *> &infoTypes, Eldbus_Message *reply)
+       std::vector<UniversalSwitchConfigurationItem *> &infoTypes,
+       Eldbus_Message *reply)
 {
 
        Eldbus_Message_Iter *array;
@@ -344,7 +346,9 @@ static void __bus_name_acquired(void *data, const char *bus, const char *old_id,
 }
 
 Eina_Bool setting_accessibility_universal_switch_dbus_config_init(
-       UniversalSwitchDbusConfig *config, init_done_cb callback, void *callback_data)
+       UniversalSwitchDbusConfig *config,
+       init_done_cb callback,
+       void *callback_data)
 {
 
        config->eldbus.init_done_callback = callback;
@@ -360,27 +364,34 @@ int setting_accessibility_universal_switch_dbus_config_get_switch_count(Universa
 }
 
 void setting_accessibility_universal_switch_dbus_config_addSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id, const char *user_name, const char *activity_type)
+       UniversalSwitchDbusConfig *config,
+       const std::string &switch_id,
+       const std::string &user_name,
+       const std::string &activity_type)
 {
-       DEBUG("Running " IFACE ".addSwitchConfigurationItem(%s, %s ,%s)", switch_id, user_name, activity_type);
+       DEBUG("Running " IFACE ".addSwitchConfigurationItem(%s, %s ,%s)", switch_id.c_str(), user_name.c_str(), activity_type.c_str());
        eldbus_proxy_call(
-               config->eldbus.proxy, "addSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "sss", switch_id, user_name, activity_type);
+               config->eldbus.proxy, "addSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "sss", switch_id.c_str(), user_name.c_str(), activity_type.c_str());
        __update_configuration_items(config);
 }
 void setting_accessibility_universal_switch_dbus_config_updateSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id, const char *user_name, const char *activity_type)
+       UniversalSwitchDbusConfig *config,
+       const std::string &switch_id,
+       const std::string &user_name,
+       const std::string &activity_type)
 {
-       DEBUG("Running " IFACE ".updateSwitchConfigurationItem(%s, %s ,%s)", switch_id, user_name, activity_type);
+       DEBUG("Running " IFACE ".updateSwitchConfigurationItem(%s, %s ,%s)", switch_id.c_str(), user_name.c_str(), activity_type.c_str());
        eldbus_proxy_call(
-               config->eldbus.proxy, "updateSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "sss", switch_id, user_name, activity_type);
+               config->eldbus.proxy, "updateSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "sss", switch_id.c_str(), user_name.c_str(), activity_type.c_str());
        __update_configuration_items(config);
 }
 
 void setting_accessibility_universal_switch_dbus_config_removeSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id)
+       UniversalSwitchDbusConfig *config,
+       const std::string &switch_id)
 {
-       DEBUG("Running " IFACE ".removeSwitchConfigurationItem(%s)", switch_id);
-       eldbus_proxy_call(config->eldbus.proxy, "removeSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "s", switch_id);
+       DEBUG("Running " IFACE ".removeSwitchConfigurationItem(%s)", switch_id.c_str());
+       eldbus_proxy_call(config->eldbus.proxy, "removeSwitchConfigurationItem", NULL, NULL, ELDBUS_TIMEOUT, "s", switch_id.c_str());
        __update_configuration_items(config);
 }
 
@@ -393,7 +404,8 @@ void setting_accessibility_universal_switch_dbus_config_shutdown(UniversalSwitch
 }
 
 std::string setting_accessibility_universal_switch_dbus_config_get_activity_name(
-       UniversalSwitchDbusConfig *config, const std::string &activity_id)
+       UniversalSwitchDbusConfig *config,
+       const std::string &activity_id)
 {
        for (auto &it : config->activity_types)
                if (it->id == activity_id)
@@ -402,10 +414,11 @@ std::string setting_accessibility_universal_switch_dbus_config_get_activity_name
        return {};
 }
 std::vector<UniversalSwitchInfoType *> setting_accessibility_universal_switch_dbus_config_get_switches(
-       UniversalSwitchDbusConfig *config, const char *provider_id)
+       UniversalSwitchDbusConfig *config,
+       const std::string &provider_id)
 {
        for (auto &it : config->switch_providers)
-               if (strcmp(it->info->id.c_str(), provider_id) == 0)
+               if (it->info->id == provider_id)
                        return it->switches;
        return {};
 }
@@ -433,15 +446,19 @@ static void __eldbus_on_capture_switch(void *data EINA_UNUSED, const Eldbus_Mess
 }
 
 void setting_accessibility_universal_switch_dbus_config_captureSwitch(
-       UniversalSwitchDbusConfig *config, const char *provider_id, double timeout, capture_switch_cb callback, void *calback_data)
+       UniversalSwitchDbusConfig *config,
+       const std::string &provider_id,
+       double timeout,
+       capture_switch_cb callback,
+       void *callback_data)
 {
        UniversalSwitchEldbus *eldbus = &config->eldbus;
-       DEBUG("DBus call captureSwitch for %s", provider_id);
+       DEBUG("DBus call captureSwitch for %s", provider_id.c_str());
        eldbus->capture_switch_request = eldbus_proxy_call(
-               eldbus->proxy, "captureSwitch", __eldbus_on_capture_switch, eldbus, timeout, "s", provider_id);
+               eldbus->proxy, "captureSwitch", __eldbus_on_capture_switch, eldbus, timeout, "s", provider_id.c_str());
        if (eldbus->capture_switch_request) {
                eldbus->capture_switch_callback = callback;
-               eldbus->capture_switch_data = calback_data;
+               eldbus->capture_switch_data = callback_data;
        } else {
                ERROR("Dbus call to captureSwitch failed");
        }
index c047658a02edbaa7b75cd2cca693e9ae9e346524..d39a0563f2a0f5b1318620fa84fdd4d2b9861102 100644 (file)
@@ -21,7 +21,7 @@
 #include <string>
 #include <vector>
 
-typedef void (*capture_switch_cb)(void *data, const char *switch_id);
+typedef void (*capture_switch_cb)(void *data, const std::string &switch_id);
 typedef void (*init_done_cb)(void *data);
 
 struct UniversalSwitchEldbus
@@ -76,17 +76,17 @@ int setting_accessibility_universal_switch_dbus_config_get_switch_count(Universa
 std::string setting_accessibility_universal_switch_dbus_config_get_activity_name(
        UniversalSwitchDbusConfig *config, const std::string &activity_id);
 std::vector<UniversalSwitchInfoType *> setting_accessibility_universal_switch_dbus_config_get_switches(
-       UniversalSwitchDbusConfig *config, const char *provider_id);
+       UniversalSwitchDbusConfig *config, const std::string &provider_id);
 void setting_accessibility_universal_switch_dbus_config_shutdown(UniversalSwitchDbusConfig *config);
 void setting_accessibility_universal_switch_dbus_config_addSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id, const char *user_name, const char *activity_type);
+       UniversalSwitchDbusConfig *config, const std::string &switch_id, const std::string &user_name, const std::string &activity_type);
 void setting_accessibility_universal_switch_dbus_config_updateSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id, const char *user_name, const char *activity_type);
+       UniversalSwitchDbusConfig *config, const std::string &switch_id, const std::string &user_name, const std::string &activity_type);
 void setting_accessibility_universal_switch_dbus_config_removeSwitchConfigurationItem(
-       UniversalSwitchDbusConfig *config, const char *switch_id);
+       UniversalSwitchDbusConfig *config, const std::string &switch_id);
 
 void setting_accessibility_universal_switch_dbus_config_captureSwitch(
-       UniversalSwitchDbusConfig *config, const char *provider_id, double timeout, capture_switch_cb callback, void *calback_data);
+       UniversalSwitchDbusConfig *config, const std::string &provider_id, double timeout, capture_switch_cb callback, void *calback_data);
 void setting_accessibility_universal_switch_dbus_config_cancelCaptureSwitch(UniversalSwitchDbusConfig *config);
 
 #endif /* SETTINGACCESSIBILITYUNIVERSALSWITCHDBUS_H */
index 2c138080ead5505c90737f20e1752095667a1249..8feefc143d19de4b9b0c1d8bbb31f4788b6f01b4 100644 (file)
 
 #define ACCESSIBILITY_UNIVERSAL_SWITCH_PLUS_ICON RESDIR "/icons/plus.png"
 
-enum class ManageMenuOption : int
-{
-       GESTURES,
-       ACTIONS,
-       SETTINGS,
-       RECENT_APPS,
-       HOME_SCREEN,
-       BACK,
-       BUTTONS_AND_KEYS,
-       CONTEXTUAL_MENU
-};
-
 #define VCONF_MEMORY_TYPE "db/"
 #define VCONF_PROJECT_NAME "setting/accessibility/universal-switch/"
 #define VCONF_PROJECT_PREFIX VCONF_MEMORY_TYPE VCONF_PROJECT_NAME
index f91ae6808294ecd3fb71a23848200e123cbf016a..642a87193ba02789dc0222341239d4dd3bb6549b 100644 (file)
@@ -25,12 +25,6 @@ using SettingCallback = void (*)(void *, Evas_Object *, void *);
 
 namespace utils
 {
-       template <typename T, size_t len>
-       size_t lenOf(const T (&)[len])
-       {
-               return len;
-       }
-
        struct EvasDeleter
        {
                template <typename T>