From 04a8e71a22c9aff611ae321f6b4f1c06fc69f53c Mon Sep 17 00:00:00 2001 From: TangoCash Date: Thu, 28 Oct 2021 19:32:23 +0200 Subject: [PATCH] rework framebuffer getIconPath Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0a684425396cb294d7779af1fa54570dea68d987 Author: TangoCash Date: 2021-10-28 (Thu, 28 Oct 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 32192f8cd..be5cf4b3e 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -698,20 +698,31 @@ void CFrameBuffer::setIconBasePath(const std::string & iconPath) std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type) { + std::vector filetypes = { ".svg", ".png", ".jpg" }; std::string path, filetype = ""; if (!file_type.empty()) - filetype = "." + file_type; + { + filetypes.clear(); + filetypes.push_back("." + file_type); + } - std::string dir[] = { THEMESDIR_VAR "/" + g_settings.theme_name + "/icons", - THEMESDIR "/" + g_settings.theme_name + "/icons", - ICONSDIR_VAR, - iconBasePath + std::vector dir = + { + THEMESDIR_VAR "/" + g_settings.theme_name + "/icons", + THEMESDIR "/" + g_settings.theme_name + "/icons", + ICONSDIR_VAR, + iconBasePath }; - for(int i=0; i<4 ; i++){ - path = std::string(dir[i]) + "/" + icon_name + filetype; - if (access(path.c_str(), F_OK) == 0){ - return path; + for(int t=0; tgetIcon(newname, &width, &height);