mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-22 04:24:44 +00:00
fix warnings in cheats_patches.cpp
This commit is contained in:
parent
34f6e05d49
commit
df3da50ea6
1 changed files with 15 additions and 14 deletions
|
@ -147,13 +147,13 @@ void CheatsPatches::setupUI() {
|
|||
controlLayout->addWidget(downloadComboBox);
|
||||
|
||||
QPushButton* downloadButton = new QPushButton(tr("Download Cheats"));
|
||||
connect(downloadButton, &QPushButton::clicked, [=]() {
|
||||
connect(downloadButton, &QPushButton::clicked, [this, downloadComboBox]() {
|
||||
QString source = downloadComboBox->currentData().toString();
|
||||
downloadCheats(source, m_gameSerial, m_gameVersion, true);
|
||||
});
|
||||
|
||||
QPushButton* deleteCheatButton = new QPushButton(tr("Delete File"));
|
||||
connect(deleteCheatButton, &QPushButton::clicked, [=]() {
|
||||
connect(deleteCheatButton, &QPushButton::clicked, [this, CHEATS_DIR_QString]() {
|
||||
QStringListModel* model = qobject_cast<QStringListModel*>(listView_selectFile->model());
|
||||
if (!model) {
|
||||
return;
|
||||
|
@ -232,7 +232,7 @@ void CheatsPatches::setupUI() {
|
|||
patchesControlLayout->addWidget(patchesComboBox);
|
||||
|
||||
QPushButton* patchesButton = new QPushButton(tr("Download Patches"));
|
||||
connect(patchesButton, &QPushButton::clicked, [=]() {
|
||||
connect(patchesButton, &QPushButton::clicked, [this]() {
|
||||
QString selectedOption = patchesComboBox->currentData().toString();
|
||||
downloadPatches(selectedOption, true);
|
||||
});
|
||||
|
@ -444,8 +444,8 @@ QCheckBox* CheatsPatches::findCheckBoxByName(const QString& name) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void CheatsPatches::downloadCheats(const QString& source, const QString& m_gameSerial,
|
||||
const QString& m_gameVersion, const bool showMessageBox) {
|
||||
void CheatsPatches::downloadCheats(const QString& source, const QString& gameSerial,
|
||||
const QString& gameVersion, const bool showMessageBox) {
|
||||
QDir dir(Common::FS::GetUserPath(Common::FS::PathType::CheatsDir));
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(".");
|
||||
|
@ -455,7 +455,7 @@ void CheatsPatches::downloadCheats(const QString& source, const QString& m_gameS
|
|||
if (source == "GoldHEN") {
|
||||
url = "https://raw.githubusercontent.com/GoldHEN/GoldHEN_Cheat_Repository/main/json.txt";
|
||||
} else if (source == "wolf2022") {
|
||||
url = "https://wolf2022.ir/trainer/" + m_gameSerial + "_" + m_gameVersion + ".json";
|
||||
url = "https://wolf2022.ir/trainer/" + gameSerial + "_" + gameVersion + ".json";
|
||||
} else if (source == "shadPS4") {
|
||||
url = "https://raw.githubusercontent.com/shadps4-emu/ps4_cheats/main/"
|
||||
"CHEATS_JSON.txt";
|
||||
|
@ -468,7 +468,7 @@ void CheatsPatches::downloadCheats(const QString& source, const QString& m_gameS
|
|||
QNetworkRequest request(url);
|
||||
QNetworkReply* reply = manager->get(request);
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [=]() {
|
||||
connect(reply, &QNetworkReply::finished, [=, this]() {
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
QByteArray jsonData = reply->readAll();
|
||||
bool foundFiles = false;
|
||||
|
@ -476,7 +476,7 @@ void CheatsPatches::downloadCheats(const QString& source, const QString& m_gameS
|
|||
if (source == "GoldHEN" || source == "shadPS4") {
|
||||
QString textContent(jsonData);
|
||||
QRegularExpression regex(
|
||||
QString("%1_%2[^=]*\.json").arg(m_gameSerial).arg(m_gameVersion));
|
||||
QString("%1_%2[^=]*\\.json").arg(gameSerial).arg(gameVersion));
|
||||
QRegularExpressionMatchIterator matches = regex.globalMatch(textContent);
|
||||
QString baseUrl;
|
||||
|
||||
|
@ -519,7 +519,7 @@ void CheatsPatches::downloadCheats(const QString& source, const QString& m_gameS
|
|||
QNetworkRequest fileRequest(fileUrl);
|
||||
QNetworkReply* fileReply = manager->get(fileRequest);
|
||||
|
||||
connect(fileReply, &QNetworkReply::finished, [=]() {
|
||||
connect(fileReply, &QNetworkReply::finished, [=, this]() {
|
||||
if (fileReply->error() == QNetworkReply::NoError) {
|
||||
QByteArray fileData = fileReply->readAll();
|
||||
QFile localFile(localFilePath);
|
||||
|
@ -680,7 +680,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes
|
|||
QNetworkRequest request(url);
|
||||
QNetworkReply* reply = manager->get(request);
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [=]() {
|
||||
connect(reply, &QNetworkReply::finished, [=, this]() {
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
QByteArray htmlData = reply->readAll();
|
||||
reply->deleteLater();
|
||||
|
@ -725,7 +725,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes
|
|||
QNetworkRequest fileRequest(fileUrl);
|
||||
QNetworkReply* fileReply = manager->get(fileRequest);
|
||||
|
||||
connect(fileReply, &QNetworkReply::finished, [=]() {
|
||||
connect(fileReply, &QNetworkReply::finished, [=, this]() {
|
||||
if (fileReply->error() == QNetworkReply::NoError) {
|
||||
QByteArray fileData = fileReply->readAll();
|
||||
QFile localFile(dir.filePath(fileName));
|
||||
|
@ -864,7 +864,7 @@ void CheatsPatches::addCheatsToLayout(const QJsonArray& modsArray, const QJsonAr
|
|||
rightLayout->addWidget(cheatCheckBox);
|
||||
m_cheatCheckBoxes.append(cheatCheckBox);
|
||||
connect(cheatCheckBox, &QCheckBox::toggled,
|
||||
[=](bool checked) { applyCheat(modName, checked); });
|
||||
[this, modName](bool checked) { applyCheat(modName, checked); });
|
||||
} else if (modType == "button") {
|
||||
QPushButton* cheatButton = new QPushButton(modName);
|
||||
cheatButton->adjustSize();
|
||||
|
@ -880,7 +880,8 @@ void CheatsPatches::addCheatsToLayout(const QJsonArray& modsArray, const QJsonAr
|
|||
buttonLayout->addStretch();
|
||||
|
||||
rightLayout->addLayout(buttonLayout);
|
||||
connect(cheatButton, &QPushButton::clicked, [=]() { applyCheat(modName, true); });
|
||||
connect(cheatButton, &QPushButton::clicked,
|
||||
[this, modName]() { applyCheat(modName, true); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1094,7 @@ void CheatsPatches::addPatchesToLayout(const QString& filePath) {
|
|||
patchCheckBox->installEventFilter(this);
|
||||
|
||||
connect(patchCheckBox, &QCheckBox::toggled,
|
||||
[=](bool checked) { applyPatch(patchName, checked); });
|
||||
[this, patchName](bool checked) { applyPatch(patchName, checked); });
|
||||
|
||||
patchName.clear();
|
||||
patchAuthor.clear();
|
||||
|
|
Loading…
Add table
Reference in a new issue