QTfrontend/ui/page/pageoptions.cpp
changeset 8098 4efee370e2de
parent 7703 78d2ac987f41
child 8151 25b95d6224fc
equal deleted inserted replaced
8095:df61e150eb70 8098:4efee370e2de
   189             labelLanguage->setText(QLabel::tr("Locale") + " *");
   189             labelLanguage->setText(QLabel::tr("Locale") + " *");
   190             MiscLayout->addWidget(labelLanguage, 0, 0);
   190             MiscLayout->addWidget(labelLanguage, 0, 0);
   191 
   191 
   192             // List of installed languages
   192             // List of installed languages
   193             CBLanguage = new QComboBox(groupMisc);
   193             CBLanguage = new QComboBox(groupMisc);
   194             QDir tmpdir;
   194             QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
   195             tmpdir.cd(cfgdir->absolutePath());
       
   196             tmpdir.cd("Data/Locale");
       
   197             tmpdir.setFilter(QDir::Files);
       
   198             QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   199             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
   195             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
   200             for(int i = 0; i < locs.count(); i++)
   196             for(int i = 0; i < locs.count(); i++)
   201             {
   197             {
   202                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
   198                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
   203                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   204             }
       
   205 
       
   206             tmpdir.cd(datadir->absolutePath());
       
   207             tmpdir.cd("Locale");
       
   208             tmpdir.setFilter(QDir::Files);
       
   209             QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   210             for(int i = 0; i < tmplist.count(); i++)
       
   211             {
       
   212                 if (locs.contains(tmplist[i])) continue;
       
   213                 QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   214                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
   199                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
   215             }
   200             }
   216 
   201 
   217             MiscLayout->addWidget(CBLanguage, 0, 1);
   202             MiscLayout->addWidget(CBLanguage, 0, 1);
   218 
   203