Advanced game pad button to key remapping in work.
This commit is contained in:
parent
96dfa954e1
commit
16fc02daaf
|
@ -1561,7 +1561,7 @@ GamePadFuncConfigDialog::GamePadFuncConfigDialog( gamepad_function_key_t *fk, QW
|
|||
|
||||
b[0] = new GamePadConfigButton_t(0);
|
||||
b[1] = new GamePadConfigButton_t(1);
|
||||
hk = new GamePadConfigHotKey_t();
|
||||
hk = new GamePadConfigHotKey_t(k);
|
||||
|
||||
clearButton[0] = new QPushButton( tr("Clear") );
|
||||
clearButton[1] = new QPushButton( tr("Clear") );
|
||||
|
@ -1609,7 +1609,7 @@ GamePadFuncConfigDialog::GamePadFuncConfigDialog( gamepad_function_key_t *fk, QW
|
|||
|
||||
connect( b[0], SIGNAL(clicked(void)), this, SLOT(changeButton0(void)) );
|
||||
connect( b[1], SIGNAL(clicked(void)), this, SLOT(changeButton1(void)) );
|
||||
//connect( hk, SIGNAL(clicked(void)), this, SLOT(changeButton1(void)) );
|
||||
connect( hk, SIGNAL(clicked(void)), this, SLOT(changeKeySeq(void) ) );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
GamePadFuncConfigDialog::~GamePadFuncConfigDialog(void)
|
||||
|
@ -1707,20 +1707,39 @@ void GamePadFuncConfigDialog::changeButton1(void)
|
|||
changeButton(1);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
GamePadConfigHotKey_t::GamePadConfigHotKey_t(void)
|
||||
void GamePadFuncConfigDialog::changeKeySeq(void)
|
||||
{
|
||||
hk->setCaptureState(true);
|
||||
hk->setStyleSheet("background-color: green; color: white;");
|
||||
}
|
||||
//----------------------------------------------------
|
||||
GamePadConfigHotKey_t::GamePadConfigHotKey_t(gamepad_function_key_t *fk)
|
||||
{
|
||||
setText("Change");
|
||||
|
||||
k = fk;
|
||||
|
||||
captureState = false;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfigHotKey_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Press: 0x%x \n", event->key() );
|
||||
printf("GamePad Hot Key Press: 0x%x '%s'\n", event->key(), event->text().toStdString().c_str() );
|
||||
//pushKeyEvent(event, 1);
|
||||
|
||||
if ( captureState )
|
||||
{
|
||||
k->qKey = event->key();
|
||||
k->qModifier = event->modifiers();
|
||||
}
|
||||
}
|
||||
|
||||
void GamePadConfigHotKey_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Release: 0x%x \n", event->key() );
|
||||
printf("GamePad Hot Key Release: 0x%x \n", event->key() );
|
||||
//pushKeyEvent(event, 0);
|
||||
|
||||
captureState = false;
|
||||
setStyleSheet(NULL);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
|
|
@ -36,11 +36,16 @@ protected:
|
|||
class GamePadConfigHotKey_t : public QPushButton
|
||||
{
|
||||
public:
|
||||
GamePadConfigHotKey_t(void);
|
||||
GamePadConfigHotKey_t( gamepad_function_key_t *k );
|
||||
|
||||
void setCaptureState(bool s){ captureState = s; };
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
|
||||
gamepad_function_key_t *k;
|
||||
bool captureState;
|
||||
};
|
||||
|
||||
class GamePadFuncConfigDialog : public QDialog
|
||||
|
@ -73,6 +78,7 @@ private slots:
|
|||
void rejectCB(void);
|
||||
void changeButton0(void);
|
||||
void changeButton1(void);
|
||||
void changeKeySeq(void);
|
||||
};
|
||||
|
||||
class GamePadView_t : public QWidget
|
||||
|
|
Loading…
Reference in New Issue