Qt: Add refresh button to controller editing

This commit is contained in:
Jeffrey Pfau 2016-05-30 15:26:54 -07:00
parent 1d021a72c7
commit 66345e9b7e
3 changed files with 24 additions and 11 deletions

View File

@ -45,6 +45,7 @@ Misc:
- ARM7: Flush prefetch cache when loading CPSR via MSR
- Qt: Canonicalize file paths when loading games
- OpenGL: Add texSize uniform
- Qt: Add refresh button to controller editing
0.4.0: (2016-02-02)
Features:

View File

@ -57,20 +57,11 @@ GBAKeyEditor::GBAKeyEditor(InputController* controller, int type, const QString&
#ifdef BUILD_SDL
if (type == SDL_BINDING_BUTTON) {
controller->updateJoysticks();
controller->recalibrateAxes();
lookupAxes(map);
m_profileSelect = new QComboBox(this);
m_profileSelect->addItems(controller->connectedGamepads(type));
int activeGamepad = controller->gamepad(type);
selectGamepad(activeGamepad);
if (activeGamepad > 0) {
m_profileSelect->setCurrentIndex(activeGamepad);
}
connect(m_profileSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGamepad(int)));
updateJoysticks();
m_clear = new QWidget(this);
QHBoxLayout* layout = new QHBoxLayout;
m_clear->setLayout(layout);
@ -97,6 +88,10 @@ GBAKeyEditor::GBAKeyEditor(InputController* controller, int type, const QString&
(*m_currentKey)->clearAxis();
(*m_currentKey)->blockSignals(signalsBlocked);
});
QPushButton* updateJoysticksButton = new QPushButton(tr("Refresh"));
layout->addWidget(updateJoysticksButton);
connect(updateJoysticksButton, SIGNAL(pressed()), this, SLOT(updateJoysticks()));
}
#endif
@ -355,3 +350,19 @@ void GBAKeyEditor::setLocation(QWidget* widget, qreal x, qreal y) {
widget->setGeometry(s.width() * x - hint.width() / 2.0, s.height() * y - hint.height() / 2.0, hint.width(),
hint.height());
}
#ifdef BUILD_SDL
void GBAKeyEditor::updateJoysticks() {
m_controller->updateJoysticks();
m_controller->recalibrateAxes();
m_profileSelect->clear();
m_profileSelect->addItems(m_controller->connectedGamepads(m_type));
int activeGamepad = m_controller->gamepad(m_type);
selectGamepad(activeGamepad);
if (activeGamepad > 0) {
m_profileSelect->setCurrentIndex(activeGamepad);
}
lookupAxes(m_controller->map());
}
#endif

View File

@ -47,6 +47,7 @@ private slots:
#ifdef BUILD_SDL
void setAxisValue(int axis, int32_t value);
void selectGamepad(int index);
void updateJoysticks();
#endif
private: