plugins: imageviewer: Hide info by default when loading file

Looks nicer, especially when the "View Album Art"
option is used.

Add delay to progress bar, so it only appears when
250ms have passed.

Change-Id: I183c839f1ab206385cd01327922933b544c4b78b
This commit is contained in:
Christian Soffke 2026-04-15 19:17:43 +02:00 committed by Solomon Peachy
parent fd7ae09e7a
commit f4dc4d89dc
34 changed files with 160 additions and 114 deletions

View file

@ -14597,11 +14597,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Скриване на информацията"

View file

@ -14601,11 +14601,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "隐藏信息"

View file

@ -14615,11 +14615,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Information verbergen"

View file

@ -14591,17 +14591,17 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Hide information"
*: "Hide Information"
</dest>
<voice>
*: "Hide information"
*: "Hide Information"
</voice>
</phrase>
<phrase>

View file

@ -14844,17 +14844,17 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Hide information"
*: "Hide Information"
</dest>
<voice>
*: "Hide information"
*: "Hide Information"
</voice>
</phrase>
<phrase>

View file

@ -14701,11 +14701,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ocultar información"

View file

@ -12290,11 +12290,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Masquer les informations"

View file

@ -14300,11 +14300,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Nascondere le informazioni"

View file

@ -14794,11 +14794,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "情報を隠す"

View file

@ -14609,11 +14609,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "정보 숨기기"

View file

@ -14706,11 +14706,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Paslēpt informāciju"

View file

@ -14709,11 +14709,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Információ elrejtése"

View file

@ -14712,11 +14712,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ascunde informațiile"

View file

@ -14360,11 +14360,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Verberg informatie"

View file

@ -14779,11 +14779,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Gøym informasjon"

View file

@ -14306,11 +14306,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ukryj informacje"

View file

@ -14817,11 +14817,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ocultar informações"

View file

@ -14712,11 +14712,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ascunde informațiile"

View file

@ -14328,11 +14328,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ничего не показывать"

View file

@ -14326,11 +14326,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Skryť info"

View file

@ -14705,11 +14705,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Сакриј информације"

View file

@ -14714,11 +14714,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Göm information"

View file

@ -14597,11 +14597,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Bilgileri gizle"

View file

@ -14706,11 +14706,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Приховати інформацію"

View file

@ -14615,11 +14615,11 @@
</voice>
</phrase>
<phrase>
id: LANG_HIDE_ALBUM_TITLE_NEW
desc: in the pictureflow settings
id: LANG_HIDE_INFO
desc: Hide Information
user: core
<source>
*: "Hide information"
*: "Hide Information"
</source>
<dest>
*: "Ẩn thông tin"

View file

