diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 7d1e1c18cf..e21d203f7a 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1484,91 +1484,6 @@ static bool view_battery(void)
#endif /* HAVE_LCD_BITMAP */
#endif
-static bool view_runtime(void)
-{
- char s[32];
- bool done = false;
- int state = 1;
-
- while(!done)
- {
- int y=0;
- int t;
- int key;
- lcd_clear_display();
-#ifdef HAVE_LCD_BITMAP
- lcd_puts(0, y++, "Running time:");
- y++;
-#endif
-
- if (state & 1) {
-#ifdef CONFIG_CHARGING
- if (charger_inserted()
-#ifdef HAVE_USB_POWER
- || usb_powered()
-#endif
- )
- {
- global_settings.runtime = 0;
- }
- else
-#endif
- {
- global_settings.runtime += ((current_tick - lasttime) / HZ);
- }
- lasttime = current_tick;
-
- t = global_settings.runtime;
- lcd_puts(0, y++, "Current time");
- }
- else {
- t = global_settings.topruntime;
- lcd_puts(0, y++, "Top time");
- }
-
- snprintf(s, sizeof(s), "%dh %dm %ds",
- t / 3600, (t % 3600) / 60, t % 60);
- lcd_puts(0, y++, s);
- lcd_update();
-
- /* Wait for a key to be pushed */
- key = get_action(CONTEXT_SETTINGS,HZ);
- switch(key) {
- case ACTION_STD_CANCEL:
- done = true;
- break;
-
- case ACTION_SETTINGS_INC:
- case ACTION_SETTINGS_DEC:
- if (state == 1)
- state = 2;
- else
- state = 1;
- break;
-
- case ACTION_STD_OK:
- lcd_clear_display();
- /*NOTE: this needs to be changed to sync splash! */
- lcd_puts(0,0,"Clear time?");
- lcd_puts(0,1,"PLAY = Yes");
- lcd_update();
- while (1) {
- key = get_action(CONTEXT_STD,TIMEOUT_BLOCK);
- if ( key == ACTION_STD_OK ) {
- if ( state == 1 )
- global_settings.runtime = 0;
- else
- global_settings.topruntime = 0;
- break;
- }
- }
- break;
- }
- }
- action_signalscreenchange();
- return false;
-}
-
#ifndef SIMULATOR
#ifdef HAVE_MMC
static bool dbg_mmc_info(void)
@@ -2192,7 +2107,6 @@ bool debug_menu(void)
{ "pm histogram", peak_meter_histogram},
#endif /* PM_DEBUG */
#endif /* HAVE_LCD_BITMAP */
- { "View runtime", view_runtime },
#ifndef SIMULATOR
#ifdef CONFIG_TUNER
{ "FM Radio", dbg_fm_radio },
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index bca55f116c..6681639aaa 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -10387,3 +10387,58 @@
+ id: LANG_RUNNING_TIME
+ desc: in run time screen
+ user:
+
+ *: "Running Time"
+
+
+ *: "Running Time"
+
+
+ *: "Running Time"
+
+
+
+ id: LANG_CURRENT_TIME
+ desc: in run time screen
+ user:
+
+ *: "Current Time"
+
+
+ *: "Current Time"
+
+
+ *: "Current Time"
+
+
+
+ id: LANG_TOP_TIME
+ desc: in run time screen
+ user:
+
+ *: "Top Time"
+
+
+ *: "Top Time"
+
+
+ *: "Top Time"
+
+
+
+ id: LANG_CLEAR_TIME
+ desc: in run time screen
+ user:
+
+ *: "Clear Time?"
+
+
+ *: "Clear Time?"
+
+
+ *: "Clear Time?"
+
+
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 952586465f..7e20656dc9 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -349,6 +349,7 @@ static bool info_menu(void)
static const struct menu_item items[] = {
{ ID2P(LANG_INFO_MENU), show_info },
{ ID2P(LANG_VERSION), show_credits },
+ { ID2P(LANG_RUNNING_TIME), view_runtime },
{ ID2P(LANG_DEBUG), debug_menu },
#ifdef SIMULATOR
{ ID2P(LANG_USB), simulate_usb },
diff --git a/apps/misc.c b/apps/misc.c
index 02faec821a..155027b1bf 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -556,7 +556,6 @@ bool settings_parseline(char* line, char** name, char** value)
static void system_flush(void)
{
tree_flush();
- /*settings_save();*/
call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */
}
diff --git a/apps/screens.c b/apps/screens.c
index 032fd0b60d..5cc3cc15ec 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -56,6 +56,7 @@
#include "quickscreen.h"
#include "pcmbuf.h"
#include "list.h"
+#include "yesno.h"
#ifdef HAVE_LCD_BITMAP
#include
@@ -1300,3 +1301,98 @@ bool set_rating(void)
action_signalscreenchange();
return false;
}
+
+
+bool view_runtime(void)
+{
+ char s[32];
+ bool done = false;
+ int state = 1;
+ int i;
+ int key;
+ unsigned char *lines[]={str(LANG_CLEAR_TIME)};
+ struct text_message message={(char **)lines, 1};
+
+ while(!done)
+ {
+ int y[NB_SCREENS]={0};
+ int t;
+
+ FOR_NB_SCREENS(i)
+ {
+ screens[i].clear_display();
+#ifdef HAVE_LCD_BITMAP
+ if (screens[i].nb_lines >4)
+ {
+ screens[i].puts(0, y[i]++, str(LANG_RUNNING_TIME));
+ }
+#endif
+ }
+
+ if (state & 1) {
+#ifdef CONFIG_CHARGING
+ if (charger_inserted()
+#ifdef HAVE_USB_POWER
+ || usb_powered()
+#endif
+ )
+ {
+ global_settings.runtime = 0;
+ }
+ else
+#endif
+ {
+ global_settings.runtime += ((current_tick - lasttime) / HZ);
+ }
+ lasttime = current_tick;
+
+ t = global_settings.runtime;
+ FOR_NB_SCREENS(i)
+ screens[i].puts(0, y[i]++, str(LANG_CURRENT_TIME));
+ }
+ else {
+ t = global_settings.topruntime;
+ FOR_NB_SCREENS(i)
+ screens[i].puts(0, y[i]++, str(LANG_TOP_TIME));
+ }
+ snprintf(s, sizeof(s), "%dh %dm %ds",
+ t / 3600, (t % 3600) / 60, t % 60);
+ gui_syncstatusbar_draw(&statusbars, true);
+ FOR_NB_SCREENS(i)
+ {
+ screens[i].puts(0, y[i]++, s);
+#if defined(HAVE_LCD_BITMAP)
+ screens[i].update();
+#endif
+ }
+
+ /* Wait for a key to be pushed */
+ key = get_action(CONTEXT_STD,HZ);
+ switch(key) {
+ case ACTION_STD_CANCEL:
+ done = true;
+ break;
+
+ case ACTION_STD_NEXT:
+ case ACTION_STD_PREV:
+ state = (state==1)?2:1;
+ break;
+
+ case ACTION_STD_OK:
+ if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
+ {
+ if ( state == 1 )
+ global_settings.runtime = 0;
+ else
+ global_settings.topruntime = 0;
+ }
+ break;
+ default:
+ if(default_event_handler(key) == SYS_USB_CONNECTED)
+ return true;
+ break;
+ }
+ }
+ action_signalscreenchange();
+ return false;
+}
diff --git a/apps/screens.h b/apps/screens.h
index c34f612ded..2bf2b32819 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -49,6 +49,7 @@ bool set_time_screen(const char* string, struct tm *tm);
bool shutdown_screen(void);
bool browse_id3(void);
bool set_rating(void);
+bool view_runtime(void);
#endif