summaryrefslogtreecommitdiff
path: root/apps/menus/settings_menu.c
diff options
context:
space:
mode:
authorMichael Hohmuth <sideral@rockbox.org>2011-02-08 20:31:35 +0000
committerMichael Hohmuth <sideral@rockbox.org>2011-02-08 20:31:35 +0000
commit7141ff45133c9c669e9a0769a6c13e05cbe0595c (patch)
tree329e47007c157841d61bc604431223fce3d34ab7 /apps/menus/settings_menu.c
parent4844142e161f24102bbe45f1f6207f3468649e78 (diff)
downloadrockbox-7141ff45133c9c669e9a0769a6c13e05cbe0595c.tar.gz
rockbox-7141ff45133c9c669e9a0769a6c13e05cbe0595c.zip
Add option to resume next track on automatic track change
Move autoresume setting into its own menu. Add option to customize which tracks should be resumed on automatic track change. Tracks can be selected based on their their file location or genre tag (comma-separated list of filename / genre substrings). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29251 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r--apps/menus/settings_menu.c86
1 files changed, 60 insertions, 26 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index ce03e1a646..363792870d 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -28,6 +28,7 @@
28#include "action.h" 28#include "action.h"
29#include "settings.h" 29#include "settings.h"
30#include "menu.h" 30#include "menu.h"
31#include "keyboard.h"
31#include "sound_menu.h" 32#include "sound_menu.h"
32#include "exported_menus.h" 33#include "exported_menus.h"
33#include "tree.h" 34#include "tree.h"
@@ -368,6 +369,64 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
368/***********************************/ 369/***********************************/
369 370
370/***********************************/ 371/***********************************/
372/* AUTORESUME MENU */
373#ifdef HAVE_TAGCACHE
374#if CONFIG_CODEC == SWCODEC
375
376static int autoresume_callback(int action, const struct menu_item_ex *this_item)
377{
378 (void)this_item;
379
380 if (action == ACTION_EXIT_MENUITEM /* on exit */
381 && global_settings.autoresume_enable
382 && !tagcache_is_usable())
383 {
384 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
385 ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
386 static const struct text_message message = {lines, 2};
387
388 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
389 tagcache_rebuild_with_splash();
390 }
391 return action;
392}
393
394static int autoresume_nexttrack_callback(int action,
395 const struct menu_item_ex *this_item)
396{
397 (void)this_item;
398 static int oldval = 0;
399 switch (action)
400 {
401 case ACTION_ENTER_MENUITEM:
402 oldval = global_settings.autoresume_automatic;
403 break;
404 case ACTION_EXIT_MENUITEM:
405 if (global_settings.autoresume_automatic == AUTORESUME_NEXTTRACK_CUSTOM
406 && kbd_input ((char*) &global_settings.autoresume_strpat,
407 MAX_PATHNAME+1) < 0)
408 {
409 global_settings.autoresume_automatic = oldval;
410 }
411 }
412 return action;
413}
414
415MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable,
416 autoresume_callback);
417MENUITEM_SETTING(autoresume_automatic, &global_settings.autoresume_automatic,
418 autoresume_nexttrack_callback);
419
420MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME),
421 0, Icon_NOICON,
422 &autoresume_enable, &autoresume_automatic);
423
424#endif /* CONFIG_CODEC == SWCODEC */
425#endif /* HAVE_TAGCACHE */
426/* AUTORESUME MENU */
427/***********************************/
428
429/***********************************/
371/* VOICE MENU */ 430/* VOICE MENU */
372static int talk_callback(int action,const struct menu_item_ex *this_item); 431static int talk_callback(int action,const struct menu_item_ex *this_item);
373MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); 432MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL);
@@ -425,31 +484,6 @@ MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON,
425/***********************************/ 484/***********************************/
426/* SETTINGS MENU */ 485/* SETTINGS MENU */
427 486
428#ifdef HAVE_TAGCACHE
429#if CONFIG_CODEC == SWCODEC
430static int autoresume_callback(int action, const struct menu_item_ex *this_item)
431{
432 (void)this_item;
433
434 if (action == ACTION_EXIT_MENUITEM /* on exit */
435 && global_settings.autoresume_enable
436 && !tagcache_is_usable())
437 {
438 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
439 ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
440 static const struct text_message message = {lines, 2};
441
442 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
443 tagcache_rebuild_with_splash();
444 }
445 return action;
446}
447
448MENUITEM_SETTING(autoresume_enable, &global_settings.autoresume_enable,
449 autoresume_callback);
450#endif
451#endif
452
453static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG }; 487static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG };
454 488
455MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE), 489MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE),
@@ -465,7 +499,7 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
465 &bookmark_settings_menu, 499 &bookmark_settings_menu,
466#ifdef HAVE_TAGCACHE 500#ifdef HAVE_TAGCACHE
467#if CONFIG_CODEC == SWCODEC 501#if CONFIG_CODEC == SWCODEC
468 &autoresume_enable, 502 &autoresume_menu,
469#endif 503#endif
470#endif 504#endif
471 &browse_langs, &voice_settings_menu, 505 &browse_langs, &voice_settings_menu,