diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-09-24 19:12:09 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-09-24 19:12:09 +0000 |
commit | a7dcf912e1be349da3dadeaf235ee4faf5e9dbaa (patch) | |
tree | 5bc79ed6c56a86ffded950f3679368408c0c758e /apps/tree.c | |
parent | cae1d3b115821b055bd528f08ee5179f2d85ff8f (diff) | |
download | rockbox-a7dcf912e1be349da3dadeaf235ee4faf5e9dbaa.tar.gz rockbox-a7dcf912e1be349da3dadeaf235ee4faf5e9dbaa.zip |
Merged 'mp3 filter' and 'show hidden files' into a single filter option.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2405 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/apps/tree.c b/apps/tree.c index 3aba7fa3b4..d433787e4b 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -235,8 +235,8 @@ static int showdir(char *path, int start) | |||
235 | continue; | 235 | continue; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Skip dotfiles if set to skip them */ | 238 | /* filter out dotfiles and hidden files */ |
239 | if (!global_settings.show_hidden_files && | 239 | if (global_settings.dirfilter != SHOW_ALL && |
240 | ((entry->d_name[0]=='.') || | 240 | ((entry->d_name[0]=='.') || |
241 | (entry->attribute & ATTR_HIDDEN))) { | 241 | (entry->attribute & ATTR_HIDDEN))) { |
242 | i--; | 242 | i--; |
@@ -269,15 +269,22 @@ static int showdir(char *path, int start) | |||
269 | dptr->attr |= TREE_ATTR_MOD; | 269 | dptr->attr |= TREE_ATTR_MOD; |
270 | } | 270 | } |
271 | 271 | ||
272 | /* filter non-mp3 or m3u files */ | 272 | /* filter out non-music files */ |
273 | if ( global_settings.mp3filter && | 273 | if ( global_settings.dirfilter == SHOW_MUSIC && |
274 | (!(dptr->attr & | 274 | (!(dptr->attr & |
275 | (ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ) { | 275 | (ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ) { |
276 | i--; | 276 | i--; |
277 | continue; | 277 | continue; |
278 | } | 278 | } |
279 | 279 | ||
280 | if(len > NAME_BUFFER_SIZE - name_buffer_length - 1) { | 280 | /* filter out non-supported files */ |
281 | if ( global_settings.dirfilter == SHOW_SUPPORTED && | ||
282 | (!(dptr->attr & TREE_ATTR_MASK)) ) { | ||
283 | i--; | ||
284 | continue; | ||
285 | } | ||
286 | |||
287 | if (len > NAME_BUFFER_SIZE - name_buffer_length - 1) { | ||
281 | /* Tell the world that we ran out of buffer space */ | 288 | /* Tell the world that we ran out of buffer space */ |
282 | dir_buffer_full = true; | 289 | dir_buffer_full = true; |
283 | break; | 290 | break; |
@@ -407,8 +414,8 @@ static int showdir(char *path, int start) | |||
407 | #endif | 414 | #endif |
408 | } | 415 | } |
409 | 416 | ||
410 | /* if MP3 filter is on, cut off the extension */ | 417 | /* if music filter is on, cut off the extension */ |
411 | if (global_settings.mp3filter && | 418 | if (global_settings.dirfilter == SHOW_MUSIC && |
412 | (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA))) | 419 | (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA))) |
413 | { | 420 | { |
414 | char temp = dircache[i].name[len-4]; | 421 | char temp = dircache[i].name[len-4]; |
@@ -587,9 +594,8 @@ bool dirbrowse(char *root) | |||
587 | int button; | 594 | int button; |
588 | int tree_max_on_screen; | 595 | int tree_max_on_screen; |
589 | bool reload_root = false; | 596 | bool reload_root = false; |
590 | bool lastfilter = global_settings.mp3filter; | 597 | int lastfilter = global_settings.dirfilter; |
591 | bool lastsortcase = global_settings.sort_case; | 598 | bool lastsortcase = global_settings.sort_case; |
592 | bool lastshowhidden = global_settings.show_hidden_files; | ||
593 | #ifdef HAVE_LCD_BITMAP | 599 | #ifdef HAVE_LCD_BITMAP |
594 | int fw, fh; | 600 | int fw, fh; |
595 | lcd_getstringsize("A", &fw, &fh); | 601 | lcd_getstringsize("A", &fw, &fh); |
@@ -927,9 +933,8 @@ bool dirbrowse(char *root) | |||
927 | 933 | ||
928 | /* do we need to rescan dir? */ | 934 | /* do we need to rescan dir? */ |
929 | if (reload_root || | 935 | if (reload_root || |
930 | lastfilter != global_settings.mp3filter || | 936 | lastfilter != global_settings.dirfilter || |
931 | lastsortcase != global_settings.sort_case || | 937 | lastsortcase != global_settings.sort_case) |
932 | lastshowhidden != global_settings.show_hidden_files) | ||
933 | { | 938 | { |
934 | if ( reload_root ) { | 939 | if ( reload_root ) { |
935 | strcpy(currdir, "/"); | 940 | strcpy(currdir, "/"); |
@@ -939,9 +944,8 @@ bool dirbrowse(char *root) | |||
939 | dircursor = 0; | 944 | dircursor = 0; |
940 | dirstart = 0; | 945 | dirstart = 0; |
941 | lastdir[0] = 0; | 946 | lastdir[0] = 0; |
942 | lastfilter = global_settings.mp3filter; | 947 | lastfilter = global_settings.dirfilter; |
943 | lastsortcase = global_settings.sort_case; | 948 | lastsortcase = global_settings.sort_case; |
944 | lastshowhidden = global_settings.show_hidden_files; | ||
945 | restore = true; | 949 | restore = true; |
946 | } | 950 | } |
947 | 951 | ||
@@ -964,25 +968,21 @@ bool dirbrowse(char *root) | |||
964 | if(lasti!=i || restore) { | 968 | if(lasti!=i || restore) { |
965 | lasti=i; | 969 | lasti=i; |
966 | lcd_stop_scroll(); | 970 | lcd_stop_scroll(); |
967 | if (global_settings.mp3filter && | 971 | if (global_settings.dirfilter == SHOW_MUSIC && |
968 | (dircache[i].attr & | 972 | (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA))) |
969 | (TREE_ATTR_M3U|TREE_ATTR_MPA))) | ||
970 | { | 973 | { |
971 | int len = strlen(dircache[i].name); | 974 | int len = strlen(dircache[i].name); |
972 | char temp = dircache[i].name[len-4]; | 975 | char temp = dircache[i].name[len-4]; |
973 | dircache[i].name[len-4] = 0; | 976 | dircache[i].name[len-4] = 0; |
974 | lcd_puts_scroll(LINE_X, dircursor, | 977 | lcd_puts_scroll(LINE_X, dircursor, dircache[i].name); |
975 | dircache[i].name); | ||
976 | dircache[i].name[len-4] = temp; | 978 | dircache[i].name[len-4] = temp; |
977 | } | 979 | } |
978 | else | 980 | else |
979 | lcd_puts_scroll(LINE_X, dircursor, | 981 | lcd_puts_scroll(LINE_X, dircursor, dircache[i].name); |
980 | dircache[i].name); | ||
981 | } | 982 | } |
982 | } | 983 | } |
983 | status_draw(); | 984 | status_draw(); |
984 | lcd_update(); | 985 | lcd_update(); |
985 | |||
986 | } | 986 | } |
987 | 987 | ||
988 | return false; | 988 | return false; |