Consolidate code duplication in WPS volume changing handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23436 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
48960bfe29
commit
28aef1f96a
1 changed files with 21 additions and 31 deletions
|
@ -707,6 +707,7 @@ long gui_wps_show(void)
|
|||
bool exit = false;
|
||||
bool bookmark = false;
|
||||
bool update = false;
|
||||
bool vol_changed = false;
|
||||
int i;
|
||||
long last_left = 0, last_right = 0;
|
||||
|
||||
|
@ -867,40 +868,12 @@ long gui_wps_show(void)
|
|||
break;
|
||||
|
||||
case ACTION_WPS_VOLUP:
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
gui_wps[i].data->button_time_volume = current_tick;
|
||||
global_settings.volume++;
|
||||
bool res = false;
|
||||
setvol();
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
if(update_onvol_change(&gui_wps[i]))
|
||||
res = true;
|
||||
}
|
||||
if (res) {
|
||||
restore = true;
|
||||
restoretimer = RESTORE_WPS_NEXT_SECOND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
vol_changed = true;
|
||||
break;
|
||||
case ACTION_WPS_VOLDOWN:
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
gui_wps[i].data->button_time_volume = current_tick;
|
||||
global_settings.volume--;
|
||||
setvol();
|
||||
bool res = false;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
if(update_onvol_change(&gui_wps[i]))
|
||||
res = true;
|
||||
}
|
||||
if (res) {
|
||||
restore = true;
|
||||
restoretimer = RESTORE_WPS_NEXT_SECOND;
|
||||
}
|
||||
}
|
||||
vol_changed = true;
|
||||
break;
|
||||
/* fast forward
|
||||
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
|
||||
|
@ -1155,6 +1128,23 @@ long gui_wps_show(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (vol_changed)
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
gui_wps[i].data->button_time_volume = current_tick;
|
||||
bool res = false;
|
||||
setvol();
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
if(update_onvol_change(&gui_wps[i]))
|
||||
res = true;
|
||||
}
|
||||
if (res) {
|
||||
restore = true;
|
||||
restoretimer = RESTORE_WPS_NEXT_SECOND;
|
||||
}
|
||||
}
|
||||
|
||||
if (wps_sync_data.do_full_update || update)
|
||||
{
|
||||
#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
|
||||
|
|
Loading…
Reference in a new issue