equal
deleted
inserted
replaced
163 for (int i = 0; i < cDefaultAmmos.count(); i++) |
163 for (int i = 0; i < cDefaultAmmos.count(); i++) |
164 { |
164 { |
165 QPair<QString,QString> ammo = cDefaultAmmos.at(i); |
165 QPair<QString,QString> ammo = cDefaultAmmos.at(i); |
166 CBWeapons->addItem(ammo.first.toAscii().constData()); |
166 CBWeapons->addItem(ammo.first.toAscii().constData()); |
167 } |
167 } |
168 |
|
169 gameInLobby = false; |
|
170 } |
168 } |
171 |
169 |
172 |
170 |
173 void PageRoomsList::displayError(const QString & message) |
171 void PageRoomsList::displayError(const QString & message) |
174 { |
172 { |
418 tr("OK")); |
416 tr("OK")); |
419 } |
417 } |
420 |
418 |
421 void PageRoomsList::onJoinClick() |
419 void PageRoomsList::onJoinClick() |
422 { |
420 { |
423 /* |
421 QModelIndexList mdl = roomsList->selectionModel()->selectedRows(); |
424 QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
422 |
425 if (!curritem) |
423 if(mdl.size() != 1) |
426 { |
424 { |
427 QMessageBox::critical(this, |
425 QMessageBox::critical(this, |
428 tr("Error"), |
426 tr("Error"), |
429 tr("Please select room from the list"), |
427 tr("Please select room from the list"), |
430 tr("OK")); |
428 tr("OK")); |
431 return; |
429 return; |
432 } |
430 } |
433 |
431 |
434 for (int i = 0; i < listFromServer.size(); i += 8) |
432 bool gameInLobby = roomsList->model()->index(mdl[0].row(), 0).data().toString().compare("True"); |
435 { |
433 QString roomName = roomsList->model()->index(mdl[0].row(), 1).data().toString(); |
436 if (listFromServer[i + 1] == curritem->data(Qt::DisplayRole).toString()) |
434 |
437 { |
435 if (!gameInLobby) |
438 gameInLobby = listFromServer[i].compare("True"); |
436 emit askJoinConfirmation(roomName); |
439 break; |
|
440 } |
|
441 } |
|
442 |
|
443 if (gameInLobby) |
|
444 { |
|
445 gameInLobbyName = curritem->data(Qt::DisplayRole).toString(); |
|
446 emit askForRoomList(); |
|
447 } |
|
448 else |
437 else |
449 { |
438 emit askForJoinRoom(roomName); |
450 emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
451 } |
|
452 */ |
|
453 } |
439 } |
454 |
440 |
455 void PageRoomsList::onRefreshClick() |
441 void PageRoomsList::onRefreshClick() |
456 { |
442 { |
457 emit askForRoomList(); |
443 emit askForRoomList(); |
488 |
474 |
489 void PageRoomsList::setModel(QAbstractTableModel *model) |
475 void PageRoomsList::setModel(QAbstractTableModel *model) |
490 { |
476 { |
491 roomsList->setModel(model); |
477 roomsList->setModel(model); |
492 |
478 |
|
479 roomsList->hideColumn(0); |
|
480 |
493 QHeaderView * h = roomsList->horizontalHeader(); |
481 QHeaderView * h = roomsList->horizontalHeader(); |
494 h->resizeSection(0, 200); |
482 h->resizeSection(1, 200); |
495 h->resizeSection(1, 50); |
|
496 h->resizeSection(2, 50); |
483 h->resizeSection(2, 50); |
497 h->resizeSection(3, 100); |
484 h->resizeSection(3, 50); |
498 h->resizeSection(4, 100); |
485 h->resizeSection(4, 100); |
499 h->resizeSection(5, 100); |
486 h->resizeSection(5, 100); |
500 h->resizeSection(6, 100); |
487 h->resizeSection(6, 100); |
501 } |
488 h->resizeSection(7, 100); |
|
489 } |