]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/controllertab.cpp
Fixed OP regression in Rayman, probably others.
[virtualjaguar] / src / gui / controllertab.cpp
index 722ee10e8bc4cef677dfb0c0ab4d94a0fda739c1..98c9c017c4de46a23a543572e2631418a12796d6 100644 (file)
@@ -14,6 +14,7 @@
 #include "controllertab.h"
 
 #include "joystick.h"
+#include "keygrabber.h"
 
 
 ControllerTab::ControllerTab(QWidget * parent/*= 0*/): QWidget(parent)
@@ -127,6 +128,24 @@ ControllerTab::~ControllerTab()
 
 void ControllerTab::DefineAllKeys(void)
 {
+       char jagButtonName[21][10] = { "Up", "Down", "Left", "Right",
+               "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3",
+               "A", "B", "C", "Option", "Pause" };
+       int orderToDefine[21] = { 0, 1, 2, 3, 18, 17, 16, 20, 19, 7, 11, 15, 6, 10, 14, 5, 9, 13, 8, 4, 12 };
+       KeyGrabber keyGrab(this);
+
+       for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
+       {
+               keyGrab.SetText(jagButtonName[orderToDefine[i]]);
+               keyGrab.exec();
+               int key = keyGrab.key;
+
+               if (key == Qt::Key_Escape)
+                       break;
+
+               // Otherwise, populate the appropriate spot in the settings...
+               p1Keys[orderToDefine[i]] = key;
+       }
 }
 
 #if 0