1
0
Fork 0
forked from len0rd/rockbox

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:
Thomas Martitz 2009-10-31 14:55:13 +00:00
parent 48960bfe29
commit 28aef1f96a

View file

@ -707,6 +707,7 @@ long gui_wps_show(void)
bool exit = false; bool exit = false;
bool bookmark = false; bool bookmark = false;
bool update = false; bool update = false;
bool vol_changed = false;
int i; int i;
long last_left = 0, last_right = 0; long last_left = 0, last_right = 0;
@ -867,40 +868,12 @@ long gui_wps_show(void)
break; break;
case ACTION_WPS_VOLUP: case ACTION_WPS_VOLUP:
{
FOR_NB_SCREENS(i)
gui_wps[i].data->button_time_volume = current_tick;
global_settings.volume++; global_settings.volume++;
bool res = false; vol_changed = true;
setvol(); break;
FOR_NB_SCREENS(i)
{
if(update_onvol_change(&gui_wps[i]))
res = true;
}
if (res) {
restore = true;
restoretimer = RESTORE_WPS_NEXT_SECOND;
}
}
break;
case ACTION_WPS_VOLDOWN: case ACTION_WPS_VOLDOWN:
{
FOR_NB_SCREENS(i)
gui_wps[i].data->button_time_volume = current_tick;
global_settings.volume--; global_settings.volume--;
setvol(); vol_changed = true;
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;
}
}
break; break;
/* fast forward /* fast forward
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
@ -1155,6 +1128,23 @@ long gui_wps_show(void)
break; 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 (wps_sync_data.do_full_update || update)
{ {
#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)