QTfrontend/model/MapModel.cpp
changeset 8386 2aaa2995a32e
parent 8385 9e8924ff9813
child 8393 85bd6c7b2641
equal deleted inserted replaced
8385:9e8924ff9813 8386:2aaa2995a32e
    47 
    47 
    48     //QList<QStandardItem *> staticMaps;
    48     //QList<QStandardItem *> staticMaps;
    49     //QList<QStandardItem *> missionMaps;
    49     //QList<QStandardItem *> missionMaps;
    50     QList<QStandardItem *> mapList;
    50     QList<QStandardItem *> mapList;
    51 
    51 
    52     // only 2 map relate files are relevant:
       
    53     // - the cfg file that contains the settings/info of the map
       
    54     // - the lua file - if it exists it's a mission, otherwise it isn't
       
    55     QFile mapLuaFile;
       
    56     QFile mapCfgFile;
       
    57 
       
    58     // add mission/static maps to lists
    52     // add mission/static maps to lists
    59     foreach (QString map, maps)
    53     foreach (QString map, maps)
    60     {
    54     {
    61         mapCfgFile.setFileName(QString("physfs://Maps/%1/map.cfg").arg(map));
    55         // only 2 map relate files are relevant:
    62         mapLuaFile.setFileName(QString("physfs://Maps/%1/map.lua").arg(map));
    56         // - the cfg file that contains the settings/info of the map
    63         QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
    57         // - the lua file - if it exists it's a mission, otherwise it isn't
       
    58         QFile mapLuaFile(QString("physfs://Maps/%1/map.lua").arg(map));
       
    59         QFile mapCfgFile(QString("physfs://Maps/%1/map.cfg").arg(map));
    64 
    60 
    65         if (mapCfgFile.open(QFile::ReadOnly))
    61         if (mapCfgFile.open(QFile::ReadOnly))
    66         {
    62         {
    67             QString caption;
    63             QString caption;
    68             QString theme;
    64             QString theme;
    90 
    86 
    91             // Load description (if applicable)
    87             // Load description (if applicable)
    92             if (isMission)
    88             if (isMission)
    93             {
    89             {
    94                 QString locale = HWApplication::keyboardInputLocale().name();
    90                 QString locale = HWApplication::keyboardInputLocale().name();
       
    91 
       
    92                 QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
    95                 desc = descSettings.value(locale, QString()).toString().replace("|", "\n");
    93                 desc = descSettings.value(locale, QString()).toString().replace("|", "\n");
    96             }
    94             }
    97 
    95 
    98             // let's use some semi-sane hedgehog limit, rather than none
    96             // let's use some semi-sane hedgehog limit, rather than none
    99             if (limit == 0)
    97             if (limit == 0)