QTfrontend/mapContainer.cpp
changeset 3185 19d84448835f
parent 3181 5c350b6c38f4
child 3195 c6f58cff5ffc
equal deleted inserted replaced
3184:4f02f6a834b7 3185:19d84448835f
    61 
    61 
    62     chooseMap = new QComboBox(this);
    62     chooseMap = new QComboBox(this);
    63     chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    63     chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    64     chooseMap->addItem(QComboBox::tr("generated map..."));
    64     chooseMap->addItem(QComboBox::tr("generated map..."));
    65     chooseMap->addItem(QComboBox::tr("generated maze..."));
    65     chooseMap->addItem(QComboBox::tr("generated maze..."));
       
    66     chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions
       
    67 
       
    68     int missionindex = chooseMap->count();
    66     for (int i = 0; i < mapList->size(); ++i) {
    69     for (int i = 0; i < mapList->size(); ++i) {
    67         QString map = (*mapList)[i];
    70         QString map = (*mapList)[i];
    68         QFile mapCfgFile(
    71         QFile mapCfgFile(
    69                 QString("%1/Maps/%2/map.cfg")
    72                 QString("%1/Maps/%2/map.cfg")
    70                 .arg(datadir->absolutePath())
    73                 .arg(datadir->absolutePath())
    86             if (limit)
    89             if (limit)
    87                 mapInfo.push_back(limit);
    90                 mapInfo.push_back(limit);
    88             else
    91             else
    89                 mapInfo.push_back(18);
    92                 mapInfo.push_back(18);
    90             mapInfo.push_back(mapLuaFile.exists());
    93             mapInfo.push_back(mapLuaFile.exists());
    91             chooseMap->addItem(mapLuaFile.exists() ? (QComboBox::tr("Mission") + ": " + map) : map, mapInfo);
    94             if(mapLuaFile.exists())
       
    95                 chooseMap->insertItem(missionindex++, QComboBox::tr("Mission") + ": " + map, mapInfo);
       
    96             else
       
    97                 chooseMap->addItem(map, mapInfo);
    92             mapCfgFile.close();
    98             mapCfgFile.close();
    93         }
    99         }
    94     }
   100     }
       
   101     chooseMap->insertSeparator(missionindex); // separator between missions and maps
    95 
   102 
    96     connect(chooseMap, SIGNAL(currentIndexChanged(int)), this, SLOT(mapChanged(int)));
   103     connect(chooseMap, SIGNAL(currentIndexChanged(int)), this, SLOT(mapChanged(int)));
    97     mainLayout.addWidget(chooseMap, 1, 1);
   104     mainLayout.addWidget(chooseMap, 1, 1);
    98 
   105 
    99     QLabel * lblMap = new QLabel(tr("Map"), this);
   106     QLabel * lblMap = new QLabel(tr("Map"), this);