Added 'Party Mode': Unstoppable playback


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9114 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/filetree.c b/apps/filetree.c
index b8f0667..846e707 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -344,6 +344,11 @@
         gui_syncsplash(0, true, str(LANG_WAIT));
         switch ( file->attr & TREE_ATTR_MASK ) {
             case TREE_ATTR_M3U:
+                if (global_settings.party_mode) {
+                    gui_syncsplash(HZ, true, str(LANG_PARTY_MODE));
+                    break;
+                }
+
                 if (bookmark_autoload(buf))
                     break;
 
@@ -385,7 +390,12 @@
                         break;
                 }
 
-                if (playlist_create(c->currdir, NULL) != -1)
+                if (global_settings.party_mode) {
+                    playlist_insert_track(NULL, buf,
+                                          PLAYLIST_INSERT_LAST, true);
+                    gui_syncsplash(HZ, true, str(LANG_INSERT_LAST));
+                }
+                else if (playlist_create(c->currdir, NULL) != -1)
                 {
                     start_index = ft_build_playlist(c, c->selected_item);
                     if (global_settings.playlist_shuffle)
@@ -462,6 +472,11 @@
 
                 /* plugin file */
             case TREE_ATTR_ROCK:
+                if (global_settings.party_mode) {
+                    gui_syncsplash(HZ, true, str(LANG_PARTY_MODE));
+                    break;
+                }
+
                 if (plugin_load(buf,NULL) == PLUGIN_USB_CONNECTED)
                 {
                     if(*c->dirfilter > NUM_FILTER_MODES)
@@ -475,7 +490,14 @@
 
             default:
             {
-                char* plugin = filetype_get_plugin(file);
+                char* plugin;
+
+                if (global_settings.party_mode) {
+                    gui_syncsplash(HZ, true, str(LANG_PARTY_MODE));
+                    break;
+                }
+                
+                plugin = filetype_get_plugin(file);
                 if (plugin)
                 {
                     if (plugin_load(plugin,buf) == PLUGIN_USB_CONNECTED)
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 334fc79..2ec1c4d 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -286,6 +286,8 @@
 #endif
 #ifdef WPS_RC_PAUSE
             case WPS_RC_PAUSE:
+                if (global_settings.party_mode)
+                    break;
 #ifdef WPS_RC_PAUSE_PRE
                 if ((button == WPS_RC_PAUSE) &&
                     (lastbutton != WPS_RC_PAUSE_PRE))
@@ -365,6 +367,8 @@
             case WPS_RC_FFWD:
 #endif
             case WPS_FFWD:
+                if (global_settings.party_mode)
+                    break;
 #ifdef WPS_NEXT_DIR
                 if (current_tick - right_lastclick < HZ)
                 {
@@ -377,6 +381,8 @@
             case WPS_RC_REW:
 #endif
             case WPS_REW:
+                if (global_settings.party_mode)
+                    break;
 #ifdef WPS_PREV_DIR
                 if (current_tick - left_lastclick < HZ)
                 {
@@ -396,6 +402,8 @@
 #endif
 #ifdef WPS_RC_PREV
             case WPS_RC_PREV:
+                if (global_settings.party_mode)
+                    break;
 #ifdef WPS_RC_PREV_PRE
                 if ((button == WPS_RC_PREV) && (lastbutton != WPS_RC_PREV_PRE))
                     break;
@@ -441,6 +449,8 @@
             case WPS_RC_NEXT_DIR:
 #endif
             case WPS_NEXT_DIR:
+                if (global_settings.party_mode)
+                    break;
 #if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
                 if (ab_repeat_mode_enabled())
                 {
@@ -460,6 +470,8 @@
             case WPS_RC_PREV_DIR:
 #endif
             case WPS_PREV_DIR:
+                if (global_settings.party_mode)
+                    break;
 #if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
                 if (ab_repeat_mode_enabled())
                     ab_set_A_marker(wps_state.id3->elapsed);
@@ -479,6 +491,8 @@
 #endif
 #ifdef WPS_RC_NEXT
             case WPS_RC_NEXT:
+                if (global_settings.party_mode)
+                    break;
 #ifdef WPS_RC_NEXT_PRE
                 if ((button == WPS_RC_NEXT) && (lastbutton != WPS_RC_NEXT_PRE))
                     break;
@@ -681,6 +695,8 @@
                 if (lastbutton != WPS_EXIT_PRE)
                     break;
 # endif
+                if (global_settings.party_mode)
+                    break;
                 exit = true;
 #ifdef WPS_RC_EXIT
             case WPS_RC_EXIT:
@@ -688,6 +704,8 @@
                  if (lastbutton != WPS_RC_EXIT_PRE)
                      break;
 #endif
+                if (global_settings.party_mode)
+                    break;
                 exit = true;
 #endif
                 break;
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index bc355f0..8f5d4b7 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3796,3 +3796,9 @@
 eng: "Searching... %d found (%s)"
 voice: ""
 new:
+
+id: LANG_PARTY_MODE
+desc: party mode
+eng: "Party Mode"
+voice: "Party Mode"
+new:
diff --git a/apps/settings.h b/apps/settings.h
index 546c546..3d129ba 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -471,6 +471,7 @@
     int bg_color; /* background color native format */
     int fg_color; /* foreground color native format */
 #endif
+    bool party_mode;	/* party mode - unstoppable music */
 };
 
 enum optiontype { INT, BOOL };
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 7f29602..517c7f1 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -1041,6 +1041,11 @@
     return set_bool( str(LANG_FADE_ON_STOP), &global_settings.fade_on_stop );
 }
 
+static bool set_party_mode(void)
+{
+    return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode );
+}
+
 
 static bool ff_rewind_accel(void) 
 { 
@@ -1461,6 +1466,7 @@
         { ID2P(LANG_WIND_MENU), ff_rewind_settings_menu },
         { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin },
         { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop },
+        { ID2P(LANG_PARTY_MODE), set_party_mode },
 #if CONFIG_CODEC == SWCODEC
         { ID2P(LANG_CROSSFADE), crossfade_settings_menu },
         { ID2P(LANG_REPLAYGAIN), replaygain_settings_menu },
diff --git a/apps/tree.c b/apps/tree.c
index 7aa0f32..b11d28f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -637,8 +637,10 @@
                 if (*tc.dirfilter < NUM_FILTER_MODES)
                 {
                     /* Stop the music if it is playing */
-                    if(audio_status())
-                        audio_stop();
+                    if(audio_status()) {
+                        if (!global_settings.party_mode)
+                            audio_stop();
+                    }
 #if defined(HAVE_CHARGING) && \
     (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
                     else {