mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 19:44:57 +00:00
cleanup
This commit is contained in:
parent
b2ff9180ea
commit
a0a439cd55
@ -373,28 +373,27 @@ void KBMSettings::SaveKBMConfig(bool CloseOnSave) {
|
|||||||
|
|
||||||
// Prevent duplicate inputs for KBM as this breaks the engine
|
// Prevent duplicate inputs for KBM as this breaks the engine
|
||||||
bool duplicateFound = false;
|
bool duplicateFound = false;
|
||||||
QSet<QString> duplicateInputs;
|
QSet<QString> duplicateMappings;
|
||||||
for (auto it = inputs.begin(); it != inputs.end(); ++it) {
|
for (auto it = inputs.begin(); it != inputs.end(); ++it) {
|
||||||
if (std::find(it + 1, inputs.end(), *it) != inputs.end()) {
|
if (std::find(it + 1, inputs.end(), *it) != inputs.end()) {
|
||||||
duplicateFound = true;
|
duplicateFound = true;
|
||||||
duplicateInputs.insert(QString::fromStdString(*it));
|
duplicateMappings.insert(QString::fromStdString(*it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duplicateFound) {
|
if (duplicateFound) {
|
||||||
QStringList DuplicateButtons;
|
QStringList duplicatesList;
|
||||||
for (QString i : duplicateInputs) {
|
for (const QString mapping : duplicateMappings) {
|
||||||
for (const auto& j : ButtonsList) {
|
for (const auto& button : ButtonsList) {
|
||||||
if (j->text() == i)
|
if (button->text() == mapping)
|
||||||
DuplicateButtons.append(j->objectName() + " - " + i);
|
duplicatesList.append(button->objectName() + " - " + mapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString DuplicateList = DuplicateButtons.join("\n");
|
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
this, tr("Unable to Save"),
|
this, tr("Unable to Save"),
|
||||||
QString(tr("Cannot bind any unique input more than once. "
|
QString(tr("Cannot bind any unique input more than once. "
|
||||||
"Duplicate inputs mapped to the following buttons:\n\n%1")
|
"Duplicate inputs mapped to the following buttons:\n\n%1")
|
||||||
.arg(DuplicateList)));
|
.arg(duplicatesList.join("\n"))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user