Bill Napier's patch slightly remodelled. This adds a setting called
"Show hidden files" that if enabled will show files with the hidden attribute and/or starting with a dot in the dir browser. If the setting is set to Off, files/dirs starting with a dot or that have the hidden attribute set will be... yes, hidden. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1926 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c94aa32731
commit
053d904645
4 changed files with 43 additions and 8 deletions
|
@ -259,7 +259,8 @@ int settings_save( void )
|
|||
((global_settings.mp3filter & 1) << 1) |
|
||||
((global_settings.sort_case & 1) << 2) |
|
||||
((global_settings.discharge & 1) << 3) |
|
||||
((global_settings.statusbar & 1) << 4));
|
||||
((global_settings.statusbar & 1) << 4) |
|
||||
((global_settings.show_hidden_files & 1) << 5));
|
||||
|
||||
config_block[0xf] = (unsigned char)
|
||||
((global_settings.scroll_speed << 3) |
|
||||
|
@ -345,6 +346,7 @@ void settings_load(void)
|
|||
global_settings.sort_case = (config_block[0xe] >> 2) & 1;
|
||||
global_settings.discharge = (config_block[0xe] >> 3) & 1;
|
||||
global_settings.statusbar = (config_block[0xe] >> 4) & 1;
|
||||
global_settings.show_hidden_files = (config_block[0xe] >> 5) & 1;
|
||||
}
|
||||
|
||||
c = config_block[0xf] >> 3;
|
||||
|
@ -410,6 +412,7 @@ void settings_reset(void) {
|
|||
global_settings.discharge = 0;
|
||||
global_settings.total_uptime = 0;
|
||||
global_settings.scroll_speed = 8;
|
||||
global_settings.show_hidden_files = false;
|
||||
global_settings.ff_rewind = DEFAULT_FF_REWIND_SETTING;
|
||||
global_settings.resume_index = -1;
|
||||
global_settings.resume_offset = -1;
|
||||
|
|
|
@ -69,6 +69,10 @@ struct user_settings
|
|||
|
||||
/* show status bar */
|
||||
bool statusbar; /* 0=hide, 1=show */
|
||||
|
||||
/* Hidden and dotfile settings */
|
||||
bool show_hidden_files; /* 1=show dotfiles/hidden,
|
||||
0=hide dotfiles/hidden */
|
||||
|
||||
/* geeky persistent statistics */
|
||||
unsigned int total_uptime; /* total uptime since rockbox was first booted */
|
||||
|
|
|
@ -32,9 +32,14 @@
|
|||
#include "settings_menu.h"
|
||||
#include "backlight.h"
|
||||
#include "playlist.h" /* for playlist_shuffle */
|
||||
#include "fat.h" /* For dotfile settings */
|
||||
#include "powermgmt.h"
|
||||
#include "rtc.h"
|
||||
|
||||
static void show_hidden_files(void)
|
||||
{
|
||||
set_bool( "[Show hidden files]", &global_settings.show_hidden_files );
|
||||
}
|
||||
|
||||
static void contrast(void)
|
||||
{
|
||||
|
@ -169,6 +174,7 @@ void settings_menu(void)
|
|||
#ifdef HAVE_RTC
|
||||
{ "Time/Date", timedate_set },
|
||||
#endif
|
||||
{ "Show hidden files", show_hidden_files },
|
||||
{ "FF/Rewind", ff_rewind },
|
||||
{ "Resume", resume },
|
||||
};
|
||||
|
|
36
apps/tree.c
36
apps/tree.c
|
@ -190,15 +190,27 @@ static int showdir(char *path, int start)
|
|||
if (!entry)
|
||||
break;
|
||||
|
||||
len = strlen(entry->d_name);
|
||||
|
||||
/* skip directories . and .. */
|
||||
if ((entry->attribute & ATTR_DIRECTORY) &&
|
||||
(!strncmp(entry->d_name, ".", 1) ||
|
||||
!strncmp(entry->d_name, "..", 2))) {
|
||||
(((len == 1) &&
|
||||
(!strncmp(entry->d_name, ".", 1))) ||
|
||||
((len == 2) &&
|
||||
(!strncmp(entry->d_name, "..", 2))))) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Skip dotfiles if set to skip them */
|
||||
if (!global_settings.show_hidden_files &&
|
||||
((entry->d_name[0]=='.') ||
|
||||
(entry->attribute & ATTR_HIDDEN))) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
dptr->attr = entry->attribute;
|
||||
len = strlen(entry->d_name);
|
||||
|
||||
/* mark mp3 and m3u files as such */
|
||||
if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) {
|
||||
|
@ -209,10 +221,10 @@ static int showdir(char *path, int start)
|
|||
dptr->attr |= TREE_ATTR_M3U;
|
||||
}
|
||||
|
||||
/* filter hidden files and directories and non-mp3 or m3u files */
|
||||
/* filter non-mp3 or m3u files */
|
||||
if ( global_settings.mp3filter &&
|
||||
((dptr->attr & ATTR_HIDDEN) ||
|
||||
!(dptr->attr & (ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) {
|
||||
(!(dptr->attr &
|
||||
(ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
@ -627,13 +639,23 @@ bool dirbrowse(char *root)
|
|||
case TREE_MENU: {
|
||||
bool lastfilter = global_settings.mp3filter;
|
||||
bool lastsortcase = global_settings.sort_case;
|
||||
bool show_hidden_files = global_settings.show_hidden_files;
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
bool laststate=statusbar(false);
|
||||
#endif
|
||||
|
||||
lcd_stop_scroll();
|
||||
main_menu();
|
||||
/* do we need to rescan dir? */
|
||||
if ( lastfilter != global_settings.mp3filter ||
|
||||
lastsortcase != global_settings.sort_case)
|
||||
lastsortcase != global_settings.sort_case ||
|
||||
show_hidden_files != global_settings.show_hidden_files)
|
||||
lastdir[0] = 0;
|
||||
restore = true;
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
statusbar(laststate);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue