Qt: Fix a couple more missing native separator calls

This commit is contained in:
Stenzek 2024-04-04 16:45:06 +10:00 committed by Connor McLaughlin
parent 7066369887
commit 29a961a407
2 changed files with 12 additions and 7 deletions

View File

@ -40,6 +40,7 @@
#include "common/FileSystem.h"
#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtGui/QCloseEvent>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QInputDialog>
@ -727,7 +728,7 @@ void MainWindow::onToolsVideoCaptureToggled(bool checked)
const QString filter(tr("%1 Files (*.%2)").arg(container.toUpper()).arg(container));
QString path(QStringLiteral("%1.%2").arg(QString::fromStdString(GSGetBaseVideoFilename())).arg(container));
path = QFileDialog::getSaveFileName(this, tr("Video Capture"), path, filter);
path = QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Video Capture"), path, filter));
if (path.isEmpty())
return;
@ -1425,8 +1426,8 @@ void MainWindow::onStartBIOSActionTriggered()
void MainWindow::onChangeDiscFromFileActionTriggered()
{
VMLock lock(pauseAndLockVM());
QString filename =
QFileDialog::getOpenFileName(lock.getDialogParent(), tr("Select Disc Image"), QString(), tr(DISC_IMAGE_FILTER), nullptr);
QString filename = QDir::toNativeSeparators(
QFileDialog::getOpenFileName(lock.getDialogParent(), tr("Select Disc Image"), QString(), tr(DISC_IMAGE_FILTER), nullptr));
if (filename.isEmpty())
return;
@ -2770,7 +2771,8 @@ void MainWindow::populateLoadStateMenu(QMenu* menu, const QString& filename, con
QAction* action = menu->addAction(is_right_click_menu ? tr("Load State File...") : tr("Load From File..."));
connect(action, &QAction::triggered, [this, filename]() {
const QString path(QFileDialog::getOpenFileName(this, tr("Select Save State File"), QString(), tr("Save States (*.p2s *.p2s.backup)")));
const QString path = QDir::toNativeSeparators(QFileDialog::getOpenFileName(this,
tr("Select Save State File"), QString(), tr("Save States (*.p2s *.p2s.backup)")));
if (path.isEmpty())
return;
@ -2840,7 +2842,8 @@ void MainWindow::populateSaveStateMenu(QMenu* menu, const QString& serial, quint
return;
connect(menu->addAction(tr("Save To File...")), &QAction::triggered, [this]() {
const QString path(QFileDialog::getSaveFileName(this, tr("Select Save State File"), QString(), tr("Save States (*.p2s)")));
const QString path = QDir::toNativeSeparators(QFileDialog::getSaveFileName(
this, tr("Select Save State File"), QString(), tr("Save States (*.p2s)")));
if (path.isEmpty())
return;

View File

@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#include "NewInputRecordingDlg.h"
#include "QtUtils.h"
#include <QtCore/QDir>
#include <QtCore/QString>
#include <QtWidgets/QDialog>
#include <QtWidgets/qfiledialog.h>
@ -66,7 +67,8 @@ void NewInputRecordingDlg::onRecordingTypeSaveStateChecked(bool checked)
void NewInputRecordingDlg::onBrowseForPathClicked()
{
QString filter = tr("Input Recording Files (*.p2m2)");
QString filename = QFileDialog::getSaveFileName(this, tr("Select a File"), QString(), filter, &filter);
QString filename = QDir::toNativeSeparators(QFileDialog::getSaveFileName(
this, tr("Select a File"), QString(), filter, &filter));
if (filename.isEmpty())
return;