diff --git a/src/buttoneditdialog.cpp b/src/buttoneditdialog.cpp index 78bb9e88..cbeab784 100755 --- a/src/buttoneditdialog.cpp +++ b/src/buttoneditdialog.cpp @@ -463,9 +463,6 @@ void ButtonEditDialog::checkTurboSetting(bool state) ui->turboCheckBox->setChecked(state); ui->turboCheckBox->setEnabled(true); } - - getHelperLocal().setUseTurbo(state); - } } diff --git a/src/dpadpushbuttongroup.cpp b/src/dpadpushbuttongroup.cpp index 834c77ab..ad0ea871 100755 --- a/src/dpadpushbuttongroup.cpp +++ b/src/dpadpushbuttongroup.cpp @@ -49,41 +49,26 @@ void DPadPushButtonGroup::generateButtons() QHash *buttons = dpad->getJoyButtons(); - JoyDPadButton *button = buttons->value(JoyDPadButton::DpadLeftUp); - generateBtnForGrid(buttons, button, upLeftButton, 0, 0); - - button = buttons->value(JoyDPadButton::DpadUp); - generateBtnForGrid(buttons, button, upButton, 0, 1); - - button = buttons->value(JoyDPadButton::DpadRightUp); - generateBtnForGrid(buttons, button, upRightButton, 0, 2); - - button = buttons->value(JoyDPadButton::DpadLeft); - generateBtnForGrid(buttons, button, leftButton, 1, 0); + upLeftButton = generateBtnForGrid(buttons, 9, 0, 0); + upButton = generateBtnForGrid(buttons, 1, 0, 1); + upRightButton = generateBtnForGrid(buttons, 3, 0, 2); + leftButton = generateBtnForGrid(buttons, 8, 1, 0); dpadWidget = new DPadPushButton(dpad, displayNames, parentWidget()); dpadWidget->setIcon(QIcon::fromTheme(QString::fromUtf8("games-config-options"))); connect(dpadWidget, &DPadPushButton::clicked, this, &DPadPushButtonGroup::showDPadDialog); addWidget(dpadWidget, 1, 1); - button = buttons->value(JoyDPadButton::DpadRight); - generateBtnForGrid(buttons, button, rightButton, 1, 2); - - button = buttons->value(JoyDPadButton::DpadLeftDown); - generateBtnForGrid(buttons, button, downLeftButton, 2, 0); - - button = buttons->value(JoyDPadButton::DpadDown); - generateBtnForGrid(buttons, button, downButton, 2, 1); - - button = buttons->value(JoyDPadButton::DpadRightDown); - generateBtnForGrid(buttons, button, downRightButton, 2, 2); + rightButton = generateBtnForGrid(buttons, 2, 1, 2); + downLeftButton = generateBtnForGrid(buttons, 12, 2, 0); + downButton = generateBtnForGrid(buttons, 4, 2, 1); + downRightButton = generateBtnForGrid(buttons, 6, 2, 2); } -void DPadPushButtonGroup::generateBtnForGrid(QHash *buttons, JoyDPadButton *button, JoyDPadButtonWidget *pushbutton, int cellRow, int cellCol) +JoyDPadButtonWidget* DPadPushButtonGroup::generateBtnForGrid(QHash *buttons, int dpadDirection, int cellRow, int cellCol) { - button = buttons->value(JoyDPadButton::DpadUp); - upButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = upButton; + JoyDPadButton *button = buttons->value(static_cast(dpadDirection)); + JoyDPadButtonWidget *pushbutton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { openDPadButtonDialog(pushbutton); @@ -92,6 +77,8 @@ void DPadPushButtonGroup::generateBtnForGrid(QHash *buttons button->establishPropertyUpdatedConnections(); connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); addWidget(pushbutton, cellRow, cellCol); + + return pushbutton; } void DPadPushButtonGroup::changeButtonLayout() diff --git a/src/dpadpushbuttongroup.h b/src/dpadpushbuttongroup.h index 15802962..180ab437 100755 --- a/src/dpadpushbuttongroup.h +++ b/src/dpadpushbuttongroup.h @@ -67,7 +67,7 @@ private slots: DPadPushButton *dpadWidget; - void generateBtnForGrid(QHash *buttons, JoyDPadButton *button, JoyDPadButtonWidget *pushbutton, int cellRow, int cellCol); + JoyDPadButtonWidget * generateBtnForGrid(QHash *buttons, int dpadDirection , int cellRow, int cellCol); }; #endif // DPADPUSHBUTTONGROUP_H diff --git a/src/stickpushbuttongroup.cpp b/src/stickpushbuttongroup.cpp index a06ab8f5..58e70b2a 100755 --- a/src/stickpushbuttongroup.cpp +++ b/src/stickpushbuttongroup.cpp @@ -50,23 +50,12 @@ void StickPushButtonGroup::generateButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QHash *stickButtons = stick->getButtons(); + JoyControlStickButtonPushButton *pushbutton = nullptr; - JoyControlStickButton *button = stickButtons->value(JoyControlStick::StickLeftUp); - upLeftButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - JoyControlStickButtonPushButton *pushbutton = upLeftButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 0); - - generateBtnToGrid(pushbutton, upButton, stick, JoyControlStick::StickUp, 0, 1); - generateBtnToGrid(pushbutton, upRightButton, stick, JoyControlStick::StickRightUp, 0, 2); - generateBtnToGrid(pushbutton, leftButton, stick, JoyControlStick::StickLeft, 1, 0); + upLeftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeftUp, 0, 0); + upButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickUp, 0, 1); + upRightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRightUp, 0, 2); + leftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeft, 1, 0); stickWidget = new JoyControlStickPushButton(stick, displayNames, parentWidget()); stickWidget->setIcon(QIcon::fromTheme(QString::fromUtf8("games-config-options"))); @@ -74,17 +63,16 @@ void StickPushButtonGroup::generateButtons() addWidget(stickWidget, 1, 1); - generateBtnToGrid(pushbutton, rightButton, stick, JoyControlStick::StickRight, 1, 2); - generateBtnToGrid(pushbutton, downLeftButton, stick, JoyControlStick::StickLeftDown, 2, 0); - generateBtnToGrid(pushbutton, downButton, stick, JoyControlStick::StickDown, 2, 1); - generateBtnToGrid(pushbutton, downRightButton, stick, JoyControlStick::StickRightDown, 2, 2); + rightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRight, 1, 2); + downLeftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeftDown, 2, 0); + downButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickDown, 2, 1); + downRightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRightDown, 2, 2); } -void StickPushButtonGroup::generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStickButtonPushButton *pushbuttonLocal, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol) +JoyControlStickButtonPushButton* StickPushButtonGroup::generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol) { JoyControlStickButton* button = stick->getButtons()->value(stickValue); - pushbuttonLocal = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = pushbuttonLocal; + pushbutton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { openStickButtonDialog(pushbutton); @@ -94,6 +82,7 @@ void StickPushButtonGroup::generateBtnToGrid(JoyControlStickButtonPushButton *pu connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); addWidget(pushbutton, gridRow, gridCol); + return pushbutton; } void StickPushButtonGroup::changeButtonLayout() diff --git a/src/stickpushbuttongroup.h b/src/stickpushbuttongroup.h index dde8573e..c4e275fc 100755 --- a/src/stickpushbuttongroup.h +++ b/src/stickpushbuttongroup.h @@ -81,7 +81,7 @@ private slots: JoyControlStickPushButton *stickWidget; - void generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStickButtonPushButton *pushbuttonLocal, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol); + JoyControlStickButtonPushButton * generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol); }; #endif // STICKPUSHBUTTONGROUP_H diff --git a/src/uihelpers/buttoneditdialoghelper.cpp b/src/uihelpers/buttoneditdialoghelper.cpp index 1e08b65a..15ea58ab 100755 --- a/src/uihelpers/buttoneditdialoghelper.cpp +++ b/src/uihelpers/buttoneditdialoghelper.cpp @@ -37,8 +37,6 @@ ButtonEditDialogHelper::ButtonEditDialogHelper(QObject *parent) : QObject(parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - - button = nullptr; } void ButtonEditDialogHelper::setAssignedSlot(int code,