mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
rework framebuffer getIconPath
Origin commit data
------------------
Branch: ni/coolstream
Commit: 0a68442539
Author: TangoCash <eric@loxat.de>
Date: 2021-10-28 (Thu, 28 Oct 2021)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -698,22 +698,33 @@ void CFrameBuffer::setIconBasePath(const std::string & iconPath)
|
||||
|
||||
std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type)
|
||||
{
|
||||
std::vector<std::string> 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",
|
||||
std::vector<std::string> 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){
|
||||
for(int t=0; t<filetypes.size(); t++)
|
||||
{
|
||||
for(int i=0; i<dir.size(); i++)
|
||||
{
|
||||
path = std::string(dir[i]) + "/" + icon_name + filetypes[t];
|
||||
if (access(path.c_str(), F_OK) == 0)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (icon_name.find("/", 0) != std::string::npos)
|
||||
path = icon_name;
|
||||
@@ -835,7 +846,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in
|
||||
/* we cache and check original name */
|
||||
it = icon_cache.find(filename);
|
||||
if(it == icon_cache.end()) {
|
||||
std::string newname = getIconPath(filename);
|
||||
std::string newname = getIconPath(filename,"");
|
||||
//printf("CFrameBuffer::paintIcon: check for %s\n", newname.c_str());fflush(stdout);
|
||||
|
||||
data = g_PicViewer->getIcon(newname, &width, &height);
|
||||
|
Reference in New Issue
Block a user