Beispiel #1
0
const char *cTheme::Description(void)
{
  char *s = descriptions[I18nCurrentLanguage()];
  if (!s)
     s = descriptions[0];
  return s ? s : name;
}
Beispiel #2
0
bool cText2SkinPlugin::Start(void) {
    Text2SkinStatus.SetLanguage(I18nCurrentLanguage());
    cText2SkinBitmap::Init();
    cText2SkinLoader::Start();
    return true;
}
Beispiel #3
0
cInstallPrimLang::cInstallPrimLang() :cInstallSubMenu(tr("Handling"))
{
    for (int k = 0; k < 256; k++)
        city_values[k] = NULL;

    // Language
    osdLanguageIndex = I18nCurrentLanguage();

    askTimeZone = true;
#ifdef RBMINI
    cPlugin *p = cPluginManager::GetPlugin("avahi");
    if (p)
    {
        std::vector < ReelBox_t > ReelBoxes;
        p->Service("Avahi ReelBox-List", &ReelBoxes);

        if (ReelBoxes.size() > 0)
        {
            // save changes in sysconfig variable in vdr into sysconfig file
            cSysConfig_vdr::GetInstance().Save();

            std::string cmd;
            // get the timezone from an AVG
            if (strlen(Setup.NetServerIP))
            {                   // there was already one configured, let's take this one...
                // TB: but only if it's available
                bool serverAvailable = false;
                for (unsigned int i = 0; i < ReelBoxes.size(); i++)
                    if (strcmp(Setup.NetServerIP, ReelBoxes.at(i).Ip.c_str()) == 0)
                        serverAvailable = true;
                if (serverAvailable)
                    cmd = std::string("getConfigsFromAVGServer.sh ") + Setup.NetServerIP + std::string(" sysconfig ; ");
                else
                    cmd = std::string("getConfigsFromAVGServer.sh ") + ReelBoxes.at(0).Ip + std::string(" sysconfig ; ");
            }
            else
                cmd = std::string("getConfigsFromAVGServer.sh ") + ReelBoxes.at(0).Ip + std::string(" sysconfig ; ");
            SystemExec(cmd.c_str());    // changes /etc/default/sysconfig

            cSysConfig_vdr::GetInstance().Load(SYSCONFIGFNAME); // load the changes in file into vdr
            dsyslog("(%s:%d) ... done loading sysconfig.", __FILE__, __LINE__);
        }

        // one or more reelbox avantgarde donot ask for TimeZone
        // it is got from the first avantgarde in the list
        askTimeZone = (ReelBoxes.size() == 0);
    }
#endif
    if (askTimeZone)
    {
        // Timezone
        currentCity = 0;
        nr_city_values = 1;
        DIR *zoneDir = NULL;
        struct dirent *entry = NULL;
        struct stat buf;
        std::string path = "/usr/share/zoneinfo";
        for (int k = 0; k < 256; k++)
        {
            city_values[k] = (char *)malloc(32);
            city_values[k][0] = '\0';
        }

        if ((zoneDir = opendir(path.c_str())) != NULL)
        {
            while ((entry = readdir(zoneDir)) != NULL)
            {
                if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0)
                {
                    std::string tmp = path + "/" + entry->d_name;
                    stat(tmp.c_str(), &buf);
                }
            }
            closedir(zoneDir);
        }
        else
            d(printf("Can not read directory \"%s\" because of error \"%s\"\n", path.c_str(), strerror(errno)))

        cSysConfig_vdr & sysconfig = cSysConfig_vdr::GetInstance();
        char *zoneInfo = strdup((char *)sysconfig.GetVariable("ZONEINFO"));

        char *buf2;
        char *continent = NULL;
        char *city = NULL;

        continent = strdup(strtok_r(zoneInfo, "/", &buf2)); /* go to first '/' */
        city = strdup(strtok_r(NULL, "/", &buf2));  /* get the rest */

        free(zoneInfo);

        if (city != NULL)
        {
            nr_city_values = 0;
            DIR *conDir = NULL;
            struct dirent *entry = NULL;
            struct stat buf;
            std::string path = "/usr/share/zoneinfo/Europe";

            if ((conDir = opendir(path.c_str())) != NULL)
            {
                while ((entry = readdir(conDir)) != NULL)
                {
                    std::string tmp = path + "/" + entry->d_name;
                    stat(tmp.c_str(), &buf);
                    if (S_ISREG(buf.st_mode))
                    {
                        city_values[nr_city_values] = strcpy(city_values[nr_city_values], entry->d_name);
                        nr_city_values++;
                    }
                }
                closedir(conDir);
            }
            else
                d(printf("Can not read directory \"%s\" because of error \"%s\"\n", path.c_str(), strerror(errno)))

            for (int i = 0; i < nr_city_values; i++)
                if (!strcmp(city_values[i], city))
                    currentCity = i;
        }
        free(city);
        free(continent);
    }                           // ask timezone