2007-02-08 04:33:41 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-02-13 00:32:17 +00:00
|
|
|
* $Id$
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limits.h>
|
2007-02-13 07:50:47 +00:00
|
|
|
#include <string.h>
|
2007-02-08 04:33:41 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "menu.h"
|
2011-02-08 20:31:35 +00:00
|
|
|
#include "keyboard.h"
|
2007-02-08 04:33:41 +00:00
|
|
|
#include "sound_menu.h"
|
2007-02-13 07:50:47 +00:00
|
|
|
#include "exported_menus.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "tagtree.h"
|
|
|
|
#include "usb.h"
|
|
|
|
#include "splash.h"
|
2011-02-08 20:31:22 +00:00
|
|
|
#include "yesno.h"
|
2007-02-13 07:50:47 +00:00
|
|
|
#include "talk.h"
|
2008-04-20 18:28:25 +00:00
|
|
|
#include "powermgmt.h"
|
|
|
|
#include "playback.h"
|
|
|
|
#if CONFIG_RTC
|
|
|
|
#include "screens.h"
|
|
|
|
#endif
|
2008-11-03 11:11:07 +00:00
|
|
|
#include "quickscreen.h"
|
2009-03-08 20:28:15 +00:00
|
|
|
#ifdef HAVE_DIRCACHE
|
|
|
|
#include "dircache.h"
|
|
|
|
#endif
|
2012-07-18 21:32:14 +00:00
|
|
|
#include "folder_select.h"
|
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
2016-11-22 05:21:31 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
#include "mask_select.h"
|
|
|
|
#endif
|
2015-01-30 21:47:30 +00:00
|
|
|
#if defined(DX50) || defined(DX90)
|
|
|
|
#include "governor-ibasso.h"
|
2015-01-21 19:51:36 +00:00
|
|
|
#include "usb-ibasso.h"
|
2015-01-30 21:47:30 +00:00
|
|
|
#endif
|
|
|
|
|
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
2016-11-22 05:21:31 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
static int selectivesoftlock_callback(int action,
|
2020-07-19 17:42:04 +00:00
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
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
2016-11-22 05:21:31 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
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
2016-11-22 05:21:31 +00:00
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_STD_MENU:
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
set_selective_softlock_actions(
|
|
|
|
global_settings.bt_selective_softlock_actions,
|
|
|
|
global_settings.bt_selective_softlock_actions_mask);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int selectivesoftlock_set_mask(void* param)
|
|
|
|
{
|
|
|
|
(void)param;
|
|
|
|
int mask = global_settings.bt_selective_softlock_actions_mask;
|
|
|
|
struct s_mask_items maskitems[]={
|
|
|
|
{ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
|
|
|
|
{ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
|
|
|
|
{ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
|
|
|
|
{ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
{ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
|
|
|
|
{ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
|
|
|
|
#endif
|
|
|
|
{ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
|
|
|
|
};
|
|
|
|
|
|
|
|
mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
|
|
|
|
, maskitems,ARRAYLEN(maskitems));
|
|
|
|
|
|
|
|
if (mask == SEL_ACTION_NONE)
|
|
|
|
global_settings.bt_selective_softlock_actions = false;
|
|
|
|
else if (global_settings.bt_selective_softlock_actions_mask != mask)
|
|
|
|
global_settings.bt_selective_softlock_actions = true;
|
|
|
|
|
|
|
|
global_settings.bt_selective_softlock_actions_mask = mask;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !HAS_BUTTON_HOLD */
|
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
/***********************************/
|
|
|
|
/* TAGCACHE MENU */
|
|
|
|
#ifdef HAVE_TAGCACHE
|
2007-03-07 19:56:15 +00:00
|
|
|
|
|
|
|
static void tagcache_rebuild_with_splash(void)
|
|
|
|
{
|
|
|
|
tagcache_rebuild();
|
2008-12-25 03:23:22 +00:00
|
|
|
splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
2007-03-07 19:56:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void tagcache_update_with_splash(void)
|
|
|
|
{
|
|
|
|
tagcache_update();
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
2007-03-07 19:56:15 +00:00
|
|
|
}
|
|
|
|
|
2012-07-18 21:36:57 +00:00
|
|
|
static int dirs_to_scan(void)
|
|
|
|
{
|
|
|
|
if (folder_select(global_settings.tagcache_scan_paths,
|
|
|
|
sizeof(global_settings.tagcache_scan_paths)))
|
|
|
|
{
|
|
|
|
static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
|
|
|
|
ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
|
|
|
|
static const struct text_message message = {lines, 2};
|
|
|
|
|
|
|
|
if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
|
|
|
|
tagcache_rebuild_with_splash();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
#ifdef HAVE_TC_RAMCACHE
|
|
|
|
MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
|
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(tc_init, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
|
2008-12-25 03:23:22 +00:00
|
|
|
(int(*)(void))tagcache_rebuild_with_splash,
|
2007-03-18 07:03:43 +00:00
|
|
|
NULL, NULL, Icon_NOICON);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(tc_update, 0, ID2P(LANG_TAGCACHE_UPDATE),
|
2008-12-25 03:23:22 +00:00
|
|
|
(int(*)(void))tagcache_update_with_splash,
|
2007-03-18 07:03:43 +00:00
|
|
|
NULL, NULL, Icon_NOICON);
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
|
2018-10-16 03:04:04 +00:00
|
|
|
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT),
|
2018-10-16 03:04:04 +00:00
|
|
|
tagtree_export, NULL,
|
2007-03-17 12:33:34 +00:00
|
|
|
NULL, Icon_NOICON);
|
2018-10-16 03:04:04 +00:00
|
|
|
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT),
|
2018-10-16 03:04:04 +00:00
|
|
|
tagtree_import, NULL,
|
2007-03-17 12:33:34 +00:00
|
|
|
NULL, Icon_NOICON);
|
2012-07-18 21:36:57 +00:00
|
|
|
MENUITEM_FUNCTION(tc_paths, 0, ID2P(LANG_SELECT_DATABASE_DIRS),
|
|
|
|
dirs_to_scan, NULL, NULL, Icon_NOICON);
|
|
|
|
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON,
|
2007-02-13 07:50:47 +00:00
|
|
|
#ifdef HAVE_TC_RAMCACHE
|
|
|
|
&tagcache_ram,
|
|
|
|
#endif
|
|
|
|
&tagcache_autoupdate, &tc_init, &tc_update, &runtimedb,
|
2012-07-18 21:36:57 +00:00
|
|
|
&tc_export, &tc_import, &tc_paths
|
|
|
|
);
|
2007-02-13 07:50:47 +00:00
|
|
|
#endif /* HAVE_TAGCACHE */
|
|
|
|
/* TAGCACHE MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* FILE VIEW MENU */
|
2020-07-19 17:42:04 +00:00
|
|
|
static int fileview_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list);
|
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL);
|
|
|
|
MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback);
|
|
|
|
MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback);
|
2009-03-01 17:55:59 +00:00
|
|
|
MENUITEM_SETTING(interpret_numbers, &global_settings.interpret_numbers, fileview_callback);
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(dirfilter, &global_settings.dirfilter, NULL);
|
2007-08-13 19:29:49 +00:00
|
|
|
MENUITEM_SETTING(show_filename_ext, &global_settings.show_filename_ext, NULL);
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(browse_current, &global_settings.browse_current, NULL);
|
|
|
|
MENUITEM_SETTING(show_path_in_browser, &global_settings.show_path_in_browser, NULL);
|
2010-10-04 10:34:38 +00:00
|
|
|
static int clear_start_directory(void)
|
|
|
|
{
|
|
|
|
strcpy(global_settings.start_directory, "/");
|
|
|
|
settings_save();
|
|
|
|
splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
|
|
|
|
return false;
|
|
|
|
}
|
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
2016-11-22 05:21:31 +00:00
|
|
|
MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
|
2010-10-04 10:34:38 +00:00
|
|
|
clear_start_directory, NULL, NULL, Icon_file_view_menu);
|
2020-07-19 17:42:04 +00:00
|
|
|
static int fileview_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-13 07:50:47 +00:00
|
|
|
static int oldval;
|
|
|
|
int *variable = this_item->variable;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_ENTER_MENUITEM: /* on entering an item */
|
|
|
|
oldval = *variable;
|
|
|
|
break;
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
if (*variable != oldval)
|
|
|
|
reload_directory(); /* force reload if this has changed */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, Icon_file_view_menu,
|
2009-03-01 17:55:59 +00:00
|
|
|
&sort_case, &sort_dir, &sort_file, &interpret_numbers,
|
2007-08-13 19:29:49 +00:00
|
|
|
&dirfilter, &show_filename_ext, &browse_current,
|
2010-10-04 10:34:38 +00:00
|
|
|
&show_path_in_browser,
|
|
|
|
&clear_start_directory_item
|
2008-01-13 09:29:45 +00:00
|
|
|
);
|
2007-02-13 07:50:47 +00:00
|
|
|
/* FILE VIEW MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* SYSTEM MENU */
|
|
|
|
|
|
|
|
/* Battery */
|
2007-07-15 03:56:04 +00:00
|
|
|
#if BATTERY_CAPACITY_INC > 0
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL);
|
2007-07-15 03:56:04 +00:00
|
|
|
#endif
|
|
|
|
#if BATTERY_TYPES_COUNT > 1
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL);
|
2007-07-15 03:56:04 +00:00
|
|
|
#endif
|
2012-12-26 17:01:19 +00:00
|
|
|
#ifdef HAVE_USB_CHARGING_ENABLE
|
2020-07-19 17:42:04 +00:00
|
|
|
static int usbcharging_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-13 07:50:47 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
usb_charging_enable(global_settings.usb_charging);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(usb_charging, &global_settings.usb_charging, usbcharging_callback);
|
2008-12-03 19:54:25 +00:00
|
|
|
#endif /* HAVE_USB_CHARGING_ENABLE */
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON,
|
2010-09-01 23:49:28 +00:00
|
|
|
#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
|
2007-07-15 03:56:04 +00:00
|
|
|
&battery_capacity,
|
|
|
|
#endif
|
2007-02-13 07:50:47 +00:00
|
|
|
#if BATTERY_TYPES_COUNT > 1
|
|
|
|
&battery_type,
|
|
|
|
#endif
|
2012-12-26 17:01:19 +00:00
|
|
|
#ifdef HAVE_USB_CHARGING_ENABLE
|
2007-02-13 07:50:47 +00:00
|
|
|
&usb_charging,
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
/* Disk */
|
2008-10-07 19:37:33 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL);
|
2007-08-01 08:50:44 +00:00
|
|
|
#endif
|
2007-02-13 07:50:47 +00:00
|
|
|
#ifdef HAVE_DIRCACHE
|
2020-07-19 17:42:04 +00:00
|
|
|
static int dircache_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-13 07:50:47 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
if (global_settings.dircache)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
if (dircache_enable() < 0)
|
2011-08-30 21:07:46 +00:00
|
|
|
splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
|
|
|
|
}
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
else
|
2011-08-30 21:07:46 +00:00
|
|
|
{
|
|
|
|
dircache_disable();
|
2007-02-13 07:50:47 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(dircache, &global_settings.dircache, dircache_callback);
|
|
|
|
#endif
|
2008-10-07 19:37:33 +00:00
|
|
|
#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON,
|
2008-10-07 19:37:33 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2007-02-13 07:50:47 +00:00
|
|
|
&disk_spindown,
|
2007-08-01 08:50:44 +00:00
|
|
|
#endif
|
2007-02-13 07:50:47 +00:00
|
|
|
#ifdef HAVE_DIRCACHE
|
|
|
|
&dircache,
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Limits menu */
|
|
|
|
MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL);
|
|
|
|
MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL);
|
2011-11-20 15:41:17 +00:00
|
|
|
MENUITEM_SETTING(default_glyphs, &global_settings.glyphs_to_cache, NULL);
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON,
|
2011-11-19 23:34:26 +00:00
|
|
|
&max_files_in_dir, &max_files_in_playlist
|
|
|
|
,&default_glyphs
|
|
|
|
);
|
2007-02-13 07:50:47 +00:00
|
|
|
|
2008-01-21 09:48:44 +00:00
|
|
|
|
|
|
|
/* Keyclick menu */
|
|
|
|
MENUITEM_SETTING(keyclick, &global_settings.keyclick, NULL);
|
|
|
|
MENUITEM_SETTING(keyclick_repeats, &global_settings.keyclick_repeats, NULL);
|
2011-11-16 10:25:43 +00:00
|
|
|
#ifdef HAVE_HARDWARE_CLICK
|
|
|
|
MENUITEM_SETTING(keyclick_hardware, &global_settings.keyclick_hardware, NULL);
|
|
|
|
MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
|
|
|
|
&keyclick, &keyclick_hardware, &keyclick_repeats);
|
|
|
|
#else
|
2008-01-21 09:48:44 +00:00
|
|
|
MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
|
|
|
|
&keyclick, &keyclick_repeats);
|
|
|
|
#endif
|
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
|
2019-01-02 02:05:13 +00:00
|
|
|
MENUITEM_SETTING(car_adapter_mode_delay, &global_settings.car_adapter_mode_delay, NULL);
|
|
|
|
MAKE_MENU(car_adapter_mode_menu, ID2P(LANG_CAR_ADAPTER_MODE), 0, Icon_NOICON,
|
|
|
|
&car_adapter_mode, &car_adapter_mode_delay);
|
2007-02-13 07:50:47 +00:00
|
|
|
#endif
|
2008-12-25 01:46:16 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
|
|
|
MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL);
|
|
|
|
#endif
|
2008-04-20 18:28:25 +00:00
|
|
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
|
|
|
MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
|
|
|
|
#endif
|
2010-03-20 15:02:29 +00:00
|
|
|
#ifdef HAVE_LINEOUT_POWEROFF
|
|
|
|
MENUITEM_SETTING(lineout_onoff, &global_settings.lineout_active, NULL);
|
|
|
|
#endif
|
2009-09-30 10:06:04 +00:00
|
|
|
#ifdef USB_ENABLE_HID
|
2009-10-23 13:29:19 +00:00
|
|
|
MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL);
|
2009-09-30 10:06:04 +00:00
|
|
|
MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL);
|
|
|
|
#endif
|
2011-09-09 16:15:35 +00:00
|
|
|
#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
|
|
|
|
MENUITEM_SETTING(usb_skip_first_drive, &global_settings.usb_skip_first_drive, NULL);
|
|
|
|
#endif
|
2007-02-13 07:50:47 +00:00
|
|
|
|
2009-11-08 13:14:50 +00:00
|
|
|
#ifdef HAVE_MORSE_INPUT
|
|
|
|
MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL);
|
|
|
|
#endif
|
|
|
|
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2007-10-07 15:02:02 +00:00
|
|
|
MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL);
|
2007-04-22 13:02:24 +00:00
|
|
|
#endif
|
|
|
|
|
2007-05-08 06:45:38 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL);
|
|
|
|
#endif
|
|
|
|
|
2008-05-29 21:27:44 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
|
|
|
MENUITEM_SETTING(touchpad_sensitivity, &global_settings.touchpad_sensitivity, NULL);
|
|
|
|
#endif
|
|
|
|
|
2013-12-01 18:25:42 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_DEADZONE
|
|
|
|
MENUITEM_SETTING(touchpad_deadzone, &global_settings.touchpad_deadzone, NULL);
|
|
|
|
#endif
|
|
|
|
|
2012-03-27 13:38:30 +00:00
|
|
|
#ifdef HAVE_QUICKSCREEN
|
|
|
|
MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL);
|
|
|
|
#endif
|
|
|
|
|
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
2016-11-22 05:21:31 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
|
|
|
|
MENUITEM_SETTING(bt_selective_actions,
|
|
|
|
&global_settings.bt_selective_softlock_actions,
|
|
|
|
selectivesoftlock_callback);
|
|
|
|
MENUITEM_FUNCTION(sel_softlock_mask, 0, ID2P(LANG_SETTINGS),
|
|
|
|
selectivesoftlock_set_mask, NULL,
|
|
|
|
selectivesoftlock_callback, Icon_Menu_setting);
|
|
|
|
|
|
|
|
MAKE_MENU(sel_softlock, ID2P(LANG_SOFTLOCK_SELECTIVE),
|
|
|
|
NULL, Icon_Menu_setting, &bt_selective_actions, &sel_softlock_mask);
|
|
|
|
#endif /* !HAS_BUTTON_HOLD */
|
|
|
|
|
2015-01-30 21:47:30 +00:00
|
|
|
#if defined(DX50) || defined(DX90)
|
|
|
|
MENUITEM_SETTING(governor, &global_settings.governor, NULL);
|
2015-01-21 19:51:36 +00:00
|
|
|
MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
|
2015-01-30 21:47:30 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-25 03:23:22 +00:00
|
|
|
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
|
2007-03-03 13:52:14 +00:00
|
|
|
0, Icon_System_menu,
|
2007-08-12 19:49:03 +00:00
|
|
|
#if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1)
|
2007-02-13 07:50:47 +00:00
|
|
|
&battery_menu,
|
|
|
|
#endif
|
2008-10-07 19:37:33 +00:00
|
|
|
#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
|
2007-02-13 07:50:47 +00:00
|
|
|
&disk_menu,
|
|
|
|
#endif
|
|
|
|
&limits_menu,
|
2012-03-27 13:38:30 +00:00
|
|
|
#ifdef HAVE_QUICKSCREEN
|
|
|
|
&shortcuts_replaces_quickscreen,
|
|
|
|
#endif
|
2009-11-08 13:14:50 +00:00
|
|
|
#ifdef HAVE_MORSE_INPUT
|
|
|
|
&morse_input,
|
|
|
|
#endif
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2019-01-02 02:05:13 +00:00
|
|
|
&car_adapter_mode_menu,
|
2007-04-22 13:02:24 +00:00
|
|
|
#endif
|
2008-12-25 03:23:22 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
2009-11-08 13:14:50 +00:00
|
|
|
&serial_bitrate,
|
2008-12-25 01:46:16 +00:00
|
|
|
#endif
|
2008-04-20 18:28:25 +00:00
|
|
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
|
|
|
&accessory_supply,
|
|
|
|
#endif
|
2010-03-20 15:02:29 +00:00
|
|
|
#ifdef HAVE_LINEOUT_POWEROFF
|
|
|
|
&lineout_onoff,
|
|
|
|
#endif
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2007-10-07 15:02:02 +00:00
|
|
|
&buttonlight_timeout,
|
2007-05-08 06:45:38 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
2008-01-21 09:48:44 +00:00
|
|
|
&buttonlight_brightness,
|
|
|
|
#endif
|
|
|
|
&keyclick_menu,
|
2008-05-29 21:27:44 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
|
|
|
&touchpad_sensitivity,
|
2009-09-30 10:06:04 +00:00
|
|
|
#endif
|
2013-12-01 18:25:42 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_DEADZONE
|
|
|
|
&touchpad_deadzone,
|
|
|
|
#endif
|
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
2016-11-22 05:21:31 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
&sel_softlock,
|
|
|
|
#endif
|
2009-09-30 10:06:04 +00:00
|
|
|
#ifdef USB_ENABLE_HID
|
2009-10-23 13:29:19 +00:00
|
|
|
&usb_hid,
|
2009-09-30 10:06:04 +00:00
|
|
|
&usb_keypad_mode,
|
2011-09-09 16:15:35 +00:00
|
|
|
#endif
|
|
|
|
#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
|
|
|
|
&usb_skip_first_drive,
|
2007-02-13 07:50:47 +00:00
|
|
|
#endif
|
2015-01-30 21:47:30 +00:00
|
|
|
|
|
|
|
#if defined(DX50) || defined(DX90)
|
|
|
|
&governor,
|
2015-01-21 19:51:36 +00:00
|
|
|
&usb_mode,
|
2015-01-30 21:47:30 +00:00
|
|
|
#endif
|
2007-02-13 07:50:47 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* SYSTEM MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
2011-12-26 08:26:38 +00:00
|
|
|
/***********************************/
|
|
|
|
/* STARTUP/SHUTDOWN MENU */
|
|
|
|
|
|
|
|
/* sleep timer option */
|
|
|
|
const char* sleep_timer_formatter(char* buffer, size_t buffer_size,
|
|
|
|
int value, const char* unit)
|
|
|
|
{
|
|
|
|
(void) unit;
|
|
|
|
int minutes, hours;
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
hours = value / 60;
|
|
|
|
minutes = value - (hours * 60);
|
|
|
|
snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
|
|
|
|
return buffer;
|
|
|
|
} else {
|
|
|
|
return str(LANG_OFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int seconds_to_min(int secs)
|
|
|
|
{
|
|
|
|
return (secs + 10) / 60; /* round up for 50+ seconds */
|
|
|
|
}
|
|
|
|
|
2012-03-29 06:58:31 +00:00
|
|
|
/* A string representation of either whether a sleep timer will be started or
|
|
|
|
canceled, and how long it will be or how long is remaining in brackets */
|
2019-09-20 08:07:29 +00:00
|
|
|
static char* sleep_timer_getname(int selected_item, void * data,
|
|
|
|
char *buffer, size_t buffer_len)
|
2011-12-26 08:26:38 +00:00
|
|
|
{
|
|
|
|
(void)selected_item;
|
|
|
|
(void)data;
|
|
|
|
int sec = get_sleep_timer();
|
|
|
|
char timer_buf[10];
|
2019-09-20 08:07:29 +00:00
|
|
|
|
|
|
|
snprintf(buffer, buffer_len, "%s (%s)",
|
2012-03-29 06:58:31 +00:00
|
|
|
str(sec ? LANG_SLEEP_TIMER_CANCEL_CURRENT
|
|
|
|
: LANG_SLEEP_TIMER_START_CURRENT),
|
|
|
|
sleep_timer_formatter(timer_buf, sizeof(timer_buf),
|
|
|
|
sec ? seconds_to_min(sec)
|
|
|
|
: global_settings.sleeptimer_duration, NULL));
|
2011-12-26 08:26:38 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sleep_timer_voice(int selected_item, void*data)
|
|
|
|
{
|
|
|
|
(void)selected_item;
|
|
|
|
(void)data;
|
|
|
|
int seconds = get_sleep_timer();
|
2012-03-29 06:58:31 +00:00
|
|
|
long talk_ids[] = {
|
|
|
|
seconds ? LANG_SLEEP_TIMER_CANCEL_CURRENT
|
|
|
|
: LANG_SLEEP_TIMER_START_CURRENT,
|
|
|
|
VOICE_PAUSE,
|
|
|
|
(seconds ? seconds_to_min(seconds)
|
|
|
|
: global_settings.sleeptimer_duration) | UNIT_MIN << UNIT_SHIFT,
|
|
|
|
TALK_FINAL_ID
|
|
|
|
};
|
|
|
|
talk_idarray(talk_ids, true);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a sleep timer is running, cancel it, otherwise start one */
|
|
|
|
static int toggle_sleeptimer(void)
|
|
|
|
{
|
2012-10-05 19:30:13 +00:00
|
|
|
set_sleeptimer_duration(get_sleep_timer() ? 0
|
|
|
|
: global_settings.sleeptimer_duration);
|
2012-03-29 06:58:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle restarting a current sleep timer to the newly set default
|
|
|
|
duration */
|
|
|
|
static int sleeptimer_duration_cb(int action,
|
2020-07-19 17:42:04 +00:00
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2012-03-29 06:58:31 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2012-03-29 06:58:31 +00:00
|
|
|
static int initial_duration;
|
|
|
|
switch (action)
|
2011-12-26 08:26:38 +00:00
|
|
|
{
|
2012-03-29 06:58:31 +00:00
|
|
|
case ACTION_ENTER_MENUITEM:
|
|
|
|
initial_duration = global_settings.sleeptimer_duration;
|
|
|
|
break;
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
if (initial_duration != global_settings.sleeptimer_duration
|
|
|
|
&& get_sleep_timer())
|
2012-10-06 12:01:35 +00:00
|
|
|
set_sleeptimer_duration(global_settings.sleeptimer_duration);
|
2011-12-26 08:26:38 +00:00
|
|
|
}
|
2012-03-29 06:58:31 +00:00
|
|
|
return action;
|
2011-12-26 08:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
|
|
|
|
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
|
2012-03-29 06:58:31 +00:00
|
|
|
MENUITEM_FUNCTION_DYNTEXT(sleeptimer_toggle, 0, toggle_sleeptimer, NULL,
|
|
|
|
sleep_timer_getname, sleep_timer_voice, NULL,
|
|
|
|
NULL, Icon_NOICON);
|
|
|
|
MENUITEM_SETTING(sleeptimer_duration,
|
|
|
|
&global_settings.sleeptimer_duration,
|
|
|
|
sleeptimer_duration_cb);
|
2011-12-26 08:26:38 +00:00
|
|
|
MENUITEM_SETTING(sleeptimer_on_startup,
|
|
|
|
&global_settings.sleeptimer_on_startup, NULL);
|
2011-12-26 09:30:25 +00:00
|
|
|
MENUITEM_SETTING(keypress_restarts_sleeptimer,
|
|
|
|
&global_settings.keypress_restarts_sleeptimer, NULL);
|
2011-12-26 08:26:38 +00:00
|
|
|
|
|
|
|
MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
|
|
|
|
0, Icon_System_menu,
|
|
|
|
&start_screen,
|
|
|
|
&poweroff,
|
2012-03-29 06:58:31 +00:00
|
|
|
&sleeptimer_toggle,
|
|
|
|
&sleeptimer_duration,
|
2011-12-26 09:30:25 +00:00
|
|
|
&sleeptimer_on_startup,
|
|
|
|
&keypress_restarts_sleeptimer
|
2011-12-26 08:26:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* STARTUP/SHUTDOWN MENU */
|
|
|
|
/***********************************/
|
2007-02-13 07:50:47 +00:00
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* BOOKMARK MENU */
|
2020-07-19 17:42:04 +00:00
|
|
|
static int bmark_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-13 07:50:47 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
if(global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_YES ||
|
|
|
|
global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
|
|
|
|
{
|
|
|
|
if(global_settings.usemrb == BOOKMARK_NO)
|
|
|
|
global_settings.usemrb = BOOKMARK_YES;
|
2008-12-25 03:23:22 +00:00
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(autocreatebookmark,
|
|
|
|
&global_settings.autocreatebookmark, bmark_callback);
|
2010-07-05 16:39:00 +00:00
|
|
|
MENUITEM_SETTING(autoupdatebookmark, &global_settings.autoupdatebookmark, NULL);
|
2007-02-13 07:50:47 +00:00
|
|
|
MENUITEM_SETTING(autoloadbookmark, &global_settings.autoloadbookmark, NULL);
|
|
|
|
MENUITEM_SETTING(usemrb, &global_settings.usemrb, NULL);
|
|
|
|
MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
|
2007-03-03 13:52:14 +00:00
|
|
|
Icon_Bookmark,
|
2010-07-05 16:39:00 +00:00
|
|
|
&autocreatebookmark, &autoupdatebookmark, &autoloadbookmark, &usemrb);
|
2007-02-13 07:50:47 +00:00
|
|
|
/* BOOKMARK MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
2011-02-08 20:31:35 +00:00
|
|
|
/***********************************/
|
|
|
|
/* AUTORESUME MENU */
|
|
|
|
#ifdef HAVE_TAGCACHE
|
|
|
|
|
2020-07-19 17:42:04 +00:00
|
|
|
static int autoresume_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2011-02-08 20:31:35 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2011-02-08 20:31:35 +00:00
|
|
|
|
|
|
|
if (action == ACTION_EXIT_MENUITEM /* on exit */
|
|
|
|
&& global_settings.autoresume_enable
|
|
|
|
&& !tagcache_is_usable())
|
|
|
|
{
|
|
|
|
static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
|
|
|
|
ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
|
|
|
|
static const struct text_message message = {lines, 2};
|
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
2016-11-22 05:21:31 +00:00
|
|
|
|
2011-02-08 20:31:35 +00:00
|
|
|
if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
|
|
|
|
tagcache_rebuild_with_splash();
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int autoresume_nexttrack_callback(int action,
|
2020-07-19 17:42:04 +00:00
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2011-02-08 20:31:35 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2011-02-08 20:31:35 +00:00
|
|
|
static int oldval = 0;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_ENTER_MENUITEM:
|
|
|
|
oldval = global_settings.autoresume_automatic;
|
|
|
|
break;
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
if (global_settings.autoresume_automatic == AUTORESUME_NEXTTRACK_CUSTOM
|
2012-07-18 21:32:14 +00:00
|
|
|
&& !folder_select(global_settings.autoresume_paths,
|
|
|
|
MAX_PATHNAME+1))
|
2011-02-08 20:31:35 +00:00
|
|
|
{
|
|
|
|
global_settings.autoresume_automatic = oldval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable,
|
|
|
|
autoresume_callback);
|
|
|
|
MENUITEM_SETTING(autoresume_automatic, &global_settings.autoresume_automatic,
|
|
|
|
autoresume_nexttrack_callback);
|
|
|
|
|
|
|
|
MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME),
|
|
|
|
0, Icon_NOICON,
|
|
|
|
&autoresume_enable, &autoresume_automatic);
|
|
|
|
|
|
|
|
#endif /* HAVE_TAGCACHE */
|
|
|
|
/* AUTORESUME MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
/***********************************/
|
|
|
|
/* VOICE MENU */
|
2020-07-19 17:42:04 +00:00
|
|
|
static int talk_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list);
|
|
|
|
|
2007-06-07 09:24:53 +00:00
|
|
|
MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL);
|
|
|
|
MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL);
|
|
|
|
MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback);
|
|
|
|
MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL);
|
|
|
|
MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback);
|
2020-07-19 17:42:04 +00:00
|
|
|
static int talk_callback(int action,
|
|
|
|
const struct menu_item_ex *this_item,
|
|
|
|
struct gui_synclist *this_list)
|
2007-02-13 07:50:47 +00:00
|
|
|
{
|
2020-07-19 17:42:04 +00:00
|
|
|
(void)this_list;
|
2007-02-13 07:50:47 +00:00
|
|
|
static int oldval = 0;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_ENTER_MENUITEM:
|
2007-06-07 09:24:53 +00:00
|
|
|
oldval = global_settings.talk_file_clip;
|
2007-02-13 07:50:47 +00:00
|
|
|
break;
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
2009-11-12 05:04:23 +00:00
|
|
|
#ifdef HAVE_CROSSFADE
|
2007-02-13 07:50:47 +00:00
|
|
|
audio_set_crossfade(global_settings.crossfade);
|
|
|
|
#endif
|
2007-06-07 09:24:53 +00:00
|
|
|
if (this_item == &talk_dir_clip_item)
|
2007-02-13 07:50:47 +00:00
|
|
|
break;
|
2007-06-07 09:24:53 +00:00
|
|
|
if (!oldval && global_settings.talk_file_clip)
|
2008-12-25 03:23:22 +00:00
|
|
|
{
|
2007-06-07 09:24:53 +00:00
|
|
|
/* force reload if newly talking thumbnails,
|
2007-02-13 07:50:47 +00:00
|
|
|
because the clip presence is cached only if enabled */
|
|
|
|
reload_directory();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
2007-11-07 03:25:33 +00:00
|
|
|
MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL);
|
2007-11-03 05:00:49 +00:00
|
|
|
MENUITEM_SETTING(talk_battery_level_item,
|
|
|
|
&global_settings.talk_battery_level, NULL);
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice,
|
2008-12-25 03:23:22 +00:00
|
|
|
&talk_menu_item, &talk_dir_item, &talk_dir_clip_item,
|
2007-11-07 03:25:33 +00:00
|
|
|
&talk_file_item, &talk_file_clip_item, &talk_filetype_item,
|
2007-11-03 05:00:49 +00:00
|
|
|
&talk_battery_level_item);
|
2007-02-13 07:50:47 +00:00
|
|
|
/* VOICE MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
2007-08-27 16:04:32 +00:00
|
|
|
|
2010-04-01 03:14:44 +00:00
|
|
|
/***********************************/
|
|
|
|
/* HOTKEY MENU */
|
|
|
|
#ifdef HAVE_HOTKEY
|
2010-05-09 02:02:51 +00:00
|
|
|
MENUITEM_SETTING(hotkey_wps_item, &global_settings.hotkey_wps, NULL);
|
|
|
|
MENUITEM_SETTING(hotkey_tree_item, &global_settings.hotkey_tree, NULL);
|
2010-05-07 14:53:06 +00:00
|
|
|
MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON,
|
2010-05-09 02:02:51 +00:00
|
|
|
&hotkey_wps_item, &hotkey_tree_item);
|
2010-04-01 03:14:44 +00:00
|
|
|
#endif /*have_hotkey */
|
|
|
|
/* HOTKEY MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
/***********************************/
|
|
|
|
/* SETTINGS MENU */
|
2010-07-25 18:28:42 +00:00
|
|
|
|
|
|
|
static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG };
|
|
|
|
|
|
|
|
MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE),
|
|
|
|
browse_folder, (void*)&langs, NULL, Icon_Language);
|
2007-02-08 04:33:41 +00:00
|
|
|
|
2007-02-13 07:50:47 +00:00
|
|
|
MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
|
2007-03-03 13:52:14 +00:00
|
|
|
Icon_General_settings_menu,
|
2008-10-13 15:11:11 +00:00
|
|
|
&playlist_settings, &file_menu,
|
2007-03-01 17:39:15 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
|
|
|
&tagcache_menu,
|
|
|
|
#endif
|
2007-03-01 11:14:46 +00:00
|
|
|
&display_menu, &system_menu,
|
2011-12-26 08:26:38 +00:00
|
|
|
&startup_shutdown_menu,
|
2011-01-02 02:49:13 +00:00
|
|
|
&bookmark_settings_menu,
|
|
|
|
#ifdef HAVE_TAGCACHE
|
2011-02-08 20:31:35 +00:00
|
|
|
&autoresume_menu,
|
2011-01-02 02:49:13 +00:00
|
|
|
#endif
|
|
|
|
&browse_langs, &voice_settings_menu,
|
2010-04-01 03:14:44 +00:00
|
|
|
#ifdef HAVE_HOTKEY
|
|
|
|
&hotkey_menu,
|
|
|
|
#endif
|
2007-08-27 16:04:32 +00:00
|
|
|
);
|
2007-02-13 07:50:47 +00:00
|
|
|
/* SETTINGS MENU */
|
|
|
|
/***********************************/
|