mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
Added support for SVG channellogos
This commit is contained in:
parent
7762e99dd0
commit
234c855990
1
config.c
1
config.c
@ -7,7 +7,6 @@ cDesignerConfig::cDesignerConfig() {
|
|||||||
skinPathSet = false;
|
skinPathSet = false;
|
||||||
logoPathSet = false;
|
logoPathSet = false;
|
||||||
//Common
|
//Common
|
||||||
logoExtension = "png";
|
|
||||||
numLogosPerSizeInitial = 30;
|
numLogosPerSizeInitial = 30;
|
||||||
limitLogoCache = 1;
|
limitLogoCache = 1;
|
||||||
numLogosMax = 200;
|
numLogosMax = 200;
|
||||||
|
1
config.h
1
config.h
@ -43,7 +43,6 @@ public:
|
|||||||
void SetOSDFonts(void);
|
void SetOSDFonts(void);
|
||||||
bool OsdFontsChanged(void);
|
bool OsdFontsChanged(void);
|
||||||
cString GetSkinRessourcePath(void);
|
cString GetSkinRessourcePath(void);
|
||||||
cString logoExtension;
|
|
||||||
cString skinPath;
|
cString skinPath;
|
||||||
cString logoPath;
|
cString logoPath;
|
||||||
cString epgImagePath;
|
cString epgImagePath;
|
||||||
|
@ -140,27 +140,18 @@ bool cImageCache::LogoExists(string channelID) {
|
|||||||
if (!channel)
|
if (!channel)
|
||||||
return false;
|
return false;
|
||||||
string logoLower = StrToLowerCase(channel->Name());
|
string logoLower = StrToLowerCase(channel->Name());
|
||||||
string logoExt = *config.logoExtension;
|
|
||||||
bool logoExists = FileExists(logoPath.c_str(), logoLower, logoExt);
|
return (FileExists(logoPath.c_str(), logoLower, "svg") ||
|
||||||
if (logoExists) {
|
FileExists(logoPath.c_str(), logoLower, "png") ||
|
||||||
return true;
|
FileExists(logoPath.c_str(), channelID, "svg") ||
|
||||||
}
|
FileExists(logoPath.c_str(), channelID, "png"));
|
||||||
logoExists = FileExists(logoPath.c_str(), channelID, logoExt);
|
|
||||||
if (logoExists) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cImageCache::SeparatorLogoExists(string name) {
|
bool cImageCache::SeparatorLogoExists(string name) {
|
||||||
string separatorPath = *cString::sprintf("%sseparatorlogos/", logoPath.c_str());
|
string separatorPath = *cString::sprintf("%sseparatorlogos/", logoPath.c_str());
|
||||||
string nameLower = StrToLowerCase(name.c_str());
|
string nameLower = StrToLowerCase(name.c_str());
|
||||||
string logoExt = *config.logoExtension;
|
|
||||||
bool logoExists = FileExists(separatorPath, nameLower, logoExt);
|
return FileExists(separatorPath, nameLower, "png");
|
||||||
if (logoExists) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cImageCache::CacheIcon(eImageType type, string name, int width, int height) {
|
void cImageCache::CacheIcon(eImageType type, string name, int width, int height) {
|
||||||
@ -329,21 +320,23 @@ bool cImageCache::LoadLogo(const cChannel *channel) {
|
|||||||
return false;
|
return false;
|
||||||
string channelID = StrToLowerCase(*(channel->GetChannelID().ToString()));
|
string channelID = StrToLowerCase(*(channel->GetChannelID().ToString()));
|
||||||
string logoLower = StrToLowerCase(channel->Name());
|
string logoLower = StrToLowerCase(channel->Name());
|
||||||
bool success = false;
|
|
||||||
|
|
||||||
if (FileExists(logoPath.c_str(), channelID.c_str(), *config.logoExtension))
|
if (FileExists(logoPath.c_str(), channelID.c_str(), "svg"))
|
||||||
return LoadImage(logoPath.c_str(), channelID.c_str(), *config.logoExtension);
|
return LoadImage(logoPath.c_str(), channelID.c_str(), "svg");
|
||||||
|
if (FileExists(logoPath.c_str(), channelID.c_str(), "png"))
|
||||||
if (FileExists(logoPath.c_str(), logoLower.c_str(), *config.logoExtension))
|
return LoadImage(logoPath.c_str(), channelID.c_str(), "png");
|
||||||
return LoadImage(logoPath.c_str(), logoLower.c_str(), *config.logoExtension);
|
if (FileExists(logoPath.c_str(), logoLower.c_str(), "svg"))
|
||||||
|
return LoadImage(logoPath.c_str(), logoLower.c_str(), "svg");
|
||||||
|
if (FileExists(logoPath.c_str(), logoLower.c_str(), "png"))
|
||||||
|
return LoadImage(logoPath.c_str(), logoLower.c_str(), "png");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cImageCache::LoadSeparatorLogo(string name) {
|
bool cImageCache::LoadSeparatorLogo(string name) {
|
||||||
cString separatorPath = cString::sprintf("%sseparatorlogos/", logoPath.c_str());
|
string separatorPath = *cString::sprintf("%sseparatorlogos/", logoPath.c_str());
|
||||||
string nameLower = StrToLowerCase(name.c_str());
|
string nameLower = StrToLowerCase(name.c_str());
|
||||||
return LoadImage(*separatorPath, nameLower.c_str(), *config.logoExtension);
|
return LoadImage(separatorPath, nameLower.c_str(), "png");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cImageCache::LoadSkinpart(string name) {
|
bool cImageCache::LoadSkinpart(string name) {
|
||||||
|
@ -101,7 +101,6 @@ void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) {
|
|||||||
else
|
else
|
||||||
logoPath = config.logoPath;
|
logoPath = config.logoPath;
|
||||||
|
|
||||||
cString logoExt = config.logoExtension;
|
|
||||||
DIR *folder = NULL;
|
DIR *folder = NULL;
|
||||||
struct dirent *file;
|
struct dirent *file;
|
||||||
folder = opendir(logoPath);
|
folder = opendir(logoPath);
|
||||||
@ -109,7 +108,8 @@ void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
while ( (file = readdir(folder)) ) {
|
while ( (file = readdir(folder)) ) {
|
||||||
if (endswith(file->d_name, *logoExt)) {
|
if (endswith(file->d_name, ".png") ||
|
||||||
|
endswith(file->d_name, ".svg")) {
|
||||||
std::stringstream filePath;
|
std::stringstream filePath;
|
||||||
filePath << *logoPath << file->d_name;
|
filePath << *logoPath << file->d_name;
|
||||||
if (LoadImage(filePath.str().c_str())) {
|
if (LoadImage(filePath.str().c_str())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user