summaryrefslogtreecommitdiff
path: root/apps/menus/settings_menu.c
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2016-11-22 06:21:31 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2017-01-17 23:06:17 +0100
commitdc87e9e9f3c383b63c3cb3713886a6c93b6a79d1 (patch)
tree47a6c0d49e7741f91fa74d7230b1267f60617902 /apps/menus/settings_menu.c
parent16a9f84571276a13f4cfd5c66db8cd63ce4e2e7f (diff)
downloadrockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.tar.gz
rockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.zip
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not enable the backlight when pressed. Advanced softlock allows user to choose actions that will not be blocked by screenlock on devices without a hold button. Both only occur in FM and WPS Contexts. Update: Back from the dead -Cleaned up code, removed unnecessary calls, re-arranged last filter action timeout conditional to work in case last_filtered_action_tick was never set -Added entries to the manual -Fixed back button on some menus not activating backlight -Made menus more intuitive, no actions selected now changes menu item to off. -Added talk fuctionality. -Added option to disable selective backlight while on external power. -Rewrote backlight and softlock handling code to fix issue with scrollwheels -Menu changed to have toggle(yes/no) and settings -Optimized selective actions lookup -Added option to disable notification of 'buttons locked' while softlocked -Removed uneeded code, consolidated action lookup to single function -Fixed incorrect name on selective softlock menu -Added option to disable touch on touchscreen devices -Fixed backlight on original screenlock without selective screenlock active -Added text selection in mask_select for when show_icons is off -Fixed voice in mask_select to speak if voice is defined instead of spelling -Added more lang defines (play skip seek) -Added option to disable unknown keys turning on backlight -Fixed Conditional argument In wrong place causing players without backlight to fail to build -Fixed Disable Unknown blocking detection of context change -Fixed canceling menu didn't update new settings -Added Autolock on backlight off -Removed backlight_on_force from backlight.c, Now sets ignore next to false and uses backlight_on -Cleaned up autolock code added strings to lang file -Fixed issue where rapid presses would bypass softlock -Removed old softlock code, Cleaned selective actions code -Changed menu to match existing RB menus -Fixed Backlight_on_Hold blocked by backlight_ignore_next -Fixed ignore_next for ipod -Fixed bug allowing context with softlock to bypass selective backlight -Changed mask_select to no longer prompt for changes to be saved -Changed menu names -Added ignore timeout to allow ipod scroll wheel to work properly and other players to still work properly, removed some previous code including ignore_event -Increased ignore timeout to prevent sd card accesses from interrupting action code and turning on backlight -Changed Unknown action to unmapped action in menu, changed handling code -Removed unneeded logic and variables for handling unfiltered actions -Reverted unmapped action code to previous functionality -Added manual entries (thanks JohnB) -Removed elusive unhandled unicode character from manual, changed formatting slightly Actions: Volume,Play,Seek,Skip Extras: Disable unmapped actions Disable selective backlight on external power Disable touch during softlock on touchscreen devices Disable softlock notifications (power button still notifies) Autolock on backlight off Method: Adds a function to ignore backlight on next call If selected action occurs backlight is forced on, Filter_first_keypress stays intact. Selective softlock allows selected actions through, bypasses the normal softlock routine. ToDo: DONE previous commit (#1) has attribution for folder_select.c which mask_select is based from. Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r--apps/menus/settings_menu.c83
1 files changed, 77 insertions, 6 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index f42550cc6a..5c99cb4cd4 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -49,12 +49,67 @@
49#include "dircache.h" 49#include "dircache.h"
50#endif 50#endif
51#include "folder_select.h" 51#include "folder_select.h"
52 52#ifndef HAS_BUTTON_HOLD
53#include "mask_select.h"
54#endif
53#if defined(DX50) || defined(DX90) 55#if defined(DX50) || defined(DX90)
54#include "governor-ibasso.h" 56#include "governor-ibasso.h"
55#include "usb-ibasso.h" 57#include "usb-ibasso.h"
56#endif 58#endif
57 59
60#ifndef HAS_BUTTON_HOLD
61static int selectivesoftlock_callback(int action,
62 const struct menu_item_ex *this_item)
63{
64 (void)this_item;
65
66 switch (action)
67 {
68 case ACTION_STD_MENU:
69 case ACTION_STD_CANCEL:
70 case ACTION_EXIT_MENUITEM:
71 set_selective_softlock_actions(
72 global_settings.bt_selective_softlock_actions,
73 global_settings.bt_selective_softlock_actions_mask);
74 break;
75 }
76
77 return action;
78}
79
80static int selectivesoftlock_set_mask(void* param)
81{
82 (void)param;
83int mask = global_settings.bt_selective_softlock_actions_mask;
84 struct s_mask_items maskitems[]={
85 {ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
86 {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
87 {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
88 {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
89 #ifdef HAVE_BACKLIGHT
90 {ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
91 #endif
92 #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
93 {ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
94 #endif
95 {ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
96 };
97
98 mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
99 , maskitems,ARRAYLEN(maskitems));
100
101 if (mask == SEL_ACTION_NONE)
102 global_settings.bt_selective_softlock_actions = false;
103 else if (global_settings.bt_selective_softlock_actions_mask != mask)
104 global_settings.bt_selective_softlock_actions = true;
105
106 global_settings.bt_selective_softlock_actions_mask = mask;
107
108 return true;
109}
110
111#endif /* !HAS_BUTTON_HOLD */
112
58/***********************************/ 113/***********************************/
59/* TAGCACHE MENU */ 114/* TAGCACHE MENU */
60#ifdef HAVE_TAGCACHE 115#ifdef HAVE_TAGCACHE
@@ -137,7 +192,7 @@ static int clear_start_directory(void)
137 splash(HZ, ID2P(LANG_RESET_DONE_CLEAR)); 192 splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
138 return false; 193 return false;
139} 194}
140MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR), 195MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
141 clear_start_directory, NULL, NULL, Icon_file_view_menu); 196 clear_start_directory, NULL, NULL, Icon_file_view_menu);
142static int fileview_callback(int action,const struct menu_item_ex *this_item) 197static int fileview_callback(int action,const struct menu_item_ex *this_item)
143{ 198{
@@ -330,6 +385,19 @@ MENUITEM_SETTING(touchpad_deadzone, &global_settings.touchpad_deadzone, NULL);
330MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL); 385MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL);
331#endif 386#endif
332 387
388#ifndef HAS_BUTTON_HOLD
389
390MENUITEM_SETTING(bt_selective_actions,
391 &global_settings.bt_selective_softlock_actions,
392 selectivesoftlock_callback);
393MENUITEM_FUNCTION(sel_softlock_mask, 0, ID2P(LANG_SETTINGS),
394 selectivesoftlock_set_mask, NULL,
395 selectivesoftlock_callback, Icon_Menu_setting);
396
397MAKE_MENU(sel_softlock, ID2P(LANG_SOFTLOCK_SELECTIVE),
398 NULL, Icon_Menu_setting, &bt_selective_actions, &sel_softlock_mask);
399#endif /* !HAS_BUTTON_HOLD */
400
333#if defined(DX50) || defined(DX90) 401#if defined(DX50) || defined(DX90)
334MENUITEM_SETTING(governor, &global_settings.governor, NULL); 402MENUITEM_SETTING(governor, &global_settings.governor, NULL);
335MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL); 403MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
@@ -380,6 +448,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
380#ifdef HAVE_TOUCHPAD_DEADZONE 448#ifdef HAVE_TOUCHPAD_DEADZONE
381 &touchpad_deadzone, 449 &touchpad_deadzone,
382#endif 450#endif
451#ifndef HAS_BUTTON_HOLD
452 &sel_softlock,
453#endif
383#ifdef USB_ENABLE_HID 454#ifdef USB_ENABLE_HID
384 &usb_hid, 455 &usb_hid,
385 &usb_keypad_mode, 456 &usb_keypad_mode,
@@ -544,7 +615,7 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
544/***********************************/ 615/***********************************/
545/* AUTORESUME MENU */ 616/* AUTORESUME MENU */
546#ifdef HAVE_TAGCACHE 617#ifdef HAVE_TAGCACHE
547#if CONFIG_CODEC == SWCODEC 618#if CONFIG_CODEC == SWCODEC
548 619
549static int autoresume_callback(int action, const struct menu_item_ex *this_item) 620static int autoresume_callback(int action, const struct menu_item_ex *this_item)
550{ 621{
@@ -557,7 +628,7 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item)
557 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), 628 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
558 ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; 629 ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
559 static const struct text_message message = {lines, 2}; 630 static const struct text_message message = {lines, 2};
560 631
561 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) 632 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
562 tagcache_rebuild_with_splash(); 633 tagcache_rebuild_with_splash();
563 } 634 }
@@ -672,9 +743,9 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
672 &startup_shutdown_menu, 743 &startup_shutdown_menu,
673 &bookmark_settings_menu, 744 &bookmark_settings_menu,
674#ifdef HAVE_TAGCACHE 745#ifdef HAVE_TAGCACHE
675#if CONFIG_CODEC == SWCODEC 746#if CONFIG_CODEC == SWCODEC
676 &autoresume_menu, 747 &autoresume_menu,
677#endif 748#endif
678#endif 749#endif
679 &browse_langs, &voice_settings_menu, 750 &browse_langs, &voice_settings_menu,
680#ifdef HAVE_HOTKEY 751#ifdef HAVE_HOTKEY