QTfrontend/pagetraining.cpp
changeset 5238 46ddaf14509d
parent 5204 e1a5f4d5d86a
child 6009 14f6fc9869f2
equal deleted inserted replaced
5237:963d787a25c2 5238:46ddaf14509d
    33     pageLayout->setRowStretch(2, 1);
    33     pageLayout->setRowStretch(2, 1);
    34 
    34 
    35     CBSelect = new QComboBox(this);
    35     CBSelect = new QComboBox(this);
    36 
    36 
    37     QDir tmpdir;
    37     QDir tmpdir;
       
    38     tmpdir.cd(cfgdir->absolutePath());
       
    39     tmpdir.cd("Data/Missions/Training");
       
    40     tmpdir.setFilter(QDir::Files);
       
    41     QStringList userlist = tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1");
       
    42     CBSelect->addItems(userlist);
       
    43 
    38     tmpdir.cd(datadir->absolutePath());
    44     tmpdir.cd(datadir->absolutePath());
    39     tmpdir.cd("Missions/Training");
    45     tmpdir.cd("Missions/Training");
    40     tmpdir.setFilter(QDir::Files);
    46     tmpdir.setFilter(QDir::Files);
    41     CBSelect->addItems(tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"));
    47     QStringList tmplist = tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1");
       
    48     QStringList datalist;
       
    49     for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it)
       
    50         if (!userlist.contains(*it,Qt::CaseInsensitive)) datalist.append(*it);
       
    51     CBSelect->addItems(datalist);
       
    52 
    42     for(int i = 0; i < CBSelect->count(); i++)
    53     for(int i = 0; i < CBSelect->count(); i++)
    43     {
    54     {
    44         CBSelect->setItemData(i, CBSelect->itemText(i));
    55         CBSelect->setItemData(i, CBSelect->itemText(i));
    45         CBSelect->setItemText(i, CBSelect->itemText(i).replace("_", " "));
    56         CBSelect->setItemText(i, CBSelect->itemText(i).replace("_", " "));
    46     }
    57     }