QTfrontend/pageoptions.cpp
changeset 5238 46ddaf14509d
parent 5229 148d581b17ab
child 5252 ded882439548
equal deleted inserted replaced
5237:963d787a25c2 5238:46ddaf14509d
   205             labelLanguage->setText(QLabel::tr("Locale") + " *");
   205             labelLanguage->setText(QLabel::tr("Locale") + " *");
   206             MiscLayout->addWidget(labelLanguage, 2, 0);
   206             MiscLayout->addWidget(labelLanguage, 2, 0);
   207 
   207 
   208             CBLanguage = new QComboBox(groupMisc);
   208             CBLanguage = new QComboBox(groupMisc);
   209             QDir tmpdir;
   209             QDir tmpdir;
   210             tmpdir.cd(datadir->absolutePath());
   210             tmpdir.cd(cfgdir->absolutePath());
   211             tmpdir.cd("Locale");
   211             tmpdir.cd("Data/Locale");
   212             tmpdir.setFilter(QDir::Files);
   212             tmpdir.setFilter(QDir::Files);
   213             QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
   213             QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
   214             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
   214             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
   215             for(int i = 0; i < locs.count(); i++)
   215             for(int i = 0; i < locs.count(); i++)
   216             {
   216             {
   217                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
   217                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   218                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   219             }
       
   220 
       
   221             tmpdir.cd(datadir->absolutePath());
       
   222             tmpdir.cd("Locale");
       
   223             tmpdir.setFilter(QDir::Files);
       
   224             QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   225             for(int i = 0; i < tmplist.count(); i++)
       
   226             {
       
   227                 if (locs.contains(tmplist[i])) continue;
       
   228                 QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
   218                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
   229                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
   219             }
   230             }
   220 
   231 
   221             MiscLayout->addWidget(CBLanguage, 2, 1);
   232             MiscLayout->addWidget(CBLanguage, 2, 1);
   222 
   233