diff --git a/src/duckstation-qt/cheatmanagerdialog.cpp b/src/duckstation-qt/cheatmanagerdialog.cpp index 80d208561..e2167636d 100644 --- a/src/duckstation-qt/cheatmanagerdialog.cpp +++ b/src/duckstation-qt/cheatmanagerdialog.cpp @@ -191,8 +191,7 @@ void CheatManagerDialog::connectUi() connect(m_ui.scanTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::scanItemChanged); connect(m_ui.watchTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::watchItemChanged); - connect(g_emu_thread, &EmuThread::cheatEnabled, this, - &CheatManagerDialog::setCheatCheckState); + connect(g_emu_thread, &EmuThread::cheatEnabled, this, &CheatManagerDialog::setCheatCheckState); } void CheatManagerDialog::showEvent(QShowEvent* event) @@ -354,8 +353,7 @@ CheatList* CheatManagerDialog::getCheatList() const } if (!list) { - Host::RunOnCPUThread( - []() { System::SetCheatList(std::make_unique()); }, true); + Host::RunOnCPUThread([]() { System::SetCheatList(std::make_unique()); }, true); list = System::GetCheatList(); } @@ -655,7 +653,8 @@ void CheatManagerDialog::importClicked() void CheatManagerDialog::importFromFileTriggered() { const QString filter(tr("PCSXR/Libretro Cheat Files (*.cht *.txt);;All Files (*.*)")); - const QString filename(QFileDialog::getOpenFileName(this, tr("Import Cheats"), QString(), filter)); + const QString filename = + QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, tr("Import Cheats"), QString(), filter)); if (filename.isEmpty()) return; @@ -702,7 +701,8 @@ void CheatManagerDialog::importFromTextTriggered() void CheatManagerDialog::exportClicked() { const QString filter(tr("PCSXR Cheat Files (*.cht);;All Files (*.*)")); - const QString filename(QFileDialog::getSaveFileName(this, tr("Export Cheats"), QString(), filter)); + const QString filename = + QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Export Cheats"), QString(), filter)); if (filename.isEmpty()) return; @@ -748,8 +748,8 @@ void CheatManagerDialog::addToWatchClicked() for (int index = indexFirst; index <= indexLast; index++) { const MemoryScan::Result& res = m_scanner.GetResults()[static_cast(index)]; - m_watch.AddEntry(fmt::format("0x{:08x}", res.address), res.address, m_scanner.GetSize(), - m_scanner.GetValueSigned(), false); + m_watch.AddEntry(fmt::format("0x{:08x}", res.address), res.address, m_scanner.GetSize(), m_scanner.GetValueSigned(), + false); updateWatch(); } } @@ -775,8 +775,8 @@ void CheatManagerDialog::addManualWatchAddressClicked() else if (index == 2 || index == 5) address.value() &= 0xFFFFFFFC; - m_watch.AddEntry(fmt::format("0x{:08x}", address.value()), address.value(), - static_cast(index % 3), (index > 3), false); + m_watch.AddEntry(fmt::format("0x{:08x}", address.value()), address.value(), static_cast(index % 3), + (index > 3), false); updateWatch(); } diff --git a/src/duckstation-qt/controllerbindingwidgets.cpp b/src/duckstation-qt/controllerbindingwidgets.cpp index 10ae99a7e..3e49afb64 100644 --- a/src/duckstation-qt/controllerbindingwidgets.cpp +++ b/src/duckstation-qt/controllerbindingwidgets.cpp @@ -627,7 +627,7 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge QPushButton* browse_button = new QPushButton(tr("Browse..."), this); SettingWidgetBinder::BindWidgetToStringSetting(sif, le, section, std::move(key_name), si.StringDefaultValue()); connect(browse_button, &QPushButton::clicked, [this, le]() { - QString path = QFileDialog::getOpenFileName(this, tr("Select File")); + QString path = QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, tr("Select File"))); if (!path.isEmpty()) le->setText(path); }); diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 614340c54..3d146b786 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -926,12 +926,12 @@ void MainWindow::populateLoadStateMenu(const char* game_serial, QMenu* menu) menu->clear(); connect(menu->addAction(tr("Load From File...")), &QAction::triggered, []() { - const QString path( + const QString path = QDir::toNativeSeparators( QFileDialog::getOpenFileName(g_main_window, tr("Select Save State File"), QString(), tr("Save States (*.sav)"))); if (path.isEmpty()) return; - g_emu_thread->loadState(QDir::toNativeSeparators(path)); + g_emu_thread->loadState(path); }); QAction* load_from_state = menu->addAction(tr("Undo Load State")); load_from_state->setEnabled(System::CanUndoLoadState()); @@ -968,7 +968,7 @@ void MainWindow::populateSaveStateMenu(const char* game_serial, QMenu* menu) if (!System::IsValid()) return; - const QString path( + const QString path = QDir::toNativeSeparators( QFileDialog::getSaveFileName(g_main_window, tr("Select Save State File"), QString(), tr("Save States (*.sav)"))); if (path.isEmpty()) return; @@ -1275,8 +1275,8 @@ void MainWindow::onStartBIOSActionTriggered() void MainWindow::onChangeDiscFromFileActionTriggered() { - QString filename = - QFileDialog::getOpenFileName(this, tr("Select Disc Image"), QString(), tr(DISC_IMAGE_FILTER), nullptr); + QString filename = QDir::toNativeSeparators( + QFileDialog::getOpenFileName(this, tr("Select Disc Image"), QString(), tr(DISC_IMAGE_FILTER), nullptr)); if (filename.isEmpty()) return; @@ -2163,24 +2163,24 @@ void MainWindow::connectSignals() g_emu_thread->stopDumpingAudio(); }); connect(m_ui.actionDumpRAM, &QAction::triggered, [this]() { - const QString filename = - QFileDialog::getSaveFileName(this, tr("Destination File"), QString(), tr("Binary Files (*.bin)")); + const QString filename = QDir::toNativeSeparators( + QFileDialog::getSaveFileName(this, tr("Destination File"), QString(), tr("Binary Files (*.bin)"))); if (filename.isEmpty()) return; g_emu_thread->dumpRAM(filename); }); connect(m_ui.actionDumpVRAM, &QAction::triggered, [this]() { - const QString filename = QFileDialog::getSaveFileName(this, tr("Destination File"), QString(), - tr("Binary Files (*.bin);;PNG Images (*.png)")); + const QString filename = QDir::toNativeSeparators(QFileDialog::getSaveFileName( + this, tr("Destination File"), QString(), tr("Binary Files (*.bin);;PNG Images (*.png)"))); if (filename.isEmpty()) return; g_emu_thread->dumpVRAM(filename); }); connect(m_ui.actionDumpSPURAM, &QAction::triggered, [this]() { - const QString filename = - QFileDialog::getSaveFileName(this, tr("Destination File"), QString(), tr("Binary Files (*.bin)")); + const QString filename = QDir::toNativeSeparators( + QFileDialog::getSaveFileName(this, tr("Destination File"), QString(), tr("Binary Files (*.bin)"))); if (filename.isEmpty()) return; @@ -2319,42 +2319,42 @@ void MainWindow::setStyleFromSettings() qApp->setPalette(darkPalette); } - else if (theme == "cobaltsky") - { - // Custom palette by KamFretoZ, A soothing deep royal blue - // that are meant to be easy on the eyes as the main color. - // Alternative dark theme. - qApp->setStyle(QStyleFactory::create("Fusion")); + else if (theme == "cobaltsky") + { + // Custom palette by KamFretoZ, A soothing deep royal blue + // that are meant to be easy on the eyes as the main color. + // Alternative dark theme. + qApp->setStyle(QStyleFactory::create("Fusion")); - const QColor gray(150, 150, 150); - const QColor royalBlue(29, 41, 81); - const QColor darkishBlue(17, 30, 108); - const QColor lighterBlue(25, 32, 130); - const QColor highlight(36, 93, 218); - const QColor link(0, 202, 255); + const QColor gray(150, 150, 150); + const QColor royalBlue(29, 41, 81); + const QColor darkishBlue(17, 30, 108); + const QColor lighterBlue(25, 32, 130); + const QColor highlight(36, 93, 218); + const QColor link(0, 202, 255); - QPalette darkPalette; - darkPalette.setColor(QPalette::Window, royalBlue); - darkPalette.setColor(QPalette::WindowText, Qt::white); - darkPalette.setColor(QPalette::Base, royalBlue.lighter()); - darkPalette.setColor(QPalette::AlternateBase, darkishBlue); - darkPalette.setColor(QPalette::ToolTipBase, darkishBlue); - darkPalette.setColor(QPalette::ToolTipText, Qt::white); - darkPalette.setColor(QPalette::Text, Qt::white); - darkPalette.setColor(QPalette::Button, lighterBlue); - darkPalette.setColor(QPalette::ButtonText, Qt::white); - darkPalette.setColor(QPalette::Link, link); - darkPalette.setColor(QPalette::Highlight, highlight); - darkPalette.setColor(QPalette::HighlightedText, Qt::white); + QPalette darkPalette; + darkPalette.setColor(QPalette::Window, royalBlue); + darkPalette.setColor(QPalette::WindowText, Qt::white); + darkPalette.setColor(QPalette::Base, royalBlue.lighter()); + darkPalette.setColor(QPalette::AlternateBase, darkishBlue); + darkPalette.setColor(QPalette::ToolTipBase, darkishBlue); + darkPalette.setColor(QPalette::ToolTipText, Qt::white); + darkPalette.setColor(QPalette::Text, Qt::white); + darkPalette.setColor(QPalette::Button, lighterBlue); + darkPalette.setColor(QPalette::ButtonText, Qt::white); + darkPalette.setColor(QPalette::Link, link); + darkPalette.setColor(QPalette::Highlight, highlight); + darkPalette.setColor(QPalette::HighlightedText, Qt::white); - darkPalette.setColor(QPalette::Active, QPalette::Button, lighterBlue); - darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray); - darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray); - darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray); - darkPalette.setColor(QPalette::Disabled, QPalette::Light, gray); + darkPalette.setColor(QPalette::Active, QPalette::Button, lighterBlue); + darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::Light, gray); - qApp->setPalette(darkPalette); - } + qApp->setPalette(darkPalette); + } else if (theme == "greymatter") { qApp->setStyle(QStyleFactory::create("Fusion")); diff --git a/src/duckstation-qt/memorycardeditorwindow.cpp b/src/duckstation-qt/memorycardeditorwindow.cpp index 88a8f21a5..f33cabab7 100644 --- a/src/duckstation-qt/memorycardeditorwindow.cpp +++ b/src/duckstation-qt/memorycardeditorwindow.cpp @@ -510,8 +510,8 @@ void MemoryCardEditorWindow::importCard(Card* card) { promptForSave(card); - QString filename = - QFileDialog::getOpenFileName(this, tr("Select Import File"), QString(), tr(MEMORY_CARD_IMPORT_FILTER)); + QString filename = QDir::toNativeSeparators( + QFileDialog::getOpenFileName(this, tr("Select Import File"), QString(), tr(MEMORY_CARD_IMPORT_FILTER))); if (filename.isEmpty()) return; @@ -556,8 +556,8 @@ void MemoryCardEditorWindow::formatCard(Card* card) void MemoryCardEditorWindow::importSaveFile(Card* card) { - QString filename = - QFileDialog::getOpenFileName(this, tr("Select Import Save File"), QString(), tr(SINGLE_SAVEFILE_FILTER)); + QString filename = QDir::toNativeSeparators( + QFileDialog::getOpenFileName(this, tr("Select Import Save File"), QString(), tr(SINGLE_SAVEFILE_FILTER))); if (filename.isEmpty()) return;