----------------------------------------------------
| 656 | } |
| 657 | //---------------------------------------------------- |
| 658 | void GamePadConfDialog_t::refreshKeyBindTree( bool reset ) |
| 659 | { |
| 660 | int i; |
| 661 | QTreeWidgetItem *item; |
| 662 | std::list <gamepad_function_key_t*>::iterator it; |
| 663 | gamepad_function_key_t *binding; |
| 664 | const char *btnName[2]; |
| 665 | char btnSeq[128]; |
| 666 | |
| 667 | if ( reset ) |
| 668 | { |
| 669 | keyBindTree->clear(); |
| 670 | } |
| 671 | |
| 672 | i=0; |
| 673 | |
| 674 | for (it=GamePad[portNum].gpKeySeqList.begin(); it!=GamePad[portNum].gpKeySeqList.end(); it++) |
| 675 | { |
| 676 | binding = *it; |
| 677 | |
| 678 | if ( keyBindTree->topLevelItemCount() > i ) |
| 679 | { |
| 680 | item = keyBindTree->topLevelItem(i); |
| 681 | } |
| 682 | else |
| 683 | { |
| 684 | item = NULL; |
| 685 | } |
| 686 | |
| 687 | if ( item == NULL ) |
| 688 | { |
| 689 | item = new QTreeWidgetItem(); |
| 690 | |
| 691 | keyBindTree->addTopLevelItem(item); |
| 692 | } |
| 693 | |
| 694 | btnName[0] = ButtonName( &binding->bmap[0] ); |
| 695 | |
| 696 | btnSeq[0] = 0; |
| 697 | |
| 698 | if ( btnName[0][0] != 0 ) |
| 699 | { |
| 700 | strcat( btnSeq, btnName[0] ); |
| 701 | strcat( btnSeq, " + "); |
| 702 | } |
| 703 | |
| 704 | btnName[1] = ButtonName( &binding->bmap[1] ); |
| 705 | |
| 706 | if ( btnName[1][0] != 0 ) |
| 707 | { |
| 708 | strcat( btnSeq, btnName[1] ); |
| 709 | } |
| 710 | |
| 711 | item->setText(0, tr(btnSeq)); |
| 712 | item->setText(1, QString::fromStdString(binding->keySeq[0].name)); |
| 713 | item->setText(2, QString::fromStdString(binding->keySeq[1].name)); |
| 714 | |
| 715 | item->setTextAlignment(0, Qt::AlignLeft); |