From e1beea86d2127d05e96f07fb64e4b70d551d4f67 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 25 May 2006 13:34:51 +0000 Subject: Moved the free diskspace scan into 'Rockbox Info'. Idea based on patch #4800 by Manuel Dejonghe. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9985 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 12 +--- apps/lang/english.lang | 2 +- apps/main_menu.c | 152 ++++++++++++++++++++++++++++--------------------- apps/settings.h | 3 +- 4 files changed, 92 insertions(+), 77 deletions(-) (limited to 'apps') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 3936594954..fac570d39a 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1780,6 +1780,7 @@ static bool dbg_disk_info(void) /* Wait for a key to be pushed */ key = button_get_w_tmo(HZ*5); switch(key) { + case SETTINGS_OK: case SETTINGS_CANCEL: done = true; break; @@ -1793,17 +1794,6 @@ static bool dbg_disk_info(void) if (++page > max_page) page = 0; break; - - case SETTINGS_OK: - if (page == 3) { - audio_stop(); /* stop playback, to avoid disk access */ - lcd_clear_display(); - lcd_puts(0,0,"Scanning"); - lcd_puts(0,1,"disk..."); - lcd_update(); - fat_recalc_free(IF_MV(0)); - } - break; } lcd_stop_scroll(); } diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 8c551b443d..ad9c82dfcf 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -8528,4 +8528,4 @@ *: "Remote Scrolling Options" - + diff --git a/apps/main_menu.c b/apps/main_menu.c index f903f60841..5a5607afe0 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -50,15 +50,12 @@ #include "logfdisp.h" #include "plugin.h" #include "filetypes.h" +#include "splash.h" #ifdef HAVE_RECORDING #include "recording.h" #endif -#ifdef HAVE_REMOTE_LCD -#include "lcd-remote.h" -#endif - bool show_credits(void) { plugin_load("/.rockbox/rocks/credits.rock",NULL); @@ -78,16 +75,17 @@ extern bool simulate_usb(void); bool show_info(void) { char s[64], s1[32]; + unsigned long size, free; long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */ - int integer, decimal; - bool done = false; int key; - int state = 1; - unsigned long size, free; + bool done = false; + bool new_info = true; #ifdef HAVE_MULTIVOLUME char s2[32]; - unsigned long size2 = 0; - unsigned long free2 = 0; + unsigned long size2, free2; +#endif +#ifdef HAVE_LCD_CHARCELLS + int page = 0; #endif const unsigned char *kbyte_units[] = { @@ -95,63 +93,73 @@ bool show_info(void) ID2P(LANG_MEGABYTE), ID2P(LANG_GIGABYTE) }; + + while (!done) + { + int y=0; - fat_size( IF_MV2(0,) &size, &free ); + if (new_info) + { + fat_size( IF_MV2(0,) &size, &free ); #ifdef HAVE_MULTIVOLUME - if (fat_ismounted(1)) - fat_size( 1, &size2, &free2 ); + if (fat_ismounted(1)) + fat_size( 1, &size2, &free2 ); + else + size2 = 0; #endif - if (global_settings.talk_menu) - { /* say whatever is reasonable, no real connection to the screen */ - bool enqueue = false; /* enqueue all but the first */ - if (battery_level() >= 0) - { - talk_id(LANG_BATTERY_TIME, enqueue); - enqueue = true; - talk_value(battery_level(), UNIT_PERCENT, true); - } - - talk_id(LANG_DISK_FREE_INFO, enqueue); + if (global_settings.talk_menu) + { /* say whatever is reasonable, no real connection to the screen */ + bool enqueue = false; /* enqueue all but the first */ + if (battery_level() >= 0) + { + talk_id(LANG_BATTERY_TIME, enqueue); + enqueue = true; + talk_value(battery_level(), UNIT_PERCENT, true); + } + + talk_id(LANG_DISK_FREE_INFO, enqueue); #ifdef HAVE_MULTIVOLUME - talk_id(LANG_DISK_NAME_INTERNAL, true); - output_dyn_value(NULL, 0, free, kbyte_units, true); - if (size2) - { - talk_id(LANG_DISK_NAME_MMC, true); - output_dyn_value(NULL, 0, free2, kbyte_units, true); - } + talk_id(LANG_DISK_NAME_INTERNAL, true); + output_dyn_value(NULL, 0, free, kbyte_units, true); + if (size2) + { + talk_id(LANG_DISK_NAME_MMC, true); + output_dyn_value(NULL, 0, free2, kbyte_units, true); + } #else - output_dyn_value(NULL, 0, free, kbyte_units, true); /* NULL == talk */ + output_dyn_value(NULL, 0, free, kbyte_units, true); #endif #ifdef CONFIG_RTC - { - struct tm* tm = get_time(); - talk_id(VOICE_CURRENT_TIME, true); - talk_value(tm->tm_hour, UNIT_HOUR, true); - talk_value(tm->tm_min, UNIT_MIN, true); - talk_value(tm->tm_sec, UNIT_SEC, true); - talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); - talk_number(tm->tm_mday, true); - talk_number(1900 + tm->tm_year, true); - } + { + struct tm* tm = get_time(); + talk_id(VOICE_CURRENT_TIME, true); + talk_value(tm->tm_hour, UNIT_HOUR, true); + talk_value(tm->tm_min, UNIT_MIN, true); + talk_value(tm->tm_sec, UNIT_SEC, true); + talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); + talk_number(tm->tm_mday, true); + talk_number(1900 + tm->tm_year, true); + } #endif - } + } + new_info = false; + } - while(!done) - { - int y=0; lcd_clear_display(); #ifdef HAVE_LCD_BITMAP lcd_puts(0, y++, str(LANG_ROCKBOX_INFO)); y++; - state = 3; #endif - if (state & 1) { - integer = buflen / 1000; - decimal = buflen % 1000; +#ifdef HAVE_LCD_CHARCELLS + if (page == 0) +#endif + { + int integer = buflen / 1000; + int decimal = buflen % 1000; + #ifdef HAVE_LCD_CHARCELLS snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_PLAYER), integer, decimal); @@ -178,19 +186,17 @@ bool show_info(void) lcd_puts_scroll(0, y++, (unsigned char *)s); } - if (state & 2) { +#ifdef HAVE_LCD_CHARCELLS + if (page == 1) +#endif + { #ifdef HAVE_MULTIVOLUME output_dyn_value(s1, sizeof s1, free, kbyte_units, true); output_dyn_value(s2, sizeof s2, size, kbyte_units, true); snprintf(s, sizeof s, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL), s1, s2); -#else - output_dyn_value(s1, sizeof s1, size, kbyte_units, true); - snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); -#endif lcd_puts_scroll(0, y++, (unsigned char *)s); -#ifdef HAVE_MULTIVOLUME if (size2) { output_dyn_value(s1, sizeof s1, free2, kbyte_units, true); output_dyn_value(s2, sizeof s2, size2, kbyte_units, true); @@ -199,11 +205,16 @@ bool show_info(void) lcd_puts_scroll(0, y++, (unsigned char *)s); } #else + output_dyn_value(s1, sizeof s1, size, kbyte_units, true); + snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); + lcd_puts_scroll(0, y++, (unsigned char *)s); + output_dyn_value(s1, sizeof s1, free, kbyte_units, true); snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1); lcd_puts_scroll(0, y++, (unsigned char *)s); #endif } + lcd_update(); /* Wait for a key to be pushed */ @@ -218,18 +229,31 @@ bool show_info(void) done = true; break; +#ifdef HAVE_LCD_CHARCELLS case SETTINGS_INC: case SETTINGS_DEC: - if (state == 1) - state = 2; - else - state = 1; + page = (page == 0) ? 1 : 0; + break; +#endif + +#ifdef SETTINGS_ACCEPT + case SETTINGS_ACCEPT: +#else + case SETTINGS_INC: /* Ondio */ +#endif + gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING)); + fat_recalc_free(IF_MV(0)); +#ifdef HAVE_MULTIVOLUME + if (fat_ismounted(1)) + fat_recalc_free(1); +#endif + new_info = true; break; - default: - if(default_event_handler(key) == SYS_USB_CONNECTED) - return true; - break; + default: + if (default_event_handler(key) == SYS_USB_CONNECTED) + return true; + break; } } diff --git a/apps/settings.h b/apps/settings.h index ca8e88a75b..2d1dfccd2a 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -74,6 +74,7 @@ #define SETTINGS_OK BUTTON_PLAY #define SETTINGS_CANCEL BUTTON_STOP #define SETTINGS_CANCEL2 BUTTON_MENU +#define SETTINGS_ACCEPT BUTTON_ON #elif CONFIG_KEYPAD == ONDIO_PAD #define SETTINGS_INC BUTTON_UP @@ -332,7 +333,7 @@ struct user_settings int runtime; /* current runtime since last charge */ int topruntime; /* top known runtime */ - + int scroll_speed; /* long texts scrolling speed: 1-30 */ int bidir_limit; /* bidir scroll length limit */ int scroll_delay; /* delay (in 1/10s) before starting scroll */ -- cgit v1.2.3