1
0
Fork 0
forked from len0rd/rockbox

Quickscreen: Hande case where not all quick settings are defines

This happens in Archos Recorder, see quick_screen_f3(), which caused crash
(FS#11037), due to top item not defined.
The commit explicitly sets items[QUICKSCREEN_TOP] to NULL, and also draws an
arrow only if the item is defined.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24871 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2010-02-23 21:30:16 +00:00
parent 614fb41ddb
commit 9d268d796c

View file

@ -201,17 +201,26 @@ static void gui_quickscreen_draw(const struct gui_quickscreen *qs,
/* draw the icons */ /* draw the icons */
display->set_viewport(vp_icons); display->set_viewport(vp_icons);
display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], if (qs->items[QUICKSCREEN_TOP] != NULL)
(vp_icons->width/2) - 4, 0, 7, 8); {
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
vp_icons->width - 8, (vp_icons->width/2) - 4, 0, 7, 8);
(vp_icons->height/2) - 4, 7, 8); }
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 0, if (qs->items[QUICKSCREEN_RIGHT] != NULL)
(vp_icons->height/2) - 4, 7, 8); {
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], vp_icons->width - 8, (vp_icons->height/2) - 4, 7, 8);
(vp_icons->width/2) - 4, }
vp_icons->height - 8, 7, 8); if (qs->items[QUICKSCREEN_LEFT] != NULL)
{
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
0, (vp_icons->height/2) - 4, 7, 8);
}
if (qs->items[QUICKSCREEN_BOTTOM] != NULL)
{
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
(vp_icons->width/2) - 4, vp_icons->height - 8, 7, 8);
}
display->set_viewport(parent); display->set_viewport(parent);
display->update_viewport(); display->update_viewport();
@ -220,12 +229,13 @@ static void gui_quickscreen_draw(const struct gui_quickscreen *qs,
static void talk_qs_option(const struct settings_list *opt, bool enqueue) static void talk_qs_option(const struct settings_list *opt, bool enqueue)
{ {
if (global_settings.talk_menu) { if (!global_settings.talk_menu || !opt)
if (!enqueue) return;
talk_shutup();
talk_id(opt->lang_id, true); if (!enqueue)
option_talk_value(opt, option_value_as_int(opt), true); talk_shutup();
} talk_id(opt->lang_id, true);
option_talk_value(opt, option_value_as_int(opt), true);
} }
/* /*
@ -409,6 +419,7 @@ bool quick_screen_quick(int button_enter)
bool quick_screen_f3(int button_enter) bool quick_screen_f3(int button_enter)
{ {
struct gui_quickscreen qs; struct gui_quickscreen qs;
qs.items[QUICKSCREEN_TOP] = NULL;
qs.items[QUICKSCREEN_LEFT] = qs.items[QUICKSCREEN_LEFT] =
find_setting(&global_settings.scrollbar, NULL); find_setting(&global_settings.scrollbar, NULL);
qs.items[QUICKSCREEN_RIGHT] = qs.items[QUICKSCREEN_RIGHT] =