QTfrontend/hwform.cpp
changeset 1517 27caa8c6e73a
parent 1512 43742041c211
child 1530 3b8d723661b2
equal deleted inserted replaced
1516:bb9fa5809c49 1517:27caa8c6e73a
   163 		allSBars.at(i)->setPalette(pal);
   163 		allSBars.at(i)->setPalette(pal);
   164 }
   164 }
   165 
   165 
   166 void HWForm::UpdateWeapons()
   166 void HWForm::UpdateWeapons()
   167 {
   167 {
   168 	// FIXME: rewrite this with boost (or TR1/0x)
       
   169 	QVector<QComboBox*> combos;
   168 	QVector<QComboBox*> combos;
   170 	combos.push_back(ui.pageOptions->WeaponsName);
   169 	combos.push_back(ui.pageOptions->WeaponsName);
   171 	combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   170 	combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   172 	combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
   171 	combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
   173 
   172 
   174 	for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) {
   173 	QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
       
   174 
       
   175 	for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) {
   175 		(*it)->clear();
   176 		(*it)->clear();
   176 		(*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
   177 
       
   178 		for(int i = 0; i < names.size(); ++i)
       
   179 			(*it)->addItem(names[i], ui.pageSelectWeapon->pWeapons->getWeaponsString(names[i]));
       
   180 		
   177 		int pos = (*it)->findText("Default");
   181 		int pos = (*it)->findText("Default");
   178 		if (pos != -1) {
   182 		if (pos != -1) {
   179 			(*it)->setCurrentIndex(pos);
   183 			(*it)->setCurrentIndex(pos);
   180 		}
   184 		}
   181 	}
   185 	}
   737 }
   741 }
   738 
   742 
   739 void HWForm::CreateNetGame()
   743 void HWForm::CreateNetGame()
   740 {
   744 {
   741 	QString ammo;
   745 	QString ammo;
   742 	if (hwnet->isRoomChief()) {
   746 	ammo = ui.pageNetGame->pGameCFG->WeaponsName->itemData(
   743 		ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
   747 			ui.pageNetGame->pGameCFG->WeaponsName->currentIndex()
   744 	} else {
   748 			).toString();
   745 		ammo = ui.pageNetGame->pGameCFG->getNetAmmo();
   749 
   746 	}
       
   747 	
       
   748 	CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
   750 	CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
   749 
   751 
   750 	connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
   752 	connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
   751 	connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
   753 	connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
   752 	connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
   754 	connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));