1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2006-05-25 13:34:51 +00:00
parent 2311eeaf5c
commit e1beea86d2
4 changed files with 92 additions and 77 deletions

View file

@ -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();
}

View file

@ -8528,4 +8528,4 @@
<voice>
*: "Remote Scrolling Options"
</voice>
</phrase>
</phrase>

View file

@ -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];
long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
int integer, decimal;
bool done = false;
int key;
int state = 1;
unsigned long size, free;
long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
int key;
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);
}
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);
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;
}
}

View file

@ -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 */