equal
deleted
inserted
replaced
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; |
|
61 scriptInfo.push_back(script); |
61 QFile scriptCfgFile(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script)); |
62 QFile scriptCfgFile(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script)); |
62 if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) { |
63 if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) { |
63 QString scheme; |
64 QString scheme; |
64 QString weapons; |
65 QString weapons; |
65 QTextStream input(&scriptCfgFile); |
66 QTextStream input(&scriptCfgFile); |
78 else |
79 else |
79 { |
80 { |
80 scriptInfo.push_back("locked"); |
81 scriptInfo.push_back("locked"); |
81 scriptInfo.push_back("locked"); |
82 scriptInfo.push_back("locked"); |
82 } |
83 } |
83 Scripts->addItem(script, scriptInfo); |
84 Scripts->addItem(script.replace("_", " "), scriptInfo); |
84 } |
85 } |
85 |
86 |
86 connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); |
87 connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); |
87 |
88 |
88 QWidget *SchemeWidget = new QWidget(GBoxOptions); |
89 QWidget *SchemeWidget = new QWidget(GBoxOptions); |
269 } |
270 } |
270 bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); |
271 bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); |
271 |
272 |
272 if (Scripts->currentIndex() > 0) |
273 if (Scripts->currentIndex() > 0) |
273 { |
274 { |
274 bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->currentText()).toUtf8(); |
275 bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8(); |
275 } |
276 } |
276 |
277 |
277 QByteArray result; |
278 QByteArray result; |
278 |
279 |
279 foreach(QByteArray ba, bcfg) |
280 foreach(QByteArray ba, bcfg) |
471 |
472 |
472 void GameCFGWidget::scriptChanged(int index) |
473 void GameCFGWidget::scriptChanged(int index) |
473 { |
474 { |
474 if(index > 0) |
475 if(index > 0) |
475 { |
476 { |
476 QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[0].toString(); |
477 QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString(); |
477 QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString(); |
478 QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString(); |
478 |
479 |
479 if (scheme == "locked") |
480 if (scheme == "locked") |
480 { |
481 { |
481 GameSchemes->setEnabled(false); |
482 GameSchemes->setEnabled(false); |
482 GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); |
483 GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); |