QTfrontend/gamecfgwidget.cpp
branch0.9.15
changeset 4721 5e50d8162a96
parent 4720 a9f9c96db60c
child 4936 d65d438acd23
equal deleted inserted replaced
4700:e8fd20b2d66b 4721:5e50d8162a96
    50     GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Gameplay"), GBoxOptions), 0, 0);
    50     GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Gameplay"), GBoxOptions), 0, 0);
    51 
    51 
    52     Scripts = new QComboBox(GBoxOptions);
    52     Scripts = new QComboBox(GBoxOptions);
    53     GBoxOptionsLayout->addWidget(Scripts, 0, 1);
    53     GBoxOptionsLayout->addWidget(Scripts, 0, 1);
    54 
    54 
    55     Scripts->addItem(QComboBox::tr("Normal"));
    55     Scripts->addItem("Normal");
    56     Scripts->insertSeparator(1);
    56     Scripts->insertSeparator(1);
    57 
    57 
    58     for (int i = 0; i < scriptList->size(); ++i) {
    58     for (int i = 0; i < scriptList->size(); ++i) {
    59         QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive);
    59         QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive);
    60         QList<QVariant> scriptInfo;
    60         QList<QVariant> scriptInfo;
   330             pMapContainer->setMap(value);
   330             pMapContainer->setMap(value);
   331             return;
   331             return;
   332         }
   332         }
   333         if (param == "SEED") {
   333         if (param == "SEED") {
   334             pMapContainer->setSeed(value);
   334             pMapContainer->setSeed(value);
       
   335             if (!QRegExp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}").exactMatch(value)) {
       
   336                 pMapContainer->seedEdit->setVisible(true);
       
   337                 }
   335             return;
   338             return;
   336         }
   339         }
   337         if (param == "THEME") {
   340         if (param == "THEME") {
   338             pMapContainer->setTheme(value);
   341             pMapContainer->setTheme(value);
   339             return;
   342             return;
   381     }
   384     }
   382 }
   385 }
   383 
   386 
   384 void GameCFGWidget::mapChanged(const QString & value)
   387 void GameCFGWidget::mapChanged(const QString & value)
   385 {
   388 {
   386     if(pMapContainer->getCurrentIsMission())
   389     if(isEnabled() && pMapContainer->getCurrentIsMission())
   387     {
   390     {
   388         Scripts->setEnabled(false);
   391         Scripts->setEnabled(false);
   389         Scripts->setCurrentIndex(0);
   392         Scripts->setCurrentIndex(0);
   390 
   393 
   391         if (pMapContainer->getCurrentScheme() == "locked")
   394         if (pMapContainer->getCurrentScheme() == "locked")
   456     for(int i = 0; i < size; ++i)
   459     for(int i = 0; i < size; ++i)
   457         sl << schemeData(i).toString();
   460         sl << schemeData(i).toString();
   458 
   461 
   459     emit paramChanged("SCHEME", sl);
   462     emit paramChanged("SCHEME", sl);
   460 
   463 
   461     if (bindEntries->isEnabled() && bindEntries->isChecked()) {
   464     if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) {
   462         QString schemeName = GameSchemes->itemText(index);
   465         QString schemeName = GameSchemes->itemText(index);
   463         for (int i = 0; i < WeaponsName->count(); i++) {
   466         for (int i = 0; i < WeaponsName->count(); i++) {
   464              QString weapName = WeaponsName->itemText(i);
   467              QString weapName = WeaponsName->itemText(i);
   465              int res = QString::compare(weapName, schemeName, Qt::CaseSensitive);
   468              int res = QString::compare(weapName, schemeName, Qt::CaseSensitive);
   466              if (0 == res) {
   469              if (0 == res) {
   472     }
   475     }
   473 }
   476 }
   474 
   477 
   475 void GameCFGWidget::scriptChanged(int index)
   478 void GameCFGWidget::scriptChanged(int index)
   476 {
   479 {
   477     if(index > 0)
   480     if(isEnabled() && index > 0)
   478     {
   481     {
   479         QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString();
   482         QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString();
   480         QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString();
   483         QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString();
   481 
   484 
   482         if (scheme == "locked")
   485         if (scheme == "locked")