MCPcopy Create free account
hub / github.com/TASEmulators/fceux / refreshKeyBindTree

Method refreshKeyBindTree

src/drivers/Qt/GamePadConf.cpp:658–723  ·  view source on GitHub ↗

----------------------------------------------------

Source from the content-addressed store, hash-verified

656}
657//----------------------------------------------------
658void 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);

Callers

nothing calls this directly

Calls 6

setTextMethod · 0.80
ButtonNameFunction · 0.70
trFunction · 0.50
clearMethod · 0.45
beginMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected