Minor confirm prompt adjustments

* Rename LANG_RESET_ASK to LANG_ARE_YOU_SURE,
  so that it matches the actual language string
  (translations remain valid), and can be repurposed
  for generic confirmation prompts, where the
  first line says "Are you sure?", and the second
  line reiterates the selected action

* Add "Reset Settings" as second line to the prompt
  shown before resetting settings, instead of just
  asking "Are you sure?"

* Make Shuffle prompt consistent between WPS and
  Playlist Viewer, and ask whether user is sure they
  want to Shuffle instead of warning them that the
  current playlist will be erased, which was a bit
  misleading

* Explicitly say "Cancelled" when user answers NO to
  erasing the current playlist or to overwriting a file.
  Improves consistency with other prompts that are
  displayed for potentially destructive actions, e.g.
  before items are deleted, renamed, saved, or reset.

* PictureFlow: Prompt before rebuilding/updating cache

Change-Id: Id8ae36db7187315eb1a374701307e6ab4dcdbd1d
This commit is contained in:
Christian Soffke 2025-05-25 03:23:49 +02:00
parent 57f3f290c9
commit f3d127f372
55 changed files with 169 additions and 114 deletions

View file

@ -510,7 +510,9 @@ int copy_move_fileobject(const char *src_path, const char *dst_path, unsigned in
int rc;
if (file_exists(dst.path)) {
/* If user chooses not to overwrite, cancel */
if (!yesno_pop(ID2P(LANG_REALLY_OVERWRITE))) {
if (!yesno_pop(ID2P(LANG_REALLY_OVERWRITE)))
{
splash(HZ, ID2P(LANG_CANCEL));
return FORC_NOOVERWRT;
}

View file

@ -368,14 +368,35 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
main_message, yes_message, no_message);
}
/* Function to manipulate all yesno dialogues.
This function needs the prompt text as an argument. */
bool yesno_pop(const char* text)
static bool yesno_pop_lines(const char *lines[], int line_cnt)
{
const char *lines[]={text};
const struct text_message message={lines, 1};
const struct text_message message={lines, line_cnt};
bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES);
FOR_NB_SCREENS(i)
screens[i].clear_viewport();
return ret;
}
/* YES/NO dialog, uses text parameter as prompt */
bool yesno_pop(const char* text)
{
const char *lines[]= {text};
return yesno_pop_lines(lines, 1);
}
/* YES/NO dialog, asks "Are you sure?", displays
text parameter on second line.
Says "Cancelled" if answered negatively.
*/
bool yesno_pop_confirm(const char* text)
{
bool confirmed;
const char *lines[] = {ID2P(LANG_ARE_YOU_SURE), text};
confirmed = yesno_pop_lines(lines, 2);
if (!confirmed)
splash(HZ, ID2P(LANG_CANCEL));
return confirmed;
}

View file

@ -57,5 +57,6 @@ extern enum yesno_res gui_syncyesno_run_w_tmo(
const struct text_message * no_message);
bool yesno_pop(const char* text);
bool yesno_pop_confirm(const char* text);
#endif /* _GUI_YESNO_H_ */

View file

@ -130,14 +130,35 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
#endif
/* Function to manipulate all yesno dialogues.
This function needs the output text as an argument. */
bool yesno_pop(const char* text)
static bool yesno_pop_lines(const char *lines[], int line_cnt)
{
const char *lines[]={text};
const struct text_message message={lines, 1};
const struct text_message message={lines, line_cnt};
bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES);
FOR_NB_SCREENS(i)
screens[i].clear_viewport();
return ret;
}
/* YES/NO dialog, uses text parameter as prompt */
bool yesno_pop(const char* text)
{
const char *lines[]= {text};
return yesno_pop_lines(lines, 1);
}
/* YES/NO dialog, asks "Are you sure?", displays
text parameter on second line.
Says "Cancelled" if answered negatively.
*/
bool yesno_pop_confirm(const char* text)
{
bool confirmed;
const char *lines[] = {ID2P(LANG_ARE_YOU_SURE), text};
confirmed = yesno_pop_lines(lines, 2);
if (!confirmed)
splash(HZ, ID2P(LANG_CANCEL));
return confirmed;
}

View file

@ -3194,8 +3194,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -227,8 +227,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -231,8 +231,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -229,8 +229,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -8757,8 +8757,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -8944,8 +8944,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -231,8 +231,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9785,8 +9785,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -248,8 +248,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -225,8 +225,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -310,8 +310,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9156,8 +9156,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9675,8 +9675,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -258,8 +258,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -11934,8 +11934,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -231,8 +231,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -233,8 +233,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -227,8 +227,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -229,8 +229,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -234,8 +234,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -242,8 +242,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -228,8 +228,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -298,8 +298,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -228,8 +228,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9004,8 +9004,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -8965,8 +8965,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9779,8 +9779,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -10042,8 +10042,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -235,8 +235,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -230,8 +230,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9203,8 +9203,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9004,8 +9004,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9103,8 +9103,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -227,8 +227,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -11553,8 +11553,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -241,8 +241,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -234,8 +234,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -227,8 +227,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -228,8 +228,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -217,8 +217,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -228,8 +228,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -9651,8 +9651,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -232,8 +232,8 @@
</voice>
</phrase>
<phrase>
id: LANG_RESET_ASK
desc: confirm to reset settings
id: LANG_ARE_YOU_SURE
desc: confirm action
user: core
<source>
*: "Are You Sure?"

