2 // controllertab.cpp: "Controller" tab on the config dialog
4 // Part of the Virtual Jaguar Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James Hammons <jlhamm@acm.org>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 06/23/2011 Created this file
13 // JLH 07/20/2011 Fixed a bunch of stuff
16 #include "controllertab.h"
18 #include "controllerwidget.h"
20 #include "keygrabber.h"
23 ControllerTab::ControllerTab(QWidget * parent/*= 0*/): QWidget(parent)
25 controllerWidget = new ControllerWidget(this);
26 redefineAll = new QPushButton(tr("Define All Inputs"));
28 QVBoxLayout * layout = new QVBoxLayout;
29 layout->addWidget(controllerWidget);
30 layout->addWidget(redefineAll);
33 connect(redefineAll, SIGNAL(clicked()), this, SLOT(DefineAllKeys()));
37 ControllerTab::~ControllerTab()
42 void ControllerTab::DefineAllKeys(void)
44 // char jagButtonName[21][10] = { "Up", "Down", "Left", "Right",
45 // "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3",
46 // "A", "B", "C", "Option", "Pause" };
47 int orderToDefine[21] = { 0, 1, 2, 3, 18, 17, 16, 20, 19, 7, 11, 15, 6, 10, 14, 5, 9, 13, 8, 4, 12 };
48 KeyGrabber keyGrab(this);
50 for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
52 // keyGrab.SetText(jagButtonName[orderToDefine[i]]);
53 keyGrab.SetKeyText(orderToDefine[i]);
55 int key = keyGrab.key;
57 if (key == Qt::Key_Escape)
60 // Otherwise, populate the appropriate spot in the settings & update screen...
61 controllerWidget->keys[orderToDefine[i]] = key;
62 controllerWidget->update();