Added periodic checking logic to ensure that gamepad 4 score checkboxes on input and gamepad config windows stay synchronized.

This commit is contained in:
Matthew Budd 2020-11-24 19:46:22 -05:00
parent c9d0eddec6
commit 14766432ae
4 changed files with 18 additions and 3 deletions

View File

@ -70,7 +70,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
QHBoxLayout *hbox, *hbox1, *hbox2, *hbox3, *hbox4, *hbox5; QHBoxLayout *hbox, *hbox1, *hbox2, *hbox3, *hbox4, *hbox5;
QVBoxLayout *vbox, *vbox1, *vbox2; QVBoxLayout *vbox, *vbox1, *vbox2;
QGridLayout *grid; QGridLayout *grid;
QCheckBox *efs_chkbox, *udlr_chkbox; QCheckBox *udlr_chkbox;
QGroupBox *frame1, *frame2; QGroupBox *frame1, *frame2;
QLabel *label; QLabel *label;
QPushButton *newProfileButton; QPushButton *newProfileButton;
@ -910,6 +910,13 @@ void GamePadConfDialog_t::updatePeriodic(void)
keyName[i]->setStyleSheet("color: black;"); keyName[i]->setStyleSheet("color: black;");
} }
} }
int fourScore;
g_config->getOption("SDL.FourScore", &fourScore);
if ( fourScore != efs_chkbox->isChecked() )
{
efs_chkbox->setChecked( fourScore );
}
} }
//---------------------------------------------------- //----------------------------------------------------
GamePadConfigButton_t::GamePadConfigButton_t(int i) GamePadConfigButton_t::GamePadConfigButton_t(int i)

View File

@ -43,6 +43,7 @@ class GamePadConfDialog_t : public QDialog
QComboBox *devSel; QComboBox *devSel;
QComboBox *mapSel; QComboBox *mapSel;
QComboBox *profSel; QComboBox *profSel;
QCheckBox *efs_chkbox;
QLabel *guidLbl; QLabel *guidLbl;
QLabel *mapMsg; QLabel *mapMsg;
QLabel *keyName[GAMEPAD_NUM_BUTTONS]; QLabel *keyName[GAMEPAD_NUM_BUTTONS];

View File

@ -352,7 +352,7 @@ void InputConfDialog_t::expSelect(int index)
void InputConfDialog_t::fourScoreChanged(int state) void InputConfDialog_t::fourScoreChanged(int state)
{ {
int value = (state == Qt::Unchecked) ? 0 : 1; int value = (state == Qt::Unchecked) ? 0 : 1;
//printf("Set 'SDL.FourScore' = %i\n", value); printf("Set 'SDL.FourScore' = %i\n", value);
g_config->setOption("SDL.FourScore", value); g_config->setOption("SDL.FourScore", value);
setInputs(); setInputs();
@ -530,6 +530,7 @@ void InputConfDialog_t::updatePeriodic(void)
{ {
bool updateNeeded = false; bool updateNeeded = false;
int tmpCurInputType[3], tmpUsrInputType[3]; int tmpCurInputType[3], tmpUsrInputType[3];
int fourScoreValue;
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
@ -550,5 +551,12 @@ void InputConfDialog_t::updatePeriodic(void)
updatePortLabels(); updatePortLabels();
updatePortComboBoxes(); updatePortComboBoxes();
} }
g_config->getOption("SDL.FourScore", &fourScoreValue);
if ( fourScoreValue != fourScoreEna->isChecked() )
{
fourScoreEna->setChecked( fourScoreValue );
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -43,7 +43,6 @@ class InputConfDialog_t : public QDialog
QComboBox *expPortComboxBox; QComboBox *expPortComboxBox;
QPushButton *loadConfigButton; QPushButton *loadConfigButton;
QPushButton *saveConfigButton; QPushButton *saveConfigButton;
//QLineEdit *saveFileName;
int curNesInput[3]; int curNesInput[3];
int usrNesInput[3]; int usrNesInput[3];