Hooked up checkboxes on gamepad config page.
This commit is contained in:
parent
002e9e0f34
commit
950004503b
|
@ -49,10 +49,10 @@ gameWin_t::~gameWin_t(void)
|
|||
|
||||
void gameWin_t::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
printf("Main Window Close Event\n");
|
||||
//printf("Main Window Close Event\n");
|
||||
if ( gamePadConfWin != NULL )
|
||||
{
|
||||
printf("Command Game Pad Close\n");
|
||||
//printf("Command Game Pad Close\n");
|
||||
gamePadConfWin->closeWindow();
|
||||
}
|
||||
event->accept();
|
||||
|
@ -60,13 +60,13 @@ void gameWin_t::closeEvent(QCloseEvent *event)
|
|||
|
||||
void gameWin_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
printf("Key Press: 0x%x \n", event->key() );
|
||||
//printf("Key Press: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 1 );
|
||||
}
|
||||
|
||||
void gameWin_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
printf("Key Release: 0x%x \n", event->key() );
|
||||
//printf("Key Release: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 0 );
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ void gameWin_t::openGamePadConfWin(void)
|
|||
printf("GamePad Config Window Already Open\n");
|
||||
return;
|
||||
}
|
||||
printf("Open GamePad Config Window\n");
|
||||
//printf("Open GamePad Config Window\n");
|
||||
gamePadConfWin = new GamePadConfDialog_t(this);
|
||||
|
||||
gamePadConfWin->show();
|
||||
|
@ -195,7 +195,7 @@ void gameWin_t::openGamePadConfWin(void)
|
|||
|
||||
delete gamePadConfWin;
|
||||
gamePadConfWin = NULL;
|
||||
printf("GamePad Config Window Destroyed\n");
|
||||
//printf("GamePad Config Window Destroyed\n");
|
||||
}
|
||||
|
||||
void gameWin_t::aboutQPlot(void)
|
||||
|
|
|
@ -37,6 +37,14 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
efs_chkbox = new QCheckBox("Enable Four Score");
|
||||
udlr_chkbox = new QCheckBox("Allow Up+Down/Left+Right");
|
||||
|
||||
int fourScore;
|
||||
g_config->getOption("SDL.FourScore", &fourScore);
|
||||
efs_chkbox->setChecked( fourScore );
|
||||
|
||||
int opposite_dirs;
|
||||
g_config->getOption("SDL.Input.EnableOppositeDirectionals", &opposite_dirs);
|
||||
udlr_chkbox->setChecked( opposite_dirs );
|
||||
|
||||
frame = new QGroupBox(tr("Buttons:"));
|
||||
grid = new QGridLayout();
|
||||
|
||||
|
@ -61,7 +69,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
|
||||
buttonName = new QLabel(tr(text));
|
||||
keyName[i] = new QLabel(tr(keyNameStr));
|
||||
button[i] = new QPushButton(tr("Change"));
|
||||
button[i] = new GamePadConfigButton_t(i);
|
||||
|
||||
grid->addWidget( buttonName, i, 0, Qt::AlignCenter );
|
||||
grid->addWidget( keyName[i], i, 1, Qt::AlignCenter );
|
||||
|
@ -81,6 +89,9 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
connect(button[9], SIGNAL(clicked()), this, SLOT(changeButton9(void)) );
|
||||
connect(closebutton, SIGNAL(clicked()), this, SLOT(closeWindow(void)) );
|
||||
|
||||
connect(efs_chkbox , SIGNAL(stateChanged(int)), this, SLOT(ena4score(int)) );
|
||||
connect(udlr_chkbox, SIGNAL(stateChanged(int)), this, SLOT(oppDirEna(int)) );
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
@ -91,9 +102,6 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
|
||||
setLayout( mainLayout );
|
||||
|
||||
//show();
|
||||
//exec();
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -103,16 +111,30 @@ GamePadConfDialog_t::~GamePadConfDialog_t(void)
|
|||
}
|
||||
void GamePadConfDialog_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("Key Press: 0x%x \n", event->key() );
|
||||
//printf("GamePad Window Key Press: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 1 );
|
||||
}
|
||||
|
||||
void GamePadConfDialog_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("Key Release: 0x%x \n", event->key() );
|
||||
//printf("GamePad Window Key Release: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::ena4score(int state)
|
||||
{
|
||||
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||
printf("Set 'SDL.FourScore' = %i\n", value);
|
||||
g_config->setOption("SDL.FourScore", value);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::oppDirEna(int state)
|
||||
{
|
||||
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||
//printf("Set 'SDL.Input.EnableOppositeDirectionals' = %i\n", value);
|
||||
g_config->setOption("SDL.Input.EnableOppositeDirectionals", value);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton(int padNo, int x)
|
||||
{
|
||||
int configNo = 0;
|
||||
|
@ -165,7 +187,7 @@ void GamePadConfDialog_t::changeButton(int padNo, int x)
|
|||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
printf("GamePad Close Window Event\n");
|
||||
//printf("GamePad Close Window Event\n");
|
||||
buttonConfigStatus = 0;
|
||||
done(0);
|
||||
event->accept();
|
||||
|
@ -173,7 +195,7 @@ void GamePadConfDialog_t::closeEvent(QCloseEvent *event)
|
|||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeWindow(void)
|
||||
{
|
||||
printf("Close Window\n");
|
||||
//printf("Close Window\n");
|
||||
buttonConfigStatus = 0;
|
||||
done(0);
|
||||
}
|
||||
|
@ -228,3 +250,21 @@ void GamePadConfDialog_t::changeButton9(void)
|
|||
changeButton( portNum, 9 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
GamePadConfigButton_t::GamePadConfigButton_t(int i)
|
||||
{
|
||||
idx = i;
|
||||
setText("Change");
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfigButton_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Press: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 1 );
|
||||
}
|
||||
|
||||
void GamePadConfigButton_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Release: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
|
|
@ -14,6 +14,18 @@
|
|||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
|
||||
class GamePadConfigButton_t : public QPushButton
|
||||
{
|
||||
public:
|
||||
GamePadConfigButton_t(int i);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
|
||||
int idx;
|
||||
};
|
||||
|
||||
class GamePadConfDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -24,8 +36,8 @@ class GamePadConfDialog_t : public QDialog
|
|||
|
||||
protected:
|
||||
QComboBox *portSel;
|
||||
QPushButton *button[10];
|
||||
QLabel *keyName[10];
|
||||
GamePadConfigButton_t *button[10];
|
||||
|
||||
int portNum;
|
||||
int buttonConfigStatus;
|
||||
|
@ -48,5 +60,7 @@ class GamePadConfDialog_t : public QDialog
|
|||
void changeButton7(void);
|
||||
void changeButton8(void);
|
||||
void changeButton9(void);
|
||||
void ena4score(int state);
|
||||
void oppDirEna(int state);
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue