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:
parent
2311eeaf5c
commit
e1beea86d2
4 changed files with 92 additions and 77 deletions
|
@ -1780,6 +1780,7 @@ static bool dbg_disk_info(void)
|
||||||
/* Wait for a key to be pushed */
|
/* Wait for a key to be pushed */
|
||||||
key = button_get_w_tmo(HZ*5);
|
key = button_get_w_tmo(HZ*5);
|
||||||
switch(key) {
|
switch(key) {
|
||||||
|
case SETTINGS_OK:
|
||||||
case SETTINGS_CANCEL:
|
case SETTINGS_CANCEL:
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1793,17 +1794,6 @@ static bool dbg_disk_info(void)
|
||||||
if (++page > max_page)
|
if (++page > max_page)
|
||||||
page = 0;
|
page = 0;
|
||||||
break;
|
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();
|
lcd_stop_scroll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,12 @@
|
||||||
#include "logfdisp.h"
|
#include "logfdisp.h"
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "filetypes.h"
|
#include "filetypes.h"
|
||||||
|
#include "splash.h"
|
||||||
|
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
#include "lcd-remote.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool show_credits(void)
|
bool show_credits(void)
|
||||||
{
|
{
|
||||||
plugin_load("/.rockbox/rocks/credits.rock",NULL);
|
plugin_load("/.rockbox/rocks/credits.rock",NULL);
|
||||||
|
@ -78,16 +75,17 @@ extern bool simulate_usb(void);
|
||||||
bool show_info(void)
|
bool show_info(void)
|
||||||
{
|
{
|
||||||
char s[64], s1[32];
|
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;
|
unsigned long size, free;
|
||||||
|
long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
|
||||||
|
int key;
|
||||||
|
bool done = false;
|
||||||
|
bool new_info = true;
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
char s2[32];
|
char s2[32];
|
||||||
unsigned long size2 = 0;
|
unsigned long size2, free2;
|
||||||
unsigned long free2 = 0;
|
#endif
|
||||||
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
int page = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const unsigned char *kbyte_units[] = {
|
const unsigned char *kbyte_units[] = {
|
||||||
|
@ -96,10 +94,18 @@ bool show_info(void)
|
||||||
ID2P(LANG_GIGABYTE)
|
ID2P(LANG_GIGABYTE)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
int y=0;
|
||||||
|
|
||||||
|
if (new_info)
|
||||||
|
{
|
||||||
fat_size( IF_MV2(0,) &size, &free );
|
fat_size( IF_MV2(0,) &size, &free );
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
if (fat_ismounted(1))
|
if (fat_ismounted(1))
|
||||||
fat_size( 1, &size2, &free2 );
|
fat_size( 1, &size2, &free2 );
|
||||||
|
else
|
||||||
|
size2 = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
|
@ -122,7 +128,7 @@ bool show_info(void)
|
||||||
output_dyn_value(NULL, 0, free2, kbyte_units, true);
|
output_dyn_value(NULL, 0, free2, kbyte_units, true);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
output_dyn_value(NULL, 0, free, kbyte_units, true); /* NULL == talk */
|
output_dyn_value(NULL, 0, free, kbyte_units, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
|
@ -138,20 +144,22 @@ bool show_info(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
new_info = false;
|
||||||
|
}
|
||||||
|
|
||||||
while(!done)
|
|
||||||
{
|
|
||||||
int y=0;
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
lcd_puts(0, y++, str(LANG_ROCKBOX_INFO));
|
lcd_puts(0, y++, str(LANG_ROCKBOX_INFO));
|
||||||
y++;
|
y++;
|
||||||
state = 3;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (state & 1) {
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
integer = buflen / 1000;
|
if (page == 0)
|
||||||
decimal = buflen % 1000;
|
#endif
|
||||||
|
{
|
||||||
|
int integer = buflen / 1000;
|
||||||
|
int decimal = buflen % 1000;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_PLAYER),
|
snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_PLAYER),
|
||||||
integer, decimal);
|
integer, decimal);
|
||||||
|
@ -178,19 +186,17 @@ bool show_info(void)
|
||||||
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state & 2) {
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
if (page == 1)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
output_dyn_value(s1, sizeof s1, free, kbyte_units, true);
|
output_dyn_value(s1, sizeof s1, free, kbyte_units, true);
|
||||||
output_dyn_value(s2, sizeof s2, size, 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),
|
snprintf(s, sizeof s, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL),
|
||||||
s1, s2);
|
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);
|
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
||||||
|
|
||||||
#ifdef HAVE_MULTIVOLUME
|
|
||||||
if (size2) {
|
if (size2) {
|
||||||
output_dyn_value(s1, sizeof s1, free2, kbyte_units, true);
|
output_dyn_value(s1, sizeof s1, free2, kbyte_units, true);
|
||||||
output_dyn_value(s2, sizeof s2, size2, 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);
|
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
||||||
}
|
}
|
||||||
#else
|
#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);
|
output_dyn_value(s1, sizeof s1, free, kbyte_units, true);
|
||||||
snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1);
|
snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1);
|
||||||
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
lcd_puts_scroll(0, y++, (unsigned char *)s);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
/* Wait for a key to be pushed */
|
/* Wait for a key to be pushed */
|
||||||
|
@ -218,16 +229,29 @@ bool show_info(void)
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
case SETTINGS_INC:
|
case SETTINGS_INC:
|
||||||
case SETTINGS_DEC:
|
case SETTINGS_DEC:
|
||||||
if (state == 1)
|
page = (page == 0) ? 1 : 0;
|
||||||
state = 2;
|
break;
|
||||||
else
|
#endif
|
||||||
state = 1;
|
|
||||||
|
#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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(default_event_handler(key) == SYS_USB_CONNECTED)
|
if (default_event_handler(key) == SYS_USB_CONNECTED)
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
#define SETTINGS_OK BUTTON_PLAY
|
#define SETTINGS_OK BUTTON_PLAY
|
||||||
#define SETTINGS_CANCEL BUTTON_STOP
|
#define SETTINGS_CANCEL BUTTON_STOP
|
||||||
#define SETTINGS_CANCEL2 BUTTON_MENU
|
#define SETTINGS_CANCEL2 BUTTON_MENU
|
||||||
|
#define SETTINGS_ACCEPT BUTTON_ON
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||||
#define SETTINGS_INC BUTTON_UP
|
#define SETTINGS_INC BUTTON_UP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue