]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/keygrabber.cpp
Fixed command line PAL/NSTC switches to work properly.
[virtualjaguar] / src / gui / keygrabber.cpp
index 371c61991122a3d2a700a96b8ad8e90b37d89251..694be3cb5d20439e78edc2c7e5536d544b9d2998 100644 (file)
@@ -1,10 +1,10 @@
 //
 // keygrabber.cpp - Widget to grab a key and dismiss itself
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2011 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -21,20 +21,32 @@ KeyGrabber::KeyGrabber(QWidget * parent/*= 0*/): QDialog(parent)
        mainLayout->addWidget(label);
        setLayout(mainLayout);
        setWindowTitle(tr("Grab"));
+
+       // Will this make Mac OSX work???
+       setFocusPolicy(Qt::StrongFocus);
 }
 
 KeyGrabber::~KeyGrabber()
 {
 }
 
-void KeyGrabber::SetText(QString keyText)
+//void KeyGrabber::SetText(QString keyText)
+void KeyGrabber::SetKeyText(int keyNum)
 {
-       QString text = QString(tr("Press key for \"%1\"<br>(ESC to cancel)")).arg(keyText);
+       char jagButtonName[21][10] = { "Up", "Down", "Left", "Right",
+               "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3",
+               "A", "B", "C", "Option", "Pause" };
+
+       QString text = QString(tr("Press key for \"%1\"<br>(ESC to cancel)"))
+               .arg(QString(jagButtonName[keyNum]));
        label->setText(text);
 }
 
 void KeyGrabber::keyPressEvent(QKeyEvent * e)
 {
        key = e->key();
-       accept();
+
+       // Since this is problematic, we don't allow this key...
+       if (key != Qt::Key_Alt)
+               accept();
 }