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