input-rec: Display message when we fail to create/open file

This commit is contained in:
TheLastRar 2024-06-07 13:00:35 +01:00 committed by Connor McLaughlin
parent a95288946c
commit 7878dee32d
2 changed files with 18 additions and 1 deletions

View File

@ -1748,6 +1748,12 @@ void MainWindow::onInputRecNewActionTriggered()
m_ui.actionToolbarReset->setEnabled(!g_InputRecording.isTypeSavestate());
});
}
else
{
Host::ReportErrorAsync(
TRANSLATE_SV("MainWindow", "Input Recording Failed"),
fmt::format(TRANSLATE_FS("MainWindow", "Failed to create file: {}"), filePath));
}
});
}
@ -1801,6 +1807,12 @@ void MainWindow::onInputRecPlayActionTriggered()
m_ui.actionToolbarReset->setEnabled(!g_InputRecording.isTypeSavestate());
});
}
else
{
Host::ReportErrorAsync(
TRANSLATE_SV("MainWindow", "Input Playback Failed"),
fmt::format(TRANSLATE_FS("MainWindow", "Failed to open file: {}"), filename));
}
});
}
}

View File

@ -7,6 +7,7 @@
#include <QtCore/QDir>
#include <QtCore/QString>
#include <QtWidgets/QDialog>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/qfiledialog.h>
// TODO - for now this uses a very naive implementation that fills the entire table
@ -96,7 +97,11 @@ void InputRecordingViewer::openFile()
if (m_file_open)
{
loadTable();
} // TODO else error
}
else
{
QMessageBox::critical(this, tr("Opening Recording Failed"), tr("Failed to open file: %1").arg(QString::fromUtf8(fileName.c_str())));
}
}
}