summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/onplay.c61
-rw-r--r--apps/screens.c3
-rw-r--r--apps/screens.h14
3 files changed, 46 insertions, 32 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 42e43379a5..2a86dfbaf5 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -150,8 +150,8 @@ static bool list_viewers(void)
150static bool shuffle_playlist(void) 150static bool shuffle_playlist(void)
151{ 151{
152 playlist_sort(NULL, true); 152 playlist_sort(NULL, true);
153 playlist_randomise(NULL, current_tick, true); 153 playlist_randomise(NULL, current_tick, true);
154 154
155 return false; 155 return false;
156} 156}
157 157
@@ -225,7 +225,7 @@ static bool view_playlist(void)
225/* Sub-menu for playlist options */ 225/* Sub-menu for playlist options */
226static bool playlist_options(void) 226static bool playlist_options(void)
227{ 227{
228 struct menu_item items[13]; 228 struct menu_item items[13];
229 struct playlist_args args[13]; /* increase these 2 if you add entries! */ 229 struct playlist_args args[13]; /* increase these 2 if you add entries! */
230 int m, i=0, pstart=0, result; 230 int m, i=0, pstart=0, result;
231 bool ret = false; 231 bool ret = false;
@@ -246,23 +246,23 @@ static bool playlist_options(void)
246 items[i].function = playlist_viewer; 246 items[i].function = playlist_viewer;
247 i++; 247 i++;
248 pstart++; 248 pstart++;
249 249
250 items[i].desc = ID2P(LANG_SEARCH_IN_PLAYLIST); 250 items[i].desc = ID2P(LANG_SEARCH_IN_PLAYLIST);
251 items[i].function = search_playlist; 251 items[i].function = search_playlist;
252 i++; 252 i++;
253 pstart++; 253 pstart++;
254 254
255 items[i].desc = ID2P(LANG_SAVE_DYNAMIC_PLAYLIST); 255 items[i].desc = ID2P(LANG_SAVE_DYNAMIC_PLAYLIST);
256 items[i].function = save_playlist; 256 items[i].function = save_playlist;
257 i++; 257 i++;
258 pstart++; 258 pstart++;
259 259
260 items[i].desc = ID2P(LANG_SHUFFLE_PLAYLIST); 260 items[i].desc = ID2P(LANG_SHUFFLE_PLAYLIST);
261 items[i].function = shuffle_playlist; 261 items[i].function = shuffle_playlist;
262 i++; 262 i++;
263 pstart++; 263 pstart++;
264 } 264 }
265 265
266 if (context == CONTEXT_TREE || context == CONTEXT_ID3DB) 266 if (context == CONTEXT_TREE || context == CONTEXT_ID3DB)
267 { 267 {
268 if (audio_status() & AUDIO_STATUS_PLAY) 268 if (audio_status() & AUDIO_STATUS_PLAY)
@@ -286,7 +286,7 @@ static bool playlist_options(void)
286 args[i].position = PLAYLIST_INSERT_SHUFFLED; 286 args[i].position = PLAYLIST_INSERT_SHUFFLED;
287 args[i].queue = false; 287 args[i].queue = false;
288 i++; 288 i++;
289 289
290 items[i].desc = ID2P(LANG_QUEUE); 290 items[i].desc = ID2P(LANG_QUEUE);
291 args[i].position = PLAYLIST_INSERT; 291 args[i].position = PLAYLIST_INSERT;
292 args[i].queue = true; 292 args[i].queue = true;
@@ -335,7 +335,7 @@ static int remove_dir(char* dirname, int len)
335 int result = 0; 335 int result = 0;
336 DIR* dir; 336 DIR* dir;
337 int dirlen = strlen(dirname); 337 int dirlen = strlen(dirname);
338 338
339 dir = opendir(dirname); 339 dir = opendir(dirname);
340 if (!dir) 340 if (!dir)
341 return -1; /* open error */ 341 return -1; /* open error */
@@ -351,17 +351,17 @@ static int remove_dir(char* dirname, int len)
351 /* append name to current directory */ 351 /* append name to current directory */
352 snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name); 352 snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name);
353 353
354 if (entry->attribute & ATTR_DIRECTORY) 354 if (entry->attribute & ATTR_DIRECTORY)
355 { /* remove a subdirectory */ 355 { /* remove a subdirectory */
356 if (!strcmp((char *)entry->d_name, ".") || 356 if (!strcmp((char *)entry->d_name, ".") ||
357 !strcmp((char *)entry->d_name, "..")) 357 !strcmp((char *)entry->d_name, ".."))
358 continue; /* skip these */ 358 continue; /* skip these */
359 359
360 result = remove_dir(dirname, len); /* recursion */ 360 result = remove_dir(dirname, len); /* recursion */
361 if (result) 361 if (result)
362 break; /* or better continue, delete what we can? */ 362 break; /* or better continue, delete what we can? */
363 } 363 }
364 else 364 else
365 { /* remove a file */ 365 { /* remove a file */
366 result = remove(dirname); 366 result = remove(dirname);
367 } 367 }
@@ -371,7 +371,7 @@ static int remove_dir(char* dirname, int len)
371 if (!result) 371 if (!result)
372 { /* remove the now empty directory */ 372 { /* remove the now empty directory */
373 dirname[dirlen] = '\0'; /* terminate to original length */ 373 dirname[dirlen] = '\0'; /* terminate to original length */
374 374
375 result = rmdir(dirname); 375 result = rmdir(dirname);
376 } 376 }
377 377
@@ -433,7 +433,7 @@ static bool set_backdrop(void)
433 ret = read_bmp_file(selected_file, &bm, 433 ret = read_bmp_file(selected_file, &bm,
434 sizeof(main_backdrop), FORMAT_NATIVE); 434 sizeof(main_backdrop), FORMAT_NATIVE);
435 435
436 if ((ret > 0) && (bm.width == LCD_WIDTH) 436 if ((ret > 0) && (bm.width == LCD_WIDTH)
437 && (bm.height == LCD_HEIGHT)) { 437 && (bm.height == LCD_HEIGHT)) {
438 lcd_set_backdrop(&main_backdrop[0][0]); 438 lcd_set_backdrop(&main_backdrop[0][0]);
439 gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED)); 439 gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED));
@@ -478,7 +478,7 @@ bool create_dir(void)
478 478
479 cwd = getcwd(NULL, 0); 479 cwd = getcwd(NULL, 0);
480 memset(dirname, 0, sizeof dirname); 480 memset(dirname, 0, sizeof dirname);
481 481
482 snprintf(dirname, sizeof dirname, "%s/", 482 snprintf(dirname, sizeof dirname, "%s/",
483 cwd[1] ? cwd : ""); 483 cwd[1] ? cwd : "");
484 484
@@ -506,7 +506,7 @@ static bool clipboard_clip(bool copy)
506 clipboard_selection_attr = selected_file_attr; 506 clipboard_selection_attr = selected_file_attr;
507 clipboard_is_copy = copy; 507 clipboard_is_copy = copy;
508 508
509 return true; 509 return true;
510} 510}
511 511
512static bool clipboard_cut(void) 512static bool clipboard_cut(void)
@@ -543,7 +543,7 @@ static bool clipboard_pastefile(const char *src, const char *target, bool copy)
543 543
544 src_fd = open(src, O_RDONLY); 544 src_fd = open(src, O_RDONLY);
545 545
546 if (src_fd >= 0) { 546 if (src_fd >= 0) {
547 target_fd = creat(target, O_WRONLY); 547 target_fd = creat(target, O_WRONLY);
548 548
549 if (target_fd >= 0) { 549 if (target_fd >= 0) {
@@ -619,7 +619,7 @@ static bool clipboard_pastedirectory(char *src, int srclen, char *target, int ta
619 /* Check if the target exists */ 619 /* Check if the target exists */
620 fd = open(target, O_RDONLY); 620 fd = open(target, O_RDONLY);
621 close(fd); 621 close(fd);
622 622
623 if (fd < 0) { 623 if (fd < 0) {
624 if (!copy) { 624 if (!copy) {
625 /* Just move the directory */ 625 /* Just move the directory */
@@ -668,7 +668,7 @@ static bool clipboard_pastedirectory(char *src, int srclen, char *target, int ta
668 668
669 DEBUGF("Copy %s to %s\n", src, target); 669 DEBUGF("Copy %s to %s\n", src, target);
670 670
671 if (entry->attribute & ATTR_DIRECTORY) 671 if (entry->attribute & ATTR_DIRECTORY)
672 { /* copy/move a subdirectory */ 672 { /* copy/move a subdirectory */
673 if (!strcmp((char *)entry->d_name, ".") || 673 if (!strcmp((char *)entry->d_name, ".") ||
674 !strcmp((char *)entry->d_name, "..")) 674 !strcmp((char *)entry->d_name, ".."))
@@ -676,7 +676,7 @@ static bool clipboard_pastedirectory(char *src, int srclen, char *target, int ta
676 676
677 result = clipboard_pastedirectory(src, srclen, target, targetlen, copy); /* recursion */ 677 result = clipboard_pastedirectory(src, srclen, target, targetlen, copy); /* recursion */
678 } 678 }
679 else 679 else
680 { /* copy/move a file */ 680 { /* copy/move a file */
681 result = clipboard_pastefile(src, target, copy); 681 result = clipboard_pastefile(src, target, copy);
682 } 682 }
@@ -748,7 +748,7 @@ static bool clipboard_paste(void)
748 onplay_result = ONPLAY_RELOAD_DIR; 748 onplay_result = ONPLAY_RELOAD_DIR;
749 } else { 749 } else {
750 gui_syncsplash(HZ, true, (unsigned char *)"%s %s", 750 gui_syncsplash(HZ, true, (unsigned char *)"%s %s",
751 str(LANG_PASTE), str(LANG_FAILED)); 751 str(LANG_PASTE), str(LANG_FAILED));
752 } 752 }
753 753
754 return true; 754 return true;
@@ -812,7 +812,7 @@ int onplay(char* file, int attr, int from)
812 items[i].function = bookmark_menu; 812 items[i].function = bookmark_menu;
813 i++; 813 i++;
814 } 814 }
815 815
816 if (file) 816 if (file)
817 { 817 {
818 if (context == CONTEXT_WPS) 818 if (context == CONTEXT_WPS)
@@ -827,7 +827,7 @@ int onplay(char* file, int attr, int from)
827 i++; 827 i++;
828 } 828 }
829 } 829 }
830 830
831#ifdef HAVE_MULTIVOLUME 831#ifdef HAVE_MULTIVOLUME
832 if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */ 832 if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */
833#endif 833#endif
@@ -907,19 +907,22 @@ int onplay(char* file, int attr, int from)
907 items[i].function = create_dir; 907 items[i].function = create_dir;
908 i++; 908 i++;
909 } 909 }
910
911#if CONFIG_CODEC == SWCODEC
912 /* Equalizer menu items */
913 if (context == CONTEXT_WPS) 910 if (context == CONTEXT_WPS)
914 { 911 {
912 /* Pitch screen access */
913 items[i].desc = ID2P(LANG_PITCH);
914 items[i].function = pitch_screen;
915 i++;
916#if CONFIG_CODEC == SWCODEC
917 /* Equalizer menu items */
915 items[i].desc = ID2P(LANG_EQUALIZER_GRAPHICAL); 918 items[i].desc = ID2P(LANG_EQUALIZER_GRAPHICAL);
916 items[i].function = eq_menu_graphical; 919 items[i].function = eq_menu_graphical;
917 i++; 920 i++;
918 items[i].desc = ID2P(LANG_EQUALIZER_BROWSE); 921 items[i].desc = ID2P(LANG_EQUALIZER_BROWSE);
919 items[i].function = eq_browse_presets; 922 items[i].function = eq_browse_presets;
920 i++; 923 i++;
921 }
922#endif 924#endif
925 }
923 926
924 /* DIY menu handling, since we want to exit after selection */ 927 /* DIY menu handling, since we want to exit after selection */
925 if (i) 928 if (i)
@@ -929,7 +932,7 @@ int onplay(char* file, int attr, int from)
929 if (result >= 0) 932 if (result >= 0)
930 items[result].function(); 933 items[result].function();
931 menu_exit(m); 934 menu_exit(m);
932 935
933 if (exit_to_main) 936 if (exit_to_main)
934 result = main_menu(); 937 result = main_menu();
935 938
diff --git a/apps/screens.c b/apps/screens.c
index 540cde5499..ce66c40418 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -345,7 +345,6 @@ int charging_screen(void)
345} 345}
346#endif /* HAVE_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */ 346#endif /* HAVE_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */
347 347
348#if (CONFIG_KEYPAD != IAUDIO_X5_PAD) && (CONFIG_KEYPAD != PLAYER_PAD)
349/* returns: 348/* returns:
350 0 if no key was pressed 349 0 if no key was pressed
351 1 if USB was connected */ 350 1 if USB was connected */
@@ -459,8 +458,6 @@ bool pitch_screen(void)
459 return 0; 458 return 0;
460} 459}
461 460
462#endif
463
464#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\ 461#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\
465 (CONFIG_KEYPAD == IRIVER_H300_PAD) 462 (CONFIG_KEYPAD == IRIVER_H300_PAD)
466#define bool_to_int(b)\ 463#define bool_to_int(b)\
diff --git a/apps/screens.h b/apps/screens.h
index 93efe77ecb..4b4f4fe725 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -44,6 +44,20 @@
44#define PITCH_LEFT BUTTON_LEFT 44#define PITCH_LEFT BUTTON_LEFT
45#define PITCH_EXIT BUTTON_SELECT 45#define PITCH_EXIT BUTTON_SELECT
46#define PITCH_RESET BUTTON_MENU 46#define PITCH_RESET BUTTON_MENU
47#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
48#define PITCH_UP BUTTON_UP
49#define PITCH_DOWN BUTTON_DOWN
50#define PITCH_RIGHT BUTTON_RIGHT
51#define PITCH_LEFT BUTTON_LEFT
52#define PITCH_EXIT BUTTON_SELECT
53#define PITCH_RESET BUTTON_A
54#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
55#define PITCH_UP BUTTON_UP
56#define PITCH_DOWN BUTTON_DOWN
57#define PITCH_RIGHT BUTTON_RIGHT
58#define PITCH_LEFT BUTTON_LEFT
59#define PITCH_EXIT BUTTON_PLAY
60#define PITCH_RESET BUTTON_POWER
47#endif 61#endif
48 62
49struct screen; 63struct screen;