@ -176,7 +176,8 @@ static int load_image(char *filename, struct image_info *info,
return PLUGIN_OUTOFMEM;
}
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_putsf(0, 1, "loading %dx%d%s",
@ -206,7 +207,8 @@ static int load_image(char *filename, struct image_info *info,
return PLUGIN_ERROR;
}
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
@ -225,7 +227,8 @@ static int load_image(char *filename, struct image_info *info,
buf_images = buf_root = buf + size;
buf_images_size = root_size = *buf_size - size;
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 2, "image %dx%d", bmp.width, bmp.height);
rb->lcd_update();

View file

@ -56,7 +56,7 @@ static void draw_image_rect(struct image_info *info,
#ifdef HAVE_LCD_COLOR
rb->lcd_bitmap_part((fb_data *)*pdisp, info->x + x, info->y + y,
STRIDE(SCREEN_MAIN, info->width, info->height),
STRIDE(SCREEN_MAIN, info->width, info->height),
x + MAX(0, (LCD_WIDTH-info->width)/2),
y + MAX(0, (LCD_HEIGHT-info->height)/2),
width, height);
@ -100,7 +100,7 @@ static int load_image(char *filename, struct image_info *info,
}
#endif
/* initialize decoder context struct, set buffer decoder is free
/* initialize decoder context struct, set buffer decoder is free
* to use.
*/
gif_decoder_init(p_decoder, memory, memory_size);
@ -111,7 +111,8 @@ static int load_image(char *filename, struct image_info *info,
if (!p_decoder->error)
{
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 2, "file: %s",
filename);
@ -137,7 +138,9 @@ static int load_image(char *filename, struct image_info *info,
gif_decoder_destroy_memory_pool(p_decoder);
if (!iv->running_slideshow && !p_decoder->error)
if (!iv->settings->hide_info &&
!iv->running_slideshow &&
!p_decoder->error)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
@ -215,7 +218,9 @@ static int get_image(struct image_info *info, int frame, int ds)
/* assign image buffer */
if (ds > 1)
{
if (!iv->running_slideshow && (info->frames_count == 1))
if (!iv->settings->hide_info &&
!iv->running_slideshow &&
(info->frames_count == 1))
{
rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
rb->lcd_update();

View file

@ -64,7 +64,8 @@ static struct imgview_settings settings =
COLOURMODE_COLOUR,
DITHER_NONE,
#endif
SS_DEFAULT_TIMEOUT
SS_DEFAULT_TIMEOUT,
true
};
static struct imgview_settings old_settings;
@ -78,6 +79,7 @@ static struct configdata config[] =
#endif
{ TYPE_INT, SS_MIN_TIMEOUT, SS_MAX_TIMEOUT,
{ .int_p = &settings.ss_timeout }, "Slideshow Time", NULL },
{ TYPE_BOOL, 0, 1, { .bool_p = &settings.hide_info }, "Hide Info", NULL },
};
static void cb_progress(int current, int total);
@ -244,12 +246,22 @@ static bool set_option_dithering(void)
return false;
}
static bool set_option_hide_info(void)
{
rb->set_bool(rb->str(LANG_HIDE_INFO), &settings.hide_info);
return false;
}
MENUITEM_FUNCTION(grayscale_item, 0, ID2P(LANG_GRAYSCALE),
set_option_grayscale, NULL, Icon_NOICON);
MENUITEM_FUNCTION(dithering_item, 0, ID2P(LANG_DITHERING),
set_option_dithering, NULL, Icon_NOICON);
MAKE_MENU(display_menu, "Display Options", NULL, Icon_NOICON,
&grayscale_item, &dithering_item);
MENUITEM_FUNCTION(hide_info_item, 0, ID2P(LANG_HIDE_INFO),
set_option_hide_info, NULL, Icon_NOICON);
MAKE_MENU(display_menu, ID2P(LANG_MENU_DISPLAY_OPTIONS), NULL, Icon_NOICON,
&grayscale_item,
&dithering_item,
&hide_info_item);
static void display_options(void)
{
@ -451,6 +463,10 @@ static void cb_progress(int current, int total)
{
/* do not yield or update the progress bar if we did so too recently */
long now = *rb->current_tick;
if (total == 0)
next_progress_tick = now + HZ/4; /* delay by 250ms initially */
if(!TIME_AFTER(now, next_progress_tick))
return;
@ -965,6 +981,7 @@ reload_decoder:
bool initial_frame = true;
do /* loop the image prepare and decoding when zoomed */
{
cb_progress(0, 0); /* delay showing progress bar*/
status = imgdec->get_image(info, frame, ds); /* decode or fetch from cache */
if (status == PLUGIN_ERROR)
{
@ -973,8 +990,9 @@ reload_decoder:
}
set_view(info, cx, cy);
if(!iv_api.running_slideshow && (info->frames_count == 1))
if(!settings.hide_info &&
!iv_api.running_slideshow &&
(info->frames_count == 1))
{
rb->lcd_putsf(0, 3, "showing %dx%d", info->width, info->height);
rb->lcd_update();

View file

@ -77,6 +77,7 @@ struct imgview_settings
int jpeg_dither_mode;
#endif
int ss_timeout;
bool hide_info;
};
/* structure passed to image decoder. */

View file

@ -150,7 +150,8 @@ static int load_image(char *filename, struct image_info *info,
return PLUGIN_OUTOFMEM;
}
if(!iv->running_slideshow)
if(!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_putsf(0, 1, "loading %d bytes", filesize);
@ -160,7 +161,8 @@ static int load_image(char *filename, struct image_info *info,
rb->read(fd, buf_jpeg, filesize);
rb->close(fd);
if(!iv->running_slideshow)
if(!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 2, "decoding markers");
rb->lcd_update();
@ -190,7 +192,8 @@ static int load_image(char *filename, struct image_info *info,
default_huff_tbl(p_jpg); /* use default */
build_lut(p_jpg); /* derive Huffman and other lookup-tables */
if(!iv->running_slideshow)
if(!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 2, "image %dx%d", p_jpg->x_size, p_jpg->y_size);
rb->lcd_update();
@ -263,7 +266,8 @@ static int get_image(struct image_info *info, int frame, int ds)
buf_images += size;
buf_images_size -= size;
if(!iv->running_slideshow)
if(!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 3, "decoding %d*%d", info->width, info->height);
rb->lcd_update();
@ -288,7 +292,8 @@ static int get_image(struct image_info *info, int frame, int ds)
}
time = *rb->current_tick - time;
if(!iv->running_slideshow)
if(!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */

View file

@ -117,7 +117,8 @@ static int load_image(char *filename, struct image_info *info,
POS(offset);
}
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_puts(0, 2, "decoding...");
@ -142,7 +143,8 @@ static int load_image(char *filename, struct image_info *info,
return PLUGIN_ERROR;
}
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 2, "image %dx%d", p_jpg->X, p_jpg->Y);
int w, h; /* used to center output */
@ -262,7 +264,7 @@ static int get_image(struct image_info *info, int frame, int ds)
c2 = (sumV + area/2) / area;
}
// ITU BT.601 full-range YUV-to-RGB integer approximation
// ITU BT.601 full-range YUV-to-RGB integer approximation
{
int y = (c0 << 5) + 16;
int u = c1 - 128;

View file

@ -62,7 +62,7 @@ static void draw_image_rect(struct image_info *info,
#ifdef HAVE_LCD_COLOR
rb->lcd_bitmap_part((fb_data *)*pdisp, info->x + x, info->y + y,
STRIDE(SCREEN_MAIN, info->width, info->height),
STRIDE(SCREEN_MAIN, info->width, info->height),
x + MAX(0, (LCD_WIDTH-info->width)/2),
y + MAX(0, (LCD_HEIGHT-info->height)/2),
width, height);
@ -82,8 +82,8 @@ static int img_mem(int ds)
#ifdef USEGSLIB
return (p_decoder->infoPng.width/ds) * (p_decoder->infoPng.height/ds);
#else
return (p_decoder->infoPng.width/ds) *
(p_decoder->infoPng.height/ds) *
return (p_decoder->infoPng.width/ds) *
(p_decoder->infoPng.height/ds) *
FB_DATA_SZ;
#endif
}
@ -126,7 +126,9 @@ static int load_image(char *filename, struct image_info *info,
DEBUGF("reading file '%s'\n", filename);
if (!iv->running_slideshow) {
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_update();
}
@ -136,7 +138,9 @@ static int load_image(char *filename, struct image_info *info,
rb->close(fd);
} else {
if (!iv->running_slideshow) {
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 1, "loading %zu bytes", file_size);
rb->lcd_update();
}
@ -146,7 +150,9 @@ static int load_image(char *filename, struct image_info *info,
rb->read(fd, image, file_size);
rb->close(fd);
if (!iv->running_slideshow) {
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 2, "decoding image");
rb->lcd_update();
}
@ -171,7 +177,8 @@ static int load_image(char *filename, struct image_info *info,
if (!p_decoder->error) {
if (!iv->running_slideshow) {
if (!iv->settings->hide_info &&
!iv->running_slideshow) {
rb->lcd_putsf(0, 2, "image %dx%d",
p_decoder->infoPng.width,
p_decoder->infoPng.height);
@ -194,7 +201,8 @@ static int load_image(char *filename, struct image_info *info,
}
}
if (!iv->running_slideshow && !p_decoder->error)
if (!iv->settings->hide_info &&
!iv->running_slideshow && !p_decoder->error)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
@ -253,7 +261,8 @@ static int get_image(struct image_info *info, int frame, int ds)
/* assign image buffer */
if (ds > 1) {
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
rb->lcd_update();

View file

@ -51,7 +51,7 @@ static void draw_image_rect(struct image_info *info,
#ifdef HAVE_LCD_COLOR
rb->lcd_bitmap_part((fb_data *)*pdisp, info->x + x, info->y + y,
STRIDE(SCREEN_MAIN, info->width, info->height),
STRIDE(SCREEN_MAIN, info->width, info->height),
x + MAX(0, (LCD_WIDTH-info->width)/2),
y + MAX(0, (LCD_HEIGHT-info->height)/2),
width, height);
@ -111,7 +111,8 @@ static int load_image(char *filename, struct image_info *info,
}
DEBUGF("reading file '%s'\n", filename);
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_putsf(0, 1, "loading %zu bytes", filesize);
@ -140,7 +141,8 @@ static int load_image(char *filename, struct image_info *info,
return rc;
}
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
@ -177,7 +179,8 @@ static int get_image(struct image_info *info, int frame, int ds)
/* assign image buffer */
if (ds > 1)
{
if (!iv->running_slideshow)
if (!iv->settings->hide_info &&
!iv->running_slideshow)
{
rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
rb->lcd_update();

View file

@ -3619,7 +3619,7 @@ static int settings_menu(void)
ID2P(LANG_DISPLAY));
static const struct opt_items album_name_options[] = {
{ STR(LANG_HIDE_ALBUM_TITLE_NEW) },
{ STR(LANG_HIDE_INFO) },
{ STR(LANG_SHOW_AT_THE_BOTTOM_NEW) },
{ STR(LANG_SHOW_AT_THE_TOP_NEW) },
{ STR(LANG_SHOW_ALL_AT_THE_TOP) },