Qt: Fix QFileDialog usage in NewInputRecordingDlg

This commit is contained in:
Stenzek 2023-10-25 22:29:40 +10:00 committed by Connor McLaughlin
parent af07ee9abb
commit 3878e94253
1 changed files with 8 additions and 16 deletions

View File

@ -79,23 +79,15 @@ void NewInputRecordingDlg::onRecordingTypeSaveStateChecked(bool checked)
void NewInputRecordingDlg::onBrowseForPathClicked()
{
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setWindowTitle("Select a File");
dialog.setNameFilter(tr("Input Recording Files (*.p2m2)"));
dialog.setDefaultSuffix("p2m2");
QStringList fileNames;
if (dialog.exec())
{
fileNames = dialog.selectedFiles();
}
if (fileNames.length() > 0)
{
m_filePath = fileNames.first();
QString filter = tr("Input Recording Files (*.p2m2)");
QString filename = QFileDialog::getSaveFileName(this, tr("Select a File"), QString(), filter, &filter);
if (filename.isEmpty())
return;
m_filePath = std::move(filename);
m_ui.m_filePathInput->setText(m_filePath);
updateFormStatus();
}
}
void NewInputRecordingDlg::onAuthorNameChanged(const QString& text)
{