summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorMartin Prochnow <nordlicht@martins-kabuff.de>2008-03-22 16:45:02 +0100
committerAndreas Mair <andreas@vdr-developer.org>2008-03-22 16:45:02 +0100
commit23f4f2114e7d48bb4bbe5e50aa6ddce0f1c21bd2 (patch)
tree65ec19823baa6f900495290b9d0e8497f12115ee /tools.c
parent3b617b561f901e8f7a5f8991bc1d51e1ee800142 (diff)
downloadvdr-plugin-extrecmenu-1.2-test1.tar.gz
vdr-plugin-extrecmenu-1.2-test1.tar.bz2
Version 1.2-test1v1.2-test1
- added italian translation; thanks to Diego - added support for GraphTFT-plugin; thanks to Jörg Wendel for the patch - added support for true type fonts and UTF-8; thanks to Andreas Mair for the true type font and the patch - removed patch font routine because it is useless now - added true type font containing the needed icons - changed i18n support to gettext
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/tools.c b/tools.c
index a2aa4bf..268ee84 100644
--- a/tools.c
+++ b/tools.c
@@ -37,12 +37,12 @@ string myStrEscape(string S,const char *Chars)
return S;
}
-string myStrReplace(string S,char C1,char C2)
+string myStrReplace(string S,char C1,const char* C2)
{
string::size_type i=0;
while((i=S.find(C1,i))!=string::npos)
{
- S.replace(i,1,1,C2);
+ S.replace(i,1,C2);
i++;
}
return S;
@@ -69,23 +69,23 @@ void SortList::ReadConfigFile()
void SortList::WriteConfigFile()
{
- string configfile(cPlugin::ConfigDirectory());
- configfile+=CONFIGFILE;
+ string configfile(cPlugin::ConfigDirectory());
+ configfile+=CONFIGFILE;
- ofstream outfile(configfile.c_str());
+ ofstream outfile(configfile.c_str());
- for(SortListItem *item=First();item;item=Next(item))
- outfile << item->Path() << endl;
+ for(SortListItem *item=First();item;item=Next(item))
+ outfile << item->Path() << endl;
}
bool SortList::Find(string Path)
{
- for(SortListItem *item=First();item;item=Next(item))
- {
- if(item->Path()==Path)
- return true;
- }
- return false;
+ for(SortListItem *item=First();item;item=Next(item))
+ {
+ if(item->Path()==Path)
+ return true;
+ }
+ return false;
}
// --- MoveRename -------------------------------------------------------------
@@ -683,3 +683,26 @@ bool WorkerThread::Move(string From,string To)
return false;
}
+// --- Icons ------------------------------------------------------------------
+bool Icons::IsUTF8=false;
+
+void Icons::InitCharSet()
+{
+ // Taken from VDR's vdr.c
+ char *CodeSet=NULL;
+ if(setlocale(LC_CTYPE, ""))
+ CodeSet=nl_langinfo(CODESET);
+ else
+ {
+ char *LangEnv=getenv("LANG"); // last resort in case locale stuff isn't installed
+ if(LangEnv)
+ {
+ CodeSet=strchr(LangEnv,'.');
+ if(CodeSet)
+ CodeSet++; // skip the dot
+ }
+ }
+
+ if(CodeSet && strcasestr(CodeSet,"UTF-8")!=0)
+ IsUTF8=true;
+}