Qt: Add 'Memory Card Editor' button to memory card settings

This commit is contained in:
Connor McLaughlin 2021-03-27 17:14:10 +10:00
parent 47ba6e7449
commit 3f7d8604e5
2 changed files with 23 additions and 2 deletions

View File

@ -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->show();
m_memory_card_editor_dialog->activateWindow();
if (!card_a_path.isEmpty())
{

View File

@ -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);
}