diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 965fe67..af28ebb 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -308,7 +308,7 @@ static int quickscreen_touchscreen_button(const struct viewport static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) { - int button; + int button, timeouts, i, j; struct viewport parent[NB_SCREENS]; struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; struct viewport vp_icons[NB_SCREENS]; @@ -337,12 +337,26 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente talk_qs_option(qs->items[QUICKSCREEN_LEFT], true); talk_qs_option(qs->items[QUICKSCREEN_BOTTOM], true); talk_qs_option(qs->items[QUICKSCREEN_RIGHT], true); + timeouts = 0; while (true) { button = get_action(CONTEXT_QUICKSCREEN, HZ/5); #ifdef HAVE_TOUCHSCREEN if (button == ACTION_TOUCHSCREEN) button = quickscreen_touchscreen_button(vps[SCREEN_MAIN]); #endif + if (global_settings.quickscreen_timeout > 0) + { + if (button == ACTION_NONE) + { + if (++timeouts > global_settings.quickscreen_timeout*5) + break; + } + else + { + timeouts = 0; + } + } + if (default_event_handler(button) == SYS_USB_CONNECTED) return(true); if (gui_quickscreen_do_button(qs, button)) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index cd575e9..1be8b4a 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13038,3 +13038,37 @@ *: "Start Sleep Timer" + + id: LANG_QUICKSCREEN_SETTINGS + desc: in the display menu + user: core + + *: "Quickscreen" + masd: none + + + *: "Quickscreen" + masd: none + + + *: "Quickscreen" + masd: none + + + + id: LANG_QUICKSCREEN_TIMEOUT + desc: in the quickscreen menu + user: core + + *: "Timeout" + masd: none + + + *: "Timeout" + masd: none + + + *: "Timeout" + masd: none + + diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 3e1443d..5b49b85 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -524,6 +524,12 @@ MAKE_MENU(touchscreen_menu, ID2P(LANG_TOUCHSCREEN_SETTINGS), NULL, Icon_NOICON, &touchscreen_menu_calibrate, &touchscreen_menu_reset_calibration); #endif +#ifdef HAVE_QUICKSCREEN +MENUITEM_SETTING(quickscreen_timeout, &global_settings.quickscreen_timeout, NULL); + +MAKE_MENU(quickscreen_menu, ID2P(LANG_QUICKSCREEN_SETTINGS), NULL, Icon_NOICON, &quickscreen_timeout); +#endif + MENUITEM_SETTING(codepage_setting, &global_settings.default_codepage, NULL); @@ -542,4 +548,7 @@ MAKE_MENU(display_menu, ID2P(LANG_DISPLAY), #ifdef HAVE_TOUCHSCREEN &touchscreen_menu, #endif +#ifdef HAVE_QUICKSCREEN + &quickscreen_menu, +#endif ); diff --git a/apps/settings.h b/apps/settings.h index fb562c9..df62e48 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -473,6 +473,7 @@ struct user_settings #ifdef HAVE_QUICKSCREEN int qs_items[QUICKSCREEN_ITEM_COUNT]; + int quickscreen_timeout; /* How long without action before exiting quickscreen */ #endif #if CONFIG_RTC diff --git a/apps/settings_list.c b/apps/settings_list.c index 6780c78..6c425c6 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1830,6 +1830,9 @@ const struct settings_list settings[] = { NULL, "qs bottom", qs_load_from_cfg, qs_write_to_cfg, qs_is_changed, qs_set_default), + INT_SETTING(0, quickscreen_timeout, LANG_QUICKSCREEN_TIMEOUT, 0, + "qs timeout", UNIT_SEC, 0, 30, 1, + formatter_unit_0_is_off, getlang_unit_0_is_off, NULL), OFFON_SETTING(0, shortcuts_replaces_qs, LANG_USE_SHORTCUTS_INSTEAD_OF_QS, false, "shortcuts instead of quickscreen", NULL), #endif