From 6bc4a63f28bf75b2b80b5d835c86d962f9a42f55 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 29 Oct 2021 19:33:33 +0200 Subject: [PATCH] supplemental to 04a8e71a22c9aff611ae321f6b4f1c06fc69f53c Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8f1d3476827a6deab303b8cdd88150acdd297a68 Author: TangoCash Date: 2021-10-29 (Fri, 29 Oct 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 16 ++++++++++++---- src/driver/fb_generic.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index be5cf4b3e..4f86016e6 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -700,6 +700,14 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty { std::vector filetypes = { ".svg", ".png", ".jpg" }; std::string path, filetype = ""; + + std::string::size_type pos = icon_name.find_last_of("."); + if (pos != std::string::npos && file_type.empty()) + if (std::find(filetypes.begin(), filetypes.end(), icon_name.substr(pos)) != filetypes.end()) + { + icon_name = icon_name.substr(0,pos); + file_type = icon_name.substr(pos+1); + } if (!file_type.empty()) { filetypes.clear(); @@ -714,9 +722,9 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty iconBasePath }; - for(int t=0; tgetIcon(newname, &width, &height); @@ -1575,7 +1583,7 @@ void CFrameBuffer::Clear() bool CFrameBuffer::showFrame(const std::string & filename, int fallback_mode) { - std::string picture = getIconPath(filename, ""); + std::string picture = getIconPath(filename); bool ret = false; if (access(picture.c_str(), F_OK) == 0 && !(fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED)) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index c6e383fc2..cd93867ae 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -233,7 +233,7 @@ class CFrameBuffer : public sigc::trackable void setIconBasePath(const std::string & iconPath); std::string getIconBasePath(){return iconBasePath;}; - std::string getIconPath(std::string icon_name, std::string file_type = "png"); + std::string getIconPath(std::string icon_name, std::string file_type = ""); void getIconSize(const char * const filename, int* width, int *height); /* h is the height of the target "window", if != 0 the icon gets centered in that window */