diff options
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r-- | apps/gui/wps.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index a522a08101..473f0a4d75 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -657,6 +657,32 @@ static void gwps_enter_wps(void) | |||
657 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); | 657 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); |
658 | } | 658 | } |
659 | 659 | ||
660 | void wps_do_playpause(bool updatewps) | ||
661 | { | ||
662 | struct wps_state *state = skin_get_global_state(); | ||
663 | if ( state->paused ) | ||
664 | { | ||
665 | state->paused = false; | ||
666 | if ( global_settings.fade_on_stop ) | ||
667 | fade(true, updatewps); | ||
668 | else | ||
669 | audio_resume(); | ||
670 | } | ||
671 | else | ||
672 | { | ||
673 | state->paused = true; | ||
674 | if ( global_settings.fade_on_stop ) | ||
675 | fade(false, updatewps); | ||
676 | else | ||
677 | audio_pause(); | ||
678 | settings_save(); | ||
679 | #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) | ||
680 | call_storage_idle_notifys(true); /* make sure resume info is saved */ | ||
681 | #endif | ||
682 | } | ||
683 | } | ||
684 | |||
685 | |||
660 | /* The WPS can be left in two ways: | 686 | /* The WPS can be left in two ways: |
661 | * a) call a function, which draws over the wps. In this case, the wps | 687 | * a) call a function, which draws over the wps. In this case, the wps |
662 | * will be still active (i.e. the below function didn't return) | 688 | * will be still active (i.e. the below function didn't return) |
@@ -783,26 +809,7 @@ long gui_wps_show(void) | |||
783 | case ACTION_WPS_PLAY: | 809 | case ACTION_WPS_PLAY: |
784 | if (global_settings.party_mode) | 810 | if (global_settings.party_mode) |
785 | break; | 811 | break; |
786 | if ( state->paused ) | 812 | wps_do_playpause(true); |
787 | { | ||
788 | state->paused = false; | ||
789 | if ( global_settings.fade_on_stop ) | ||
790 | fade(true, true); | ||
791 | else | ||
792 | audio_resume(); | ||
793 | } | ||
794 | else | ||
795 | { | ||
796 | state->paused = true; | ||
797 | if ( global_settings.fade_on_stop ) | ||
798 | fade(false, true); | ||
799 | else | ||
800 | audio_pause(); | ||
801 | settings_save(); | ||
802 | #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) | ||
803 | call_storage_idle_notifys(true); /* make sure resume info is saved */ | ||
804 | #endif | ||
805 | } | ||
806 | break; | 813 | break; |
807 | 814 | ||
808 | case ACTION_WPS_VOLUP: | 815 | case ACTION_WPS_VOLUP: |