mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 07:22:57 +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,20 +698,31 @@ void CFrameBuffer::setIconBasePath(const std::string & iconPath)
|
|||||||
|
|
||||||
std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type)
|
std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type)
|
||||||
{
|
{
|
||||||
|
std::vector<std::string> filetypes = { ".svg", ".png", ".jpg" };
|
||||||
std::string path, filetype = "";
|
std::string path, filetype = "";
|
||||||
if (!file_type.empty())
|
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 "/" + g_settings.theme_name + "/icons",
|
{
|
||||||
ICONSDIR_VAR,
|
THEMESDIR_VAR "/" + g_settings.theme_name + "/icons",
|
||||||
iconBasePath
|
THEMESDIR "/" + g_settings.theme_name + "/icons",
|
||||||
|
ICONSDIR_VAR,
|
||||||
|
iconBasePath
|
||||||
};
|
};
|
||||||
|
|
||||||
for(int i=0; i<4 ; i++){
|
for(int t=0; t<filetypes.size(); t++)
|
||||||
path = std::string(dir[i]) + "/" + icon_name + filetype;
|
{
|
||||||
if (access(path.c_str(), F_OK) == 0){
|
for(int i=0; i<dir.size(); i++)
|
||||||
return path;
|
{
|
||||||
|
path = std::string(dir[i]) + "/" + icon_name + filetypes[t];
|
||||||
|
if (access(path.c_str(), F_OK) == 0)
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +846,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in
|
|||||||
/* we cache and check original name */
|
/* we cache and check original name */
|
||||||
it = icon_cache.find(filename);
|
it = icon_cache.find(filename);
|
||||||
if(it == icon_cache.end()) {
|
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);
|
//printf("CFrameBuffer::paintIcon: check for %s\n", newname.c_str());fflush(stdout);
|
||||||
|
|
||||||
data = g_PicViewer->getIcon(newname, &width, &height);
|
data = g_PicViewer->getIcon(newname, &width, &height);
|
||||||
|
Reference in New Issue
Block a user