1
0
Fork 0
forked from len0rd/rockbox

update the runtime screen and move it to the inf menu instead of debug

menu


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11817 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2006-12-19 12:26:03 +00:00
parent 6efad93713
commit d152b6492a
6 changed files with 153 additions and 87 deletions

View file

@ -1484,91 +1484,6 @@ static bool view_battery(void)
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#endif #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 #ifndef SIMULATOR
#ifdef HAVE_MMC #ifdef HAVE_MMC
static bool dbg_mmc_info(void) static bool dbg_mmc_info(void)
@ -2192,7 +2107,6 @@ bool debug_menu(void)
{ "pm histogram", peak_meter_histogram}, { "pm histogram", peak_meter_histogram},
#endif /* PM_DEBUG */ #endif /* PM_DEBUG */
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
{ "View runtime", view_runtime },
#ifndef SIMULATOR #ifndef SIMULATOR
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
{ "FM Radio", dbg_fm_radio }, { "FM Radio", dbg_fm_radio },

View file

@ -10387,3 +10387,58 @@
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_RUNNING_TIME
desc: in run time screen
user:
<source>
*: "Running Time"
</source>
<dest>
*: "Running Time"
</dest>
<voice>
*: "Running Time"
</voice>
</phrase>
<phrase>
id: LANG_CURRENT_TIME
desc: in run time screen
user:
<source>
*: "Current Time"
</source>
<dest>
*: "Current Time"
</dest>
<voice>
*: "Current Time"
</voice>
</phrase>
<phrase>
id: LANG_TOP_TIME
desc: in run time screen
user:
<source>
*: "Top Time"
</source>
<dest>
*: "Top Time"
</dest>
<voice>
*: "Top Time"
</voice>
</phrase>
<phrase>
id: LANG_CLEAR_TIME
desc: in run time screen
user:
<source>
*: "Clear Time?"
</source>
<dest>
*: "Clear Time?"
</dest>
<voice>
*: "Clear Time?"
</voice>
</phrase>

View file

@ -349,6 +349,7 @@ static bool info_menu(void)
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ ID2P(LANG_INFO_MENU), show_info }, { ID2P(LANG_INFO_MENU), show_info },
{ ID2P(LANG_VERSION), show_credits }, { ID2P(LANG_VERSION), show_credits },
{ ID2P(LANG_RUNNING_TIME), view_runtime },
{ ID2P(LANG_DEBUG), debug_menu }, { ID2P(LANG_DEBUG), debug_menu },
#ifdef SIMULATOR #ifdef SIMULATOR
{ ID2P(LANG_USB), simulate_usb }, { ID2P(LANG_USB), simulate_usb },

View file

@ -556,7 +556,6 @@ bool settings_parseline(char* line, char** name, char** value)
static void system_flush(void) static void system_flush(void)
{ {
tree_flush(); tree_flush();
/*settings_save();*/
call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */ call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */
} }

View file

@ -56,6 +56,7 @@
#include "quickscreen.h" #include "quickscreen.h"
#include "pcmbuf.h" #include "pcmbuf.h"
#include "list.h" #include "list.h"
#include "yesno.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include <bitmaps/usblogo.h> #include <bitmaps/usblogo.h>
@ -1300,3 +1301,98 @@ bool set_rating(void)
action_signalscreenchange(); action_signalscreenchange();
return false; 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;
}

View file

@ -49,6 +49,7 @@ bool set_time_screen(const char* string, struct tm *tm);
bool shutdown_screen(void); bool shutdown_screen(void);
bool browse_id3(void); bool browse_id3(void);
bool set_rating(void); bool set_rating(void);
bool view_runtime(void);
#endif #endif