Stop/shutdown logic rework in browsers and menus. Recorder V1: Double-Off shutdown is now possible from menus and sub-browsers as well. Player, other targets which are always powered during charging: Attempted shutdown from menu with charger plugged now displays the charging splash.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13079 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-04-09 13:39:37 +00:00
parent dcb4aa242b
commit 178c565beb
6 changed files with 59 additions and 46 deletions

View file

@ -106,7 +106,6 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_OFF|BUTTON_REL, BUTTON_OFF },
{ ACTION_TREE_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)

View file

@ -476,13 +476,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
}
else if (action == ACTION_TREE_STOP)
{
if (audio_status() && !global_settings.party_mode)
{
if (global_settings.fade_on_stop)
fade(0);
bookmark_autobookmark();
audio_stop();
}
list_stop_handler();
}
else if (action == ACTION_STD_MENU)
{

View file

@ -58,6 +58,7 @@
#include "icons.h"
#endif /* End HAVE_LCD_BITMAP */
#include "gui/gwps-common.h"
#include "bookmark.h"
#include "misc.h"
@ -676,6 +677,52 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
return false;
}
bool list_stop_handler(void)
{
bool ret = false;
/* Stop the music if it is playing */
if(audio_status())
{
if (!global_settings.party_mode)
{
if (global_settings.fade_on_stop)
fade(0);
bookmark_autobookmark();
audio_stop();
}
}
#if CONFIG_CHARGING
#if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
else
{
if (charger_inserted())
charging_splash();
else
shutdown_screen(); /* won't return if shutdown actually happens */
ret = true; /* screen is dirty, caller needs to refresh */
}
#endif
#ifndef HAVE_POWEROFF_WHILE_CHARGING
{
static long last_off = 0;
if (TIME_BEFORE(current_tick, last_off + HZ/2))
{
if (charger_inserted())
{
charging_splash();
ret = true; /* screen is dirty, caller needs to refresh */
}
}
last_off = current_tick;
}
#endif
#endif /* CONFIG_CHARGING */
return ret;
}
#if CONFIG_CHARGING
static bool waiting_to_resume_play = false;
static long play_resume_tick;

View file

@ -88,6 +88,7 @@ void screen_dump_set_hook(void (*hook)(int fh));
bool settings_parseline(char* line, char** name, char** value);
long default_event_handler_ex(long event, void (*callback)(void *), void *parameter);
long default_event_handler(long event);
bool list_stop_handler(void);
void car_adapter_mode_init(void);
extern int show_logo(void);

View file

@ -25,11 +25,13 @@
#include "root_menu.h"
#include "lang.h"
#include "settings.h"
#include "screens.h"
#include "kernel.h"
#include "debug.h"
#include "misc.h"
#include "rolo.h"
#include "powermgmt.h"
#include "power.h"
#if LCD_DEPTH > 1
#include "backdrop.h"
@ -304,7 +306,10 @@ MENUITEM_RETURNVALUE(bookmarks, ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS),
#ifdef HAVE_LCD_CHARCELLS
static int do_shutdown(void)
{
sys_poweroff();
if (charger_inserted())
charging_splash();
else
sys_poweroff();
return 0;
}
MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN),

View file

@ -665,43 +665,10 @@ static int dirbrowse()
break;
case ACTION_TREE_STOP:
if (*tc.dirfilter < NUM_FILTER_MODES)
{
/* Stop the music if it is playing */
if(audio_status()) {
if (!global_settings.party_mode) {
if (global_settings.fade_on_stop)
fade(0);
bookmark_autobookmark();
audio_stop();
}
}
#if CONFIG_CHARGING && \
(CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
else {
if (!charger_inserted()) {
if(shutdown_screen())
reload_dir = true;
} else {
charging_splash();
}
restore = true;
}
#endif
}
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
{
static int last_off = 0;
if (current_tick - last_off < 50) {
if (charger_inserted()) {
charging_splash();
restore = true;
}
}
last_off = current_tick;
}
#endif
break; /* case ACTION_TREE_STOP: */
if (list_stop_handler())
restore = true;
break;
case ACTION_STD_MENU:
return GO_TO_ROOT;
break;