summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-04-09 13:39:37 +0000
committerJens Arnold <amiconn@rockbox.org>2007-04-09 13:39:37 +0000
commit178c565beb521230ec5434f59e36c2592f32a281 (patch)
treefcc205085b783b2458a95429019ae42ae1754c97
parentdcb4aa242b5180214b899004c3860364c4466a1e (diff)
downloadrockbox-178c565beb521230ec5434f59e36c2592f32a281.zip
rockbox-178c565beb521230ec5434f59e36c2592f32a281.tar.gz
rockbox-178c565beb521230ec5434f59e36c2592f32a281.tar.bz2
rockbox-178c565beb521230ec5434f59e36c2592f32a281.tar.xz
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
-rw-r--r--apps/keymaps/keymap-h1x0_h3x0.c1
-rw-r--r--apps/menu.c8
-rw-r--r--apps/misc.c47
-rw-r--r--apps/misc.h1
-rw-r--r--apps/root_menu.c7
-rw-r--r--apps/tree.c41
6 files changed, 59 insertions, 46 deletions
diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c
index b31ce6e..8413d09 100644
--- a/apps/keymaps/keymap-h1x0_h3x0.c
+++ b/apps/keymaps/keymap-h1x0_h3x0.c
@@ -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)
diff --git a/apps/menu.c b/apps/menu.c
index 8d44648..26edbb0 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -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)
{
diff --git a/apps/misc.c b/apps/misc.c
index e3b9434..8004589 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -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;
diff --git a/apps/misc.h b/apps/misc.h
index b30942f..959674f 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -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);
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 1fc3309..1b97cde 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -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),
diff --git a/apps/tree.c b/apps/tree.c
index 5f5cb11..723c003 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -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;