mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 18:45:36 +00:00
KBM Gui fixes
This commit is contained in:
parent
4bfd8b967b
commit
b238e62add
@ -144,6 +144,8 @@ tr("Do you want to overwrite existing mappings with the mappings from the Common
|
|||||||
QString SOSString = tr("Speed Offset (def 0.125):") + " " + SOSValue;
|
QString SOSString = tr("Speed Offset (def 0.125):") + " " + SOSValue;
|
||||||
ui->SpeedOffsetLabel->setText(SOSString);
|
ui->SpeedOffsetLabel->setText(SOSString);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(this, &KBMSettings::PushKBMEvent, this, [this]() { CheckMapping(MappingButton); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void KBMSettings::ButtonConnects() {
|
void KBMSettings::ButtonConnects() {
|
||||||
@ -518,7 +520,6 @@ void KBMSettings::StartTimer(QPushButton*& button) {
|
|||||||
MappingTimer = 3;
|
MappingTimer = 3;
|
||||||
EnableMapping = true;
|
EnableMapping = true;
|
||||||
MappingCompleted = false;
|
MappingCompleted = false;
|
||||||
modifier = "";
|
|
||||||
mapping = button->text();
|
mapping = button->text();
|
||||||
|
|
||||||
DisableMappingButtons();
|
DisableMappingButtons();
|
||||||
@ -909,7 +910,6 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
@ -948,41 +948,61 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
|||||||
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
|
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
|
||||||
if (pressedKeys.size() < 3) {
|
if (pressedKeys.size() < 3) {
|
||||||
if (wheelEvent->angleDelta().y() > 5) {
|
if (wheelEvent->angleDelta().y() > 5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) ==
|
||||||
|
AxisList.end()) {
|
||||||
pressedKeys.insert("mousewheelup");
|
pressedKeys.insert("mousewheelup");
|
||||||
|
if (QApplication::keyboardModifiers() == Qt::NoModifier)
|
||||||
|
emit PushKBMEvent();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(
|
||||||
|
this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
}
|
}
|
||||||
} else if (wheelEvent->angleDelta().y() < -5) {
|
} else if (wheelEvent->angleDelta().y() < -5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) ==
|
||||||
|
AxisList.end()) {
|
||||||
pressedKeys.insert("mousewheeldown");
|
pressedKeys.insert("mousewheeldown");
|
||||||
|
if (QApplication::keyboardModifiers() == Qt::NoModifier)
|
||||||
|
emit PushKBMEvent();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(
|
||||||
|
this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wheelEvent->angleDelta().x() > 5) {
|
if (wheelEvent->angleDelta().x() > 5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) ==
|
||||||
|
AxisList.end()) {
|
||||||
// QT changes scrolling to horizontal for all widgets with the alt modifier
|
// QT changes scrolling to horizontal for all widgets with the alt modifier
|
||||||
pressedKeys.insert(
|
pressedKeys.insert(
|
||||||
GetModifiedButton(Qt::AltModifier, "mousewheelup", "mousewheelright"));
|
GetModifiedButton(Qt::AltModifier, "mousewheelup", "mousewheelright"));
|
||||||
|
if (QApplication::keyboardModifiers() == Qt::NoModifier)
|
||||||
|
emit PushKBMEvent();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(
|
||||||
|
this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
}
|
}
|
||||||
} else if (wheelEvent->angleDelta().x() < -5) {
|
} else if (wheelEvent->angleDelta().x() < -5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) ==
|
||||||
|
AxisList.end()) {
|
||||||
pressedKeys.insert(
|
pressedKeys.insert(
|
||||||
GetModifiedButton(Qt::AltModifier, "mousewheeldown", "mousewheelleft"));
|
GetModifiedButton(Qt::AltModifier, "mousewheeldown", "mousewheelleft"));
|
||||||
|
if (QApplication::keyboardModifiers() == Qt::NoModifier)
|
||||||
|
emit PushKBMEvent();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(
|
||||||
|
this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->type() == QEvent::KeyRelease || event->type() == QEvent::MouseButtonRelease)
|
||||||
|
emit PushKBMEvent();
|
||||||
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,9 @@ public:
|
|||||||
explicit KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent = nullptr);
|
explicit KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent = nullptr);
|
||||||
~KBMSettings();
|
~KBMSettings();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void PushKBMEvent();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void SaveKBMConfig(bool CloseOnSave);
|
void SaveKBMConfig(bool CloseOnSave);
|
||||||
void SetDefault();
|
void SetDefault();
|
||||||
@ -50,7 +53,6 @@ private:
|
|||||||
bool MappingCompleted = false;
|
bool MappingCompleted = false;
|
||||||
bool HelpWindowOpen = false;
|
bool HelpWindowOpen = false;
|
||||||
QString mapping;
|
QString mapping;
|
||||||
QString modifier;
|
|
||||||
int MappingTimer;
|
int MappingTimer;
|
||||||
QTimer* timer;
|
QTimer* timer;
|
||||||
QPushButton* MappingButton;
|
QPushButton* MappingButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user