From 3f7d8604e58a6efa44766df4ffbd0715bad43cf8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 27 Mar 2021 17:14:10 +1000 Subject: [PATCH] Qt: Add 'Memory Card Editor' button to memory card settings --- src/duckstation-qt/mainwindow.cpp | 5 ++++- .../memorycardsettingswidget.cpp | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index becb7fb7c..569daf1ae 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1477,10 +1477,13 @@ void MainWindow::onCheckForUpdatesActionTriggered() void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString& card_b_path) { if (!m_memory_card_editor_dialog) + { m_memory_card_editor_dialog = new MemoryCardEditorDialog(this); + m_memory_card_editor_dialog->setModal(false); + } - m_memory_card_editor_dialog->setModal(false); m_memory_card_editor_dialog->show(); + m_memory_card_editor_dialog->activateWindow(); if (!card_a_path.isEmpty()) { diff --git a/src/duckstation-qt/memorycardsettingswidget.cpp b/src/duckstation-qt/memorycardsettingswidget.cpp index 7895498a9..2dfb191e8 100644 --- a/src/duckstation-qt/memorycardsettingswidget.cpp +++ b/src/duckstation-qt/memorycardsettingswidget.cpp @@ -3,6 +3,7 @@ #include "core/controller.h" #include "core/settings.h" #include "inputbindingwidgets.h" +#include "mainwindow.h" #include "qthostinterface.h" #include "qtutils.h" #include "settingsdialog.h" @@ -73,6 +74,8 @@ void MemoryCardSettingsWidget::createUi(SettingsDialog* dialog) tr("When using a multi-disc format (m3u/pbp) and per-game (title) memory cards, a single memory card " "will be used for all discs. If unchecked, a separate card will be used for each disc.")); + box_layout->addWidget(QtUtils::CreateHorizontalLine(box)); + { QHBoxLayout* note_layout = new QHBoxLayout(); @@ -83,12 +86,27 @@ void MemoryCardSettingsWidget::createUi(SettingsDialog* dialog) note_label->setWordWrap(true); note_layout->addWidget(note_label, 1); - QPushButton* open_memcards = new QPushButton(tr("Open..."), box); + QPushButton* open_memcards = new QPushButton(tr("Open Directory..."), box); connect(open_memcards, &QPushButton::clicked, this, &MemoryCardSettingsWidget::onOpenMemCardsDirectoryClicked); note_layout->addWidget(open_memcards); box_layout->addLayout(note_layout); } + { + QHBoxLayout* hbox = new QHBoxLayout(); + QLabel* label = new QLabel( + tr("The memory card editor enables you to move saves between cards, as well as import cards of other formats."), + box); + label->setWordWrap(true); + hbox->addWidget(label, 1); + + QPushButton* button = new QPushButton(tr("Memory Card Editor..."), box); + connect(button, &QPushButton::clicked, + []() { QtHostInterface::GetInstance()->getMainWindow()->openMemoryCardEditor(QString(), QString()); }); + hbox->addWidget(button); + box_layout->addLayout(hbox); + } + layout->addWidget(box); }