mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
launcher: report cheat file save failures (#669)
PatchesDialog::Save silently ignored QSaveFile failures, leaving the status label showing the old "Loaded N cheat(s)" text so the user could not tell that their selection was not saved. Report the failure in the status label and the log instead.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -129,8 +130,11 @@ void PatchesDialog::Save() {
|
|||||||
document.setObject(root);
|
document.setObject(root);
|
||||||
|
|
||||||
QSaveFile output(path);
|
QSaveFile output(path);
|
||||||
if (output.open(QIODevice::WriteOnly) && output.write(document.toJson()) >= 0 &&
|
if (!output.open(QIODevice::WriteOnly) || output.write(document.toJson()) < 0 ||
|
||||||
output.commit()) {
|
!output.commit()) {
|
||||||
m_status->setText(tr("Cheat selection saved."));
|
qWarning() << "Could not save cheat file:" << output.errorString();
|
||||||
|
m_status->setText(tr("Could not save cheat file: %1").arg(output.errorString()));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
m_status->setText(tr("Cheat selection saved."));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user