View file

@ -57,7 +57,7 @@ static int show_info(void);
static int reset_settings(void)
{
static const char *lines[]={ID2P(LANG_RESET_ASK)};
static const char *lines[]={ID2P(LANG_ARE_YOU_SURE), ID2P(LANG_RESET)};
static const char *yes_lines[]={
ID2P(LANG_SETTINGS),
ID2P(LANG_RESET_DONE_CLEAR)
@ -66,7 +66,7 @@ static int reset_settings(void)
ID2P(LANG_SETTINGS),
ID2P(LANG_CANCEL)
};
static const struct text_message message={lines, 1};
static const struct text_message message={lines, 2};
static const struct text_message yes_message={yes_lines, 2};
static const struct text_message no_message={no_lines, 2};

View file

@ -196,7 +196,13 @@ bool warn_on_pl_erase(void)
{ID2P(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)};
static const struct text_message message={lines, 1};
return (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES);
if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
return true;
else
{
splash(HZ, ID2P(LANG_CANCEL));
return false;
}
}
else
return true;

View file

@ -183,7 +183,7 @@ static int bookmark_menu_callback(int action,
/* CONTEXT_WPS playlist options */
static bool shuffle_playlist(void)
{
if (!warn_on_pl_erase())
if (!yesno_pop_confirm(ID2P(LANG_SHUFFLE)))
return false;
playlist_sort(NULL, true);
playlist_randomise(NULL, current_tick, true);

View file

@ -774,6 +774,8 @@ static enum pv_context_result context_menu(int index)
return show_track_info(current_track);
case 5:
/* shuffle */
if (!yesno_pop_confirm(ID2P(LANG_SHUFFLE)))
return PV_CONTEXT_UNCHANGED;
playlist_sort(viewer.playlist, !viewer.playlist);
playlist_randomise(viewer.playlist, current_tick, !viewer.playlist);
viewer.selected_track = 0;

View file

@ -844,6 +844,7 @@ static const struct plugin_api rockbox_api = {
the API gets incompatible */
add_playbacklog,
&device_battery_tables,
yesno_pop_confirm,
};
static int plugin_buffer_handle;

View file

@ -993,6 +993,7 @@ struct plugin_api {
the API gets incompatible */
void (*add_playbacklog)(struct mp3entry *id3);
struct battery_tables_t *device_battery_tables;
bool (*yesno_pop_confirm)(const char* text);
};
/* plugin header */

View file

@ -234,20 +234,11 @@ enum plugin_status plugin_start(const void* parameter)
rb->gui_synclist_select_item(&list, cur_sel + 1); /* speaks */
changed = true;
break;
case 2:;
static const char *lines[] =
{ID2P(LANG_RESET_ASK), ID2P(LANG_LOAD_DEFAULT_CONFIGURATION)};
static const struct text_message message={lines, 2};
switch(rb->gui_syncyesno_run(&message, NULL, NULL))
case 2:
if (rb->yesno_pop_confirm(ID2P(LANG_LOAD_DEFAULT_CONFIGURATION)))
{
case YESNO_YES:
rb->root_menu_set_default(&rb->global_settings->root_menu_customized, NULL);
load_from_cfg();
break;
default:
rb->splash(HZ, ID2P(LANG_CANCEL));
break;
rb->root_menu_set_default(&rb->global_settings->root_menu_customized, NULL);
load_from_cfg();
}
/* fall-through */
default:

View file

@ -3590,6 +3590,11 @@ static int display_settings_menu(void)
rb->set_bool(rb->str(LANG_RESIZE_COVERS), &pf_cfg.resize);
if (old_val == pf_cfg.resize) /* changed? */
break;
else if (!rb->yesno_pop_confirm(ID2P(LANG_RESIZE_COVERS)))
{
pf_cfg.resize = old_val;
break;
}
pf_cfg.update_albumart = false;
pf_cfg.cache_version = CACHE_REBUILD;
@ -3766,6 +3771,8 @@ static int main_menu(void)
break;
#endif
case PF_REBUILD_CACHE:
if (!rb->yesno_pop_confirm(ID2P(LANG_REBUILD_CACHE)))
break;
pf_cfg.update_albumart = false;
pf_cfg.cache_version = CACHE_REBUILD;
rb->remove(EMPTY_SLIDE);
@ -3773,6 +3780,8 @@ static int main_menu(void)
CONFIG_NUM_ITEMS, CONFIG_VERSION);
return -3; /* re-init */
case PF_UPDATE_CACHE:
if (!rb->yesno_pop_confirm(ID2P(LANG_UPDATE_CACHE)))
break;
pf_cfg.update_albumart = true;
pf_cfg.cache_version = CACHE_REBUILD;
rb->remove(EMPTY_SLIDE);