mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 18:46:06 +00:00
Fix delete cheats button (#1731)
This commit is contained in:
parent
00543fe640
commit
ea8ad35947
|
@ -955,15 +955,33 @@ void CheatsPatches::createFilesJson(const QString& repository) {
|
||||||
jsonFile.close();
|
jsonFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatsPatches::addCheatsToLayout(const QJsonArray& modsArray, const QJsonArray& creditsArray) {
|
void CheatsPatches::clearListCheats() {
|
||||||
QLayoutItem* item;
|
QLayoutItem* item;
|
||||||
while ((item = rightLayout->takeAt(0)) != nullptr) {
|
while ((item = rightLayout->takeAt(0)) != nullptr) {
|
||||||
delete item->widget();
|
QWidget* widget = item->widget();
|
||||||
delete item;
|
if (widget) {
|
||||||
|
delete widget;
|
||||||
|
} else {
|
||||||
|
QLayout* layout = item->layout();
|
||||||
|
if (layout) {
|
||||||
|
QLayoutItem* innerItem;
|
||||||
|
while ((innerItem = layout->takeAt(0)) != nullptr) {
|
||||||
|
QWidget* innerWidget = innerItem->widget();
|
||||||
|
if (innerWidget) {
|
||||||
|
delete innerWidget;
|
||||||
|
}
|
||||||
|
delete innerItem;
|
||||||
|
}
|
||||||
|
delete layout;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_cheats.clear();
|
m_cheats.clear();
|
||||||
m_cheatCheckBoxes.clear();
|
m_cheatCheckBoxes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheatsPatches::addCheatsToLayout(const QJsonArray& modsArray, const QJsonArray& creditsArray) {
|
||||||
|
clearListCheats();
|
||||||
int maxWidthButton = 0;
|
int maxWidthButton = 0;
|
||||||
|
|
||||||
for (const QJsonValue& modValue : modsArray) {
|
for (const QJsonValue& modValue : modsArray) {
|
||||||
|
@ -1056,6 +1074,8 @@ void CheatsPatches::addCheatsToLayout(const QJsonArray& modsArray, const QJsonAr
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatsPatches::populateFileListCheats() {
|
void CheatsPatches::populateFileListCheats() {
|
||||||
|
clearListCheats();
|
||||||
|
|
||||||
QString cheatsDir;
|
QString cheatsDir;
|
||||||
Common::FS::PathToQString(cheatsDir, Common::FS::GetUserPath(Common::FS::PathType::CheatsDir));
|
Common::FS::PathToQString(cheatsDir, Common::FS::GetUserPath(Common::FS::PathType::CheatsDir));
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
const QString& m_gameVersion, bool showMessageBox);
|
const QString& m_gameVersion, bool showMessageBox);
|
||||||
void downloadPatches(const QString repository, const bool showMessageBox);
|
void downloadPatches(const QString repository, const bool showMessageBox);
|
||||||
void createFilesJson(const QString& repository);
|
void createFilesJson(const QString& repository);
|
||||||
|
void clearListCheats();
|
||||||
void compatibleVersionNotice(const QString repository);
|
void compatibleVersionNotice(const QString repository);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Reference in a new issue