#include "Window.hpp"
#include "Quickpanel.hpp"
+#include <map>
#include <stack>
-class VconfTypeMenuItem : public MenuItem
+enum class RepetitionPolicy : bool {
+ single = false,
+ multiple = true
+};
+
+class MenuItemImplementation : public MenuItem, public std::enable_shared_from_this<MenuItem>
+{
+public:
+ MenuItemImplementation(std::vector<std::string> names = {}, std::string iconPath = {}, std::string activityType = {},
+ std::string subMenuLabel = {}, std::string showingStateVconfKey = {},
+ RepetitionPolicy repetitionPolicy = RepetitionPolicy::single);
+
+ std::string getName() const override;
+ std::string getIconPath() const override;
+ std::string getActivityType() const override;
+ std::string getSubMenuLabel() const override;
+ bool isDisplayed() const override;
+ bool isRepeatable() const override;
+
+protected:
+ std::vector<std::string> names;
+ std::string iconPath;
+ std::string activityType;
+ std::string subMenuLabel;
+ std::string showingStateVconfKey;
+ RepetitionPolicy repetitionPolicy;
+};
+
+class VconfTypeMenuItem : public MenuItemImplementation
{
public:
VconfTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType,
{
public:
VconfIntTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType,
- std::string vconfStateKey,
- std::string subMenuLabel = {}, std::string showingStateVconfKey = {}, RepetitionPolicy repetitionPolicy = RepetitionPolicy::single);
+ std::string vconfStateKey, std::string subMenuLabel = {}, std::string showingStateVconfKey = {},
+ RepetitionPolicy repetitionPolicy = RepetitionPolicy::single);
size_t getIndex() const override;
{
public:
VconfBoolTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType,
- std::vector<std::string> vconfStateKeys,
- std::string subMenuLabel = {}, std::string showingStateVconfKey = {}, RepetitionPolicy repetitionPolicy = RepetitionPolicy::single);
+ std::vector<std::string> vconfStateKeys, std::string subMenuLabel = {},
+ std::string showingStateVconfKey = {}, RepetitionPolicy repetitionPolicy = RepetitionPolicy::single);
size_t getIndex() const override;
std::vector<std::string> vconfStateKeys;
};
-class QuickpanelTypeMenuItem : public MenuItem
+class QuickpanelTypeMenuItem : public MenuItemImplementation
{
public:
QuickpanelTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType);
std::string getName() const override;
};
-MenuItem::MenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType, std::string subMenuLabel,
- std::string showingStateVconfKey, RepetitionPolicy repetitionPolicy)
+class MenuMapImplementation : public MenuMap
+{
+public:
+ MenuMapImplementation();
+
+ std::vector<std::shared_ptr<MenuItem>> find(std::string) override;
+
+private:
+ void addToMap(std::string, std::vector<std::shared_ptr<MenuItem>>);
+
+ std::multimap<std::string, std::shared_ptr<MenuItem>> map;
+};
+
+MenuItemImplementation::MenuItemImplementation(std::vector<std::string> names, std::string iconPath, std::string activityType,
+ std::string subMenuLabel, std::string showingStateVconfKey, RepetitionPolicy repetitionPolicy)
: names(std::move(names)), iconPath(std::move(iconPath)), activityType(std::move(activityType)),
subMenuLabel(std::move(subMenuLabel)), showingStateVconfKey(std::move(showingStateVconfKey)), repetitionPolicy(repetitionPolicy) {}
-std::string MenuItem::getName() const
+std::string MenuItemImplementation::getName() const
{
return names.empty() ? std::string() : gettext(names[0].c_str());
}
-std::string MenuItem::getIconPath() const
+std::string MenuItemImplementation::getIconPath() const
{
return iconPath;
}
-std::string MenuItem::getActivityType() const
+std::string MenuItemImplementation::getActivityType() const
{
return activityType;
}
-std::string MenuItem::getSubMenuLabel() const
+std::string MenuItemImplementation::getSubMenuLabel() const
{
return subMenuLabel;
}
-std::string MenuItem::getShowingStateVconfKey() const
+bool MenuItemImplementation::isDisplayed() const
{
- return showingStateVconfKey;
+ return showingStateVconfKey.empty() || Singleton<VConfInterface>::instance().get(showingStateVconfKey, false);
}
-bool MenuItem::isRepeatable() const
+bool MenuItemImplementation::isRepeatable() const
{
return static_cast<bool>(repetitionPolicy);
}
VconfTypeMenuItem::VconfTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType,
std::string subMenuLabel, std::string showingStateVconfKey, RepetitionPolicy repetitionPolicy)
- : MenuItem(std::move(names), std::move(iconPath), std::move(activityType), std::move(subMenuLabel), std::move(showingStateVconfKey), repetitionPolicy),
+ : MenuItemImplementation(std::move(names), std::move(iconPath), std::move(activityType), std::move(subMenuLabel), std::move(showingStateVconfKey), repetitionPolicy),
index(0)
{
ASSERT(!this->names.empty(), "Forbidden VconfTypeMenuItem");
}
QuickpanelTypeMenuItem::QuickpanelTypeMenuItem(std::vector<std::string> names, std::string iconPath, std::string activityType)
- : MenuItem(std::move(names), std::move(iconPath), std::move(activityType))
+ : MenuItemImplementation(std::move(names), std::move(iconPath), std::move(activityType))
{}
std::string QuickpanelTypeMenuItem::getName() const
return gettext(names[window->getQuickpanel()->isVisible() ? 1 : 0].c_str());
}
-MenuMap::MenuMap()
+MenuMapImplementation::MenuMapImplementation()
{
const std::string defaultImg = ICONS_DIR "/tizen.png";
- auto tap = std::make_shared<MenuItem>(
+ auto tap = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_TAP"},
defaultImg,
"TAP");
- auto homeScreen = std::make_shared<MenuItem>(
+ auto homeScreen = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_HOME_SCREEN"},
defaultImg,
"START_HOME_SCREEN",
std::string {},
VCONF_KEY_SHOW_HOME_SCREEN_MENU_ITEM);
- auto back = std::make_shared<MenuItem>(
+ auto back = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_BACK"},
defaultImg,
"BACK",
std::vector<std::string> {"IDS_OPEN_NOTI_PANEL", "IDS_CLOSE_NOTI_PANEL"},
defaultImg,
"TOGGLE_QUICKPANEL");
- auto recentApps = std::make_shared<MenuItem>(
+ auto recentApps = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_RECENT_APPS"},
defaultImg,
"START_TASK_MGR",
std::string {},
VCONF_KEY_SHOW_RECENT_APPS_MENU_ITEM);
- auto accept = std::make_shared<MenuItem>(
+ auto accept = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ACCEPT"},
defaultImg,
"ACCEPT_INCOMMING_CALL");
- auto reject = std::make_shared<MenuItem>(
+ auto reject = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_REJECT"},
defaultImg,
"REJECT_INCOMMING_CALL");
- auto endCall = std::make_shared<MenuItem>(
+ auto endCall = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_END_CALL"},
defaultImg,
"END_CALL");
- auto leftPage = std::make_shared<MenuItem>(
+ auto leftPage = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_LEFT_PAGE"},
defaultImg);
- auto rightPage = std::make_shared<MenuItem>(
+ auto rightPage = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_RIGHT_PAGE"},
defaultImg);
- auto increase = std::make_shared<MenuItem>(
+ auto increase = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_INCREASE"},
defaultImg,
std::string {"INCREASE_UI_ELEMENT_VALUE"},
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto decrease = std::make_shared<MenuItem>(
+ auto decrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_DECREASE"},
defaultImg,
std::string {"DECREASE_UI_ELEMENT_VALUE"},
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto selectionMode = std::make_shared<MenuItem>(
+ auto selectionMode = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SELECTION_MODE"},
defaultImg);
- auto selectAll = std::make_shared<MenuItem>(
+ auto selectAll = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SELECT_ALL"},
defaultImg);
auto previous = std::make_shared<VconfIntTypeMenuItem>(
defaultImg,
std::string {},/*TODO add activity*/
std::string {VCONF_KEY_GRANULARITY_UNIT});
- auto copy = std::make_shared<MenuItem>(
+ auto copy = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_COPY"},
defaultImg);
- auto paste = std::make_shared<MenuItem>(
+ auto paste = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_PASTE"},
defaultImg);
- auto cut = std::make_shared<MenuItem>(
+ auto cut = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_CUT"},
defaultImg);
- auto touchHold = std::make_shared<MenuItem>(
+ auto touchHold = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_TOUCH_AND_HOLD"},
defaultImg);
- auto touchHoldThenDrag = std::make_shared<MenuItem>(
+ auto touchHoldThenDrag = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_TOUCH_HOLD_THEN_DRAG"},
defaultImg);
- auto swipeUp = std::make_shared<MenuItem>(
+ auto swipeUp = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SWIPE_UP"},
defaultImg,
"SWIPE_UP");
- auto swipeDown = std::make_shared<MenuItem>(
+ auto swipeDown = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SWIPE_DOWN"},
defaultImg,
"SWIPE_DOWN");
- auto swipeLeft = std::make_shared<MenuItem>(
+ auto swipeLeft = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SWIPE_LEFT"},
defaultImg,
"SWIPE_LEFT");
- auto swipeRight = std::make_shared<MenuItem>(
+ auto swipeRight = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SWIPE_RIGHT"},
defaultImg,
"SWIPE_RIGHT");
defaultImg,
std::string {},/*TODO add activity*/
std::vector<std::string> {VCONF_KEY_AUTO_SCROLL_ENABLED});
- auto speedUpAutoScroll = std::make_shared<MenuItem>(
+ auto speedUpAutoScroll = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SPEED_UP_AUTO_SCROLL"},
defaultImg);
- auto slowDownAutoScroll = std::make_shared<MenuItem>(
+ auto slowDownAutoScroll = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SLOW_DOWN_AUTO_SCROLL"},
defaultImg);
- auto scrollUp = std::make_shared<MenuItem>(
+ auto scrollUp = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SCROLL_UP"},
defaultImg);
- auto scrollDown = std::make_shared<MenuItem>(
+ auto scrollDown = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SCROLL_DOWN"},
defaultImg);
- auto scrollTop = std::make_shared<MenuItem>(
+ auto scrollTop = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SCROLL_TOP"},
defaultImg);
- auto drag = std::make_shared<MenuItem>(
+ auto drag = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_DRAG"},
defaultImg);
- auto done = std::make_shared<MenuItem>(
+ auto done = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_DONE"},
defaultImg);
- auto cancel = std::make_shared<MenuItem>(
+ auto cancel = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_CANCEL"},
defaultImg);
- auto zoomIn = std::make_shared<MenuItem>(
+ auto zoomIn = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ZOOM_IN"},
defaultImg,
"ZOOM_IN");
- auto zoomOut = std::make_shared<MenuItem>(
+ auto zoomOut = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ZOOM_OUT"},
defaultImg,
"ZOOM_OUT");
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto lock = std::make_shared<MenuItem>(
+ auto lock = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_LOCK"},
defaultImg,
"START_LOCK_SCREEN");
- auto captureScreenshot = std::make_shared<MenuItem>(
+ auto captureScreenshot = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_CAPTURE_SCREENSHOT"},
defaultImg);
- auto rotateLeft = std::make_shared<MenuItem>(
+ auto rotateLeft = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ROTATE_LEFT"},
defaultImg);
- auto rotateRight = std::make_shared<MenuItem>(
+ auto rotateRight = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ROTATE_RIGHT"},
defaultImg);
- auto rotateToPortrait = std::make_shared<MenuItem>(
+ auto rotateToPortrait = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ROTATE_TO_PORTRAIT"},
defaultImg);
- auto speedUpScaning = std::make_shared<MenuItem>(
+ auto speedUpScaning = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SPEED_UP_SCANING"},
defaultImg,
std::string{"SPEED_UP_AUTO_SCAN_ACTIVITY"},
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto slowDownScaning = std::make_shared<MenuItem>(
+ auto slowDownScaning = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SLOW_DOWN_SCANING"},
defaultImg,
std::string{"SLOW_DOWN_AUTO_SCAN_ACTIVITY"},
defaultImg,
std::string {"TOGGLE_SOUND_FEEDBACK_ENABLED_ACTIVITY"},
std::vector<std::string> {VCONF_KEY_FEEDBACK_SOUND_ENABLED});
- auto moreSettings = std::make_shared<MenuItem>(
+ auto moreSettings = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_MORE_SETTINGS"},
defaultImg);
- auto character = std::make_shared<MenuItem>(
+ auto character = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_CHARACTER"},
defaultImg);
- auto word = std::make_shared<MenuItem>(
+ auto word = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_WORD"},
defaultImg);
- auto line = std::make_shared<MenuItem>(
+ auto line = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_LINE"},
defaultImg);
- auto paragraph = std::make_shared<MenuItem>(
+ auto paragraph = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_PARAGRAPH"},
defaultImg);
- auto ringtoneVolIncrease = std::make_shared<MenuItem>(
+ auto ringtoneVolIncrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_RINGTONE_VOLUME_INC"},
defaultImg,
"INCREASE_RINGTONE_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto ringtoneVolDecrease = std::make_shared<MenuItem>(
+ auto ringtoneVolDecrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_RINGTONE_VOLUME_DEC"},
defaultImg,
"DECREASE_RINGTONE_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto mediaVolumeIncrease = std::make_shared<MenuItem>(
+ auto mediaVolumeIncrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_MEDIA_VOLUME_INC"},
defaultImg,
"INCREASE_MEDIA_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto mediaVolumeDecrease = std::make_shared<MenuItem>(
+ auto mediaVolumeDecrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_MEDIA_VOLUME_DEC"},
defaultImg,
"DECREASE_MEDIA_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto tapHomeButtonx2 = std::make_shared<MenuItem>(
+ auto tapHomeButtonx2 = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_TAP_HOME_BUTTON_X2"},
defaultImg,
"HOME_BUTTON_X2");
- auto tapHomeButtonx3 = std::make_shared<MenuItem>(
+ auto tapHomeButtonx3 = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_TAP_HOME_BUTTON_X3"},
defaultImg,
"HOME_BUTTON_X3");
- auto viewPowerKeyMenu = std::make_shared<MenuItem>(
+ auto viewPowerKeyMenu = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_VIEW_POWER_KEY_MENU"},
defaultImg);
- auto notiVolumeIncrease = std::make_shared<MenuItem>(
+ auto notiVolumeIncrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_NOTI_VOLUME_INC"},
defaultImg,
"INCREASE_NOTIFICATIONS_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto notiVolumeDecrease = std::make_shared<MenuItem>(
+ auto notiVolumeDecrease = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_NOTI_VOLUME_DEC"},
defaultImg,
"DECREASE_NOTIFICATIONS_VOLUME",
std::string {},
std::string {},
RepetitionPolicy::multiple);
- auto autoScroll = std::make_shared<MenuItem>(
+ auto autoScroll = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_AUTO_SCROLL"},
defaultImg,
"SELECT",
"IDS_MENU_AUTO_SCROLL");
- auto ScreenRotation = std::make_shared<MenuItem>(
+ auto ScreenRotation = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SCREEN_ROTATION"},
defaultImg,
"SELECT",
"IDS_MENU_ROTATE_SCREEN");
- auto gestures = std::make_shared<MenuItem>(
+ auto gestures = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_GESTURES"},
defaultImg,
"SELECT",
"IDS_MENU_GESTURES",
VCONF_KEY_SHOW_GESTURES_MENU_ITEM);
- auto actions = std::make_shared<MenuItem>(
+ auto actions = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_ACTIONS"},
defaultImg,
"SELECT",
"IDS_MENU_ACTIONS",
VCONF_KEY_SHOW_ACTIONS_MENU_ITEM);
- auto settings = std::make_shared<MenuItem>(
+ auto settings = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_SETTINGS"},
defaultImg,
"SELECT",
"IDS_MENU_SETTINGS",
VCONF_KEY_SHOW_SETTINGS_MENU_ITEM);
- auto buttonsAndKeys = std::make_shared<MenuItem>(
+ auto buttonsAndKeys = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_BUTTONS_AND_KEYS"},
defaultImg,
"SELECT",
"IDS_MENU_BUTTONS_KEYS",
VCONF_KEY_SHOW_BUTTONS_AND_KEYS_MENU_ITEM);
- auto editText = std::make_shared<MenuItem>(
+ auto editText = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_EDIT_TEXT"},
defaultImg,
"SELECT",
"IDS_MENU_EDIT_TEXT");
- auto granularitySettings = std::make_shared<MenuItem>(
+ auto granularitySettings = std::make_shared<MenuItemImplementation>(
std::vector<std::string> {"IDS_GRANULARITY_SETTINGS"},
defaultImg,
"SELECT",
"IDS_MENU_GRANULARITY");
- auto emptyItem = std::make_shared<MenuItem>();
-
-
- addToMap("IDS_MENU_MAIN_NORMAL", {tap, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_MAIN_HOME_APPS", {tap, leftPage, rightPage, emptyItem, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_MAIN_SLIDER", {increase, decrease, emptyItem, emptyItem, tap, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_MAIN_EDITABLE_TEXT", {tap, editText, emptyItem, emptyItem, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_MAIN_SIP", {tap, touchHold});
- addToMap("IDS_MENU_MAIN_INCOMING_CALL", {tap, accept, reject, emptyItem, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_MAIN_DURING_CALL", {tap, endCall, emptyItem, emptyItem, gestures, actions, settings, recentApps, homeScreen, back, buttonsAndKeys});
- addToMap("IDS_MENU_GESTURES", {swipeUp, swipeDown, swipeLeft, swipeRight, autoScroll, touchHold, drag, touchHoldThenDrag});
- addToMap("IDS_MENU_ACTIONS", {zoomIn, zoomOut, ScreenRotation, soundVibrationMute, lock, openCloseNotifications, captureScreenshot});
- addToMap("IDS_MENU_ROTATE_SCREEN", {rotateLeft, rotateToPortrait, rotateRight});
- addToMap("IDS_MENU_SETTINGS_AUTO_SCAN_OFF", {scanMethod, scanVerticalDirection, turnOnOffVoice, turnOnOffSound, moreSettings});
- addToMap("IDS_MENU_SETTINGS_AUTO_SCAN_ON", {speedUpScaning, slowDownScaning, scanMethod, scanVerticalDirection, turnOnOffVoice, turnOnOffSound, moreSettings});
- addToMap("IDS_MENU_BUTTONS_KEYS", {ringtoneVolIncrease, ringtoneVolDecrease, mediaVolumeIncrease, mediaVolumeDecrease,
- tapHomeButtonx2, tapHomeButtonx3, viewPowerKeyMenu
- });
- addToMap("IDS_MENU_BUTTONS_KEYS_WIFI", {notiVolumeIncrease, notiVolumeDecrease, mediaVolumeIncrease, mediaVolumeDecrease,
- tapHomeButtonx2, tapHomeButtonx3, viewPowerKeyMenu
- });
- addToMap("IDS_MENU_EDIT_TEXT", {selectionMode, selectAll, previous, next, copy, paste, cut, granularitySettings});
- addToMap("IDS_MENU_AUTO_SCROLL_OFF", {turnOnOffAutoScroll, scrollUp, scrollDown, scrollTop});
- addToMap("IDS_MENU_AUTO_SCROLL_ON", {turnOnOffAutoScroll, speedUpAutoScroll, slowDownAutoScroll});
- addToMap("IDS_MENU_GRANULARITY", {character, word, line, paragraph});
+ auto emptyItem = std::make_shared<MenuItemImplementation>();
+
+
+ addToMap("IDS_MENU_MAIN_NORMAL", {
+ tap, gestures, actions, settings,
+ recentApps, homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_MAIN_HOME_APPS", {
+ tap, leftPage, rightPage, emptyItem,
+ gestures, actions, settings, recentApps,
+ homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_MAIN_SLIDER", {
+ increase, decrease, emptyItem, emptyItem,
+ tap, gestures, actions, settings,
+ recentApps, homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_MAIN_EDITABLE_TEXT", {
+ tap, editText, emptyItem, emptyItem,
+ gestures, actions, settings, recentApps,
+ homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_MAIN_SIP", {
+ tap, touchHold
+ });
+ addToMap("IDS_MENU_MAIN_INCOMING_CALL", {
+ tap, accept, reject, emptyItem,
+ gestures, actions, settings, recentApps,
+ homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_MAIN_DURING_CALL", {
+ tap, endCall, emptyItem, emptyItem,
+ gestures, actions, settings, recentApps,
+ homeScreen, back, buttonsAndKeys
+ });
+ addToMap("IDS_MENU_GESTURES", {
+ swipeUp, swipeDown, swipeLeft, swipeRight,
+ autoScroll, touchHold, drag, touchHoldThenDrag
+ });
+ addToMap("IDS_MENU_ACTIONS", {
+ zoomIn, zoomOut, ScreenRotation, soundVibrationMute,
+ lock, openCloseNotifications, captureScreenshot
+ });
+ addToMap("IDS_MENU_ROTATE_SCREEN", {
+ rotateLeft, rotateToPortrait, rotateRight
+ });
+ addToMap("IDS_MENU_SETTINGS_AUTO_SCAN_OFF", {
+ scanMethod, scanVerticalDirection, turnOnOffVoice, turnOnOffSound,
+ moreSettings
+ });
+ addToMap("IDS_MENU_SETTINGS_AUTO_SCAN_ON", {
+ speedUpScaning, slowDownScaning, scanMethod, scanVerticalDirection,
+ turnOnOffVoice, turnOnOffSound, moreSettings
+ });
+ addToMap("IDS_MENU_BUTTONS_KEYS", {
+ ringtoneVolIncrease, ringtoneVolDecrease, mediaVolumeIncrease, mediaVolumeDecrease,
+ tapHomeButtonx2, tapHomeButtonx3, viewPowerKeyMenu
+ });
+ addToMap("IDS_MENU_BUTTONS_KEYS_WIFI", {
+ notiVolumeIncrease, notiVolumeDecrease, mediaVolumeIncrease, mediaVolumeDecrease,
+ tapHomeButtonx2, tapHomeButtonx3, viewPowerKeyMenu
+ });
+ addToMap("IDS_MENU_EDIT_TEXT", {
+ selectionMode, selectAll, previous, next,
+ copy, paste, cut, granularitySettings
+ });
+ addToMap("IDS_MENU_AUTO_SCROLL_OFF", {
+ turnOnOffAutoScroll, scrollUp, scrollDown, scrollTop
+ });
+ addToMap("IDS_MENU_AUTO_SCROLL_ON", {
+ turnOnOffAutoScroll, speedUpAutoScroll, slowDownAutoScroll
+ });
+ addToMap("IDS_MENU_GRANULARITY", {
+ character, word, line, paragraph
+ });
}
-std::vector<std::shared_ptr<MenuItem>> MenuMap::find(std::string menuLabel)
+std::vector<std::shared_ptr<MenuItem>> MenuMapImplementation::find(std::string menuLabel)
{
if (menuLabel.find("IDS_MENU_MAIN") != std::string::npos &&
std::vector<std::shared_ptr<MenuItem>> foundMenuItems;
auto keyRange = map.equal_range(menuLabel);
for (auto ii = keyRange.first; ii != keyRange.second; ++ii) {
- const auto &showingStateVconfKey = ii->second->getShowingStateVconfKey();
- if (showingStateVconfKey.empty() || Singleton<VConfInterface>::instance().get(showingStateVconfKey.c_str(), false))
+ if (ii->second->isDisplayed())
foundMenuItems.push_back(ii->second);
}
return foundMenuItems;
}
-void MenuMap::addToMap(std::string menuLabel, std::vector<std::shared_ptr<MenuItem>> menuItems)
+void MenuMapImplementation::addToMap(std::string menuLabel, std::vector<std::shared_ptr<MenuItem>> menuItems)
{
while (!menuItems.empty()) {
map.insert(std::make_pair(menuLabel, menuItems.back()));
menuItems.pop_back();
}
}
+
+template<>
+template<>
+std::unique_ptr<MenuMap> Singleton<MenuMap>::createImplementation<MenuMap>()
+{
+ return std::unique_ptr<MenuMap> { new MenuMapImplementation };
+}