Qt: De-dialogify memory card editor
This commit is contained in:
parent
eab9f57a5d
commit
03592e8de8
|
@ -116,9 +116,9 @@ set(SRCS
|
|||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
memorycardeditordialog.cpp
|
||||
memorycardeditordialog.h
|
||||
memorycardeditordialog.ui
|
||||
memorycardeditorwindow.cpp
|
||||
memorycardeditorwindow.h
|
||||
memorycardeditorwindow.ui
|
||||
memorycardsettingswidget.cpp
|
||||
memorycardsettingswidget.h
|
||||
memoryviewwidget.cpp
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<ClCompile Include="gdbserver.cpp" />
|
||||
<ClCompile Include="mainwindow.cpp" />
|
||||
<ClCompile Include="memorycardsettingswidget.cpp" />
|
||||
<ClCompile Include="memorycardeditordialog.cpp" />
|
||||
<ClCompile Include="memorycardeditorwindow.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
|
@ -64,7 +64,7 @@
|
|||
<QtMoc Include="coverdownloaddialog.h" />
|
||||
<QtMoc Include="enhancementsettingswidget.h" />
|
||||
<QtMoc Include="memorycardsettingswidget.h" />
|
||||
<QtMoc Include="memorycardeditordialog.h" />
|
||||
<QtMoc Include="memorycardeditorwindow.h" />
|
||||
<QtMoc Include="displaywidget.h" />
|
||||
<QtMoc Include="generalsettingswidget.h" />
|
||||
<QtMoc Include="displaysettingswidget.h" />
|
||||
|
@ -146,7 +146,7 @@
|
|||
<QtUi Include="postprocessingsettingswidget.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
<QtUi Include="memorycardeditordialog.ui">
|
||||
<QtUi Include="memorycardeditorwindow.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
<QtUi Include="cheatmanagerdialog.ui">
|
||||
|
@ -263,7 +263,7 @@
|
|||
<ClCompile Include="$(IntDir)moc_logwindow.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_mainwindow.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_memorycardsettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_memorycardeditordialog.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_memorycardeditorwindow.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_memoryviewwidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_postprocessingsettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_qthost.cpp" />
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<ClCompile Include="biossettingswidget.cpp" />
|
||||
<ClCompile Include="enhancementsettingswidget.cpp" />
|
||||
<ClCompile Include="displaysettingswidget.cpp" />
|
||||
<ClCompile Include="memorycardeditordialog.cpp" />
|
||||
<ClCompile Include="memorycardeditorwindow.cpp" />
|
||||
<ClCompile Include="postprocessingsettingswidget.cpp" />
|
||||
<ClCompile Include="cheatmanagerdialog.cpp" />
|
||||
<ClCompile Include="cheatcodeeditordialog.cpp" />
|
||||
|
@ -162,7 +162,7 @@
|
|||
<ClCompile Include="$(IntDir)moc_mainwindow.cpp">
|
||||
<Filter>moc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(IntDir)moc_memorycardeditordialog.cpp">
|
||||
<ClCompile Include="$(IntDir)moc_memorycardeditorwindow.cpp">
|
||||
<Filter>moc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(IntDir)moc_memorycardsettingswidget.cpp">
|
||||
|
@ -229,7 +229,7 @@
|
|||
<QtMoc Include="autoupdaterdialog.h" />
|
||||
<QtMoc Include="biossettingswidget.h" />
|
||||
<QtMoc Include="enhancementsettingswidget.h" />
|
||||
<QtMoc Include="memorycardeditordialog.h" />
|
||||
<QtMoc Include="memorycardeditorwindow.h" />
|
||||
<QtMoc Include="displaysettingswidget.h" />
|
||||
<QtMoc Include="postprocessingsettingswidget.h" />
|
||||
<QtMoc Include="cheatmanagerdialog.h" />
|
||||
|
@ -267,7 +267,7 @@
|
|||
<QtUi Include="enhancementsettingswidget.ui" />
|
||||
<QtUi Include="displaysettingswidget.ui" />
|
||||
<QtUi Include="postprocessingsettingswidget.ui" />
|
||||
<QtUi Include="memorycardeditordialog.ui" />
|
||||
<QtUi Include="memorycardeditorwindow.ui" />
|
||||
<QtUi Include="cheatmanagerdialog.ui" />
|
||||
<QtUi Include="cheatcodeeditordialog.ui" />
|
||||
<QtUi Include="emulationsettingswidget.ui" />
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gamelistwidget.h"
|
||||
#include "generalsettingswidget.h"
|
||||
#include "logwindow.h"
|
||||
#include "memorycardeditordialog.h"
|
||||
#include "memorycardeditorwindow.h"
|
||||
#include "qthost.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingswindow.h"
|
||||
|
@ -740,6 +740,13 @@ void MainWindow::destroySubWindows()
|
|||
m_debugger_window = nullptr;
|
||||
}
|
||||
|
||||
if (m_memory_card_editor_window)
|
||||
{
|
||||
m_memory_card_editor_window->close();
|
||||
m_memory_card_editor_window->deleteLater();
|
||||
m_memory_card_editor_window = nullptr;
|
||||
}
|
||||
|
||||
if (m_controller_settings_window)
|
||||
{
|
||||
m_controller_settings_window->close();
|
||||
|
@ -2342,6 +2349,7 @@ void MainWindow::doSettings(const char* category /* = nullptr */)
|
|||
else
|
||||
{
|
||||
dlg->raise();
|
||||
dlg->activateWindow();
|
||||
dlg->setFocus();
|
||||
}
|
||||
|
||||
|
@ -2362,6 +2370,7 @@ void MainWindow::doControllerSettings(
|
|||
else
|
||||
{
|
||||
m_controller_settings_window->raise();
|
||||
m_controller_settings_window->activateWindow();
|
||||
m_controller_settings_window->setFocus();
|
||||
}
|
||||
|
||||
|
@ -2682,25 +2691,26 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
|
|||
tr("Memory card '%1' does not exist. Do you want to create an empty memory card?").arg(card_path),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
if (!MemoryCardEditorDialog::createMemoryCard(card_path))
|
||||
if (!MemoryCardEditorWindow::createMemoryCard(card_path))
|
||||
QMessageBox::critical(this, tr("Memory Card Not Found"),
|
||||
tr("Failed to create memory card '%1'").arg(card_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_memory_card_editor_dialog)
|
||||
if (!m_memory_card_editor_window)
|
||||
{
|
||||
m_memory_card_editor_dialog = new MemoryCardEditorDialog(this);
|
||||
m_memory_card_editor_dialog->setModal(false);
|
||||
m_memory_card_editor_window = new MemoryCardEditorWindow();
|
||||
m_memory_card_editor_window->show();
|
||||
}
|
||||
|
||||
m_memory_card_editor_dialog->show();
|
||||
m_memory_card_editor_dialog->activateWindow();
|
||||
m_memory_card_editor_window->raise();
|
||||
m_memory_card_editor_window->activateWindow();
|
||||
m_memory_card_editor_window->setFocus();
|
||||
|
||||
if (!card_a_path.isEmpty())
|
||||
{
|
||||
if (!m_memory_card_editor_dialog->setCardA(card_a_path))
|
||||
if (!m_memory_card_editor_window->setCardA(card_a_path))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this, tr("Memory Card Not Found"),
|
||||
|
@ -2709,7 +2719,7 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
|
|||
}
|
||||
if (!card_b_path.isEmpty())
|
||||
{
|
||||
if (!m_memory_card_editor_dialog->setCardB(card_b_path))
|
||||
if (!m_memory_card_editor_window->setCardB(card_b_path))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this, tr("Memory Card Not Found"),
|
||||
|
|
|
@ -27,7 +27,7 @@ class QProgressBar;
|
|||
class GameListWidget;
|
||||
class EmuThread;
|
||||
class AutoUpdaterDialog;
|
||||
class MemoryCardEditorDialog;
|
||||
class MemoryCardEditorWindow;
|
||||
class CheatManagerDialog;
|
||||
class DebuggerWindow;
|
||||
class MainWindow;
|
||||
|
@ -284,7 +284,7 @@ private:
|
|||
ControllerSettingsWindow* m_controller_settings_window = nullptr;
|
||||
|
||||
AutoUpdaterDialog* m_auto_updater_dialog = nullptr;
|
||||
MemoryCardEditorDialog* m_memory_card_editor_dialog = nullptr;
|
||||
MemoryCardEditorWindow* m_memory_card_editor_window = nullptr;
|
||||
CheatManagerDialog* m_cheat_manager_dialog = nullptr;
|
||||
DebuggerWindow* m_debugger_window = nullptr;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "memorycardeditordialog.h"
|
||||
#include "memorycardeditorwindow.h"
|
||||
#include "common/file_system.h"
|
||||
#include "common/path.h"
|
||||
#include "common/string_util.h"
|
||||
|
@ -19,7 +19,7 @@ static constexpr char MEMORY_CARD_IMPORT_FILTER[] =
|
|||
static constexpr char SINGLE_SAVEFILE_FILTER[] =
|
||||
TRANSLATE_NOOP("MemoryCardEditorDialog", "Single Save Files (*.mcs);;All Files (*.*)");
|
||||
|
||||
MemoryCardEditorDialog::MemoryCardEditorDialog(QWidget* parent) : QDialog(parent)
|
||||
MemoryCardEditorWindow::MemoryCardEditorWindow() : QWidget()
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
@ -53,9 +53,9 @@ MemoryCardEditorDialog::MemoryCardEditorDialog(QWidget* parent) : QDialog(parent
|
|||
m_ui.openCardB->setToolTip(open_card_hover_text);
|
||||
}
|
||||
|
||||
MemoryCardEditorDialog::~MemoryCardEditorDialog() = default;
|
||||
MemoryCardEditorWindow::~MemoryCardEditorWindow() = default;
|
||||
|
||||
bool MemoryCardEditorDialog::setCardA(const QString& path)
|
||||
bool MemoryCardEditorWindow::setCardA(const QString& path)
|
||||
{
|
||||
int index = m_ui.cardAPath->findData(QVariant(QDir::toNativeSeparators(path)));
|
||||
if (index < 0)
|
||||
|
@ -73,7 +73,7 @@ bool MemoryCardEditorDialog::setCardA(const QString& path)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MemoryCardEditorDialog::setCardB(const QString& path)
|
||||
bool MemoryCardEditorWindow::setCardB(const QString& path)
|
||||
{
|
||||
int index = m_ui.cardBPath->findData(QVariant(QDir::toNativeSeparators(path)));
|
||||
if (index < 0)
|
||||
|
@ -91,7 +91,7 @@ bool MemoryCardEditorDialog::setCardB(const QString& path)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MemoryCardEditorDialog::createMemoryCard(const QString& path)
|
||||
bool MemoryCardEditorWindow::createMemoryCard(const QString& path)
|
||||
{
|
||||
MemoryCardImage::DataArray data;
|
||||
MemoryCardImage::Format(&data);
|
||||
|
@ -99,19 +99,19 @@ bool MemoryCardEditorDialog::createMemoryCard(const QString& path)
|
|||
return MemoryCardImage::SaveToFile(data, path.toUtf8().constData());
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::resizeEvent(QResizeEvent* ev)
|
||||
void MemoryCardEditorWindow::resizeEvent(QResizeEvent* ev)
|
||||
{
|
||||
QtUtils::ResizeColumnsForTableView(m_card_a.table, {32, -1, 155, 45});
|
||||
QtUtils::ResizeColumnsForTableView(m_card_b.table, {32, -1, 155, 45});
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::closeEvent(QCloseEvent* ev)
|
||||
void MemoryCardEditorWindow::closeEvent(QCloseEvent* ev)
|
||||
{
|
||||
m_card_a.path_cb->setCurrentIndex(0);
|
||||
m_card_b.path_cb->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::createCardButtons(Card* card, QDialogButtonBox* buttonBox)
|
||||
void MemoryCardEditorWindow::createCardButtons(Card* card, QDialogButtonBox* buttonBox)
|
||||
{
|
||||
card->format_button = buttonBox->addButton(tr("Format Card"), QDialogButtonBox::ActionRole);
|
||||
card->import_file_button = buttonBox->addButton(tr("Import File..."), QDialogButtonBox::ActionRole);
|
||||
|
@ -119,7 +119,7 @@ void MemoryCardEditorDialog::createCardButtons(Card* card, QDialogButtonBox* but
|
|||
card->save_button = buttonBox->addButton(tr("Save"), QDialogButtonBox::ActionRole);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::connectCardUi(Card* card, QDialogButtonBox* buttonBox)
|
||||
void MemoryCardEditorWindow::connectCardUi(Card* card, QDialogButtonBox* buttonBox)
|
||||
{
|
||||
connect(card->save_button, &QPushButton::clicked, [this, card] { saveCard(card); });
|
||||
connect(card->format_button, &QPushButton::clicked, [this, card] { formatCard(card); });
|
||||
|
@ -127,14 +127,14 @@ void MemoryCardEditorDialog::connectCardUi(Card* card, QDialogButtonBox* buttonB
|
|||
connect(card->import_button, &QPushButton::clicked, [this, card] { importCard(card); });
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::connectUi()
|
||||
void MemoryCardEditorWindow::connectUi()
|
||||
{
|
||||
connect(m_ui.cardA, &QTableWidget::itemSelectionChanged, this, &MemoryCardEditorDialog::onCardASelectionChanged);
|
||||
connect(m_ui.cardB, &QTableWidget::itemSelectionChanged, this, &MemoryCardEditorDialog::onCardBSelectionChanged);
|
||||
connect(m_moveLeft, &QPushButton::clicked, this, &MemoryCardEditorDialog::doCopyFile);
|
||||
connect(m_moveRight, &QPushButton::clicked, this, &MemoryCardEditorDialog::doCopyFile);
|
||||
connect(m_deleteFile, &QPushButton::clicked, this, &MemoryCardEditorDialog::doDeleteFile);
|
||||
connect(m_undeleteFile, &QPushButton::clicked, this, &MemoryCardEditorDialog::doUndeleteFile);
|
||||
connect(m_ui.cardA, &QTableWidget::itemSelectionChanged, this, &MemoryCardEditorWindow::onCardASelectionChanged);
|
||||
connect(m_ui.cardB, &QTableWidget::itemSelectionChanged, this, &MemoryCardEditorWindow::onCardBSelectionChanged);
|
||||
connect(m_moveLeft, &QPushButton::clicked, this, &MemoryCardEditorWindow::doCopyFile);
|
||||
connect(m_moveRight, &QPushButton::clicked, this, &MemoryCardEditorWindow::doCopyFile);
|
||||
connect(m_deleteFile, &QPushButton::clicked, this, &MemoryCardEditorWindow::doDeleteFile);
|
||||
connect(m_undeleteFile, &QPushButton::clicked, this, &MemoryCardEditorWindow::doUndeleteFile);
|
||||
|
||||
connect(m_ui.cardAPath, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this](int index) { loadCardFromComboBox(&m_card_a, index); });
|
||||
|
@ -144,10 +144,10 @@ void MemoryCardEditorDialog::connectUi()
|
|||
connect(m_ui.newCardB, &QPushButton::clicked, [this]() { newCard(&m_card_b); });
|
||||
connect(m_ui.openCardA, &QPushButton::clicked, [this]() { openCard(&m_card_a); });
|
||||
connect(m_ui.openCardB, &QPushButton::clicked, [this]() { openCard(&m_card_b); });
|
||||
connect(m_exportFile, &QPushButton::clicked, this, &MemoryCardEditorDialog::doExportSaveFile);
|
||||
connect(m_exportFile, &QPushButton::clicked, this, &MemoryCardEditorWindow::doExportSaveFile);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::populateComboBox(QComboBox* cb)
|
||||
void MemoryCardEditorWindow::populateComboBox(QComboBox* cb)
|
||||
{
|
||||
QSignalBlocker sb(cb);
|
||||
|
||||
|
@ -169,12 +169,12 @@ void MemoryCardEditorDialog::populateComboBox(QComboBox* cb)
|
|||
}
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::loadCardFromComboBox(Card* card, int index)
|
||||
void MemoryCardEditorWindow::loadCardFromComboBox(Card* card, int index)
|
||||
{
|
||||
loadCard(card->path_cb->itemData(index).toString(), card);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::onCardASelectionChanged()
|
||||
void MemoryCardEditorWindow::onCardASelectionChanged()
|
||||
{
|
||||
{
|
||||
QSignalBlocker cb(m_card_b.table);
|
||||
|
@ -184,7 +184,7 @@ void MemoryCardEditorDialog::onCardASelectionChanged()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::onCardBSelectionChanged()
|
||||
void MemoryCardEditorWindow::onCardBSelectionChanged()
|
||||
{
|
||||
{
|
||||
QSignalBlocker cb(m_card_a.table);
|
||||
|
@ -194,7 +194,7 @@ void MemoryCardEditorDialog::onCardBSelectionChanged()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::clearSelection()
|
||||
void MemoryCardEditorWindow::clearSelection()
|
||||
{
|
||||
{
|
||||
QSignalBlocker cb(m_card_a.table);
|
||||
|
@ -209,7 +209,7 @@ void MemoryCardEditorDialog::clearSelection()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
bool MemoryCardEditorDialog::loadCard(const QString& filename, Card* card)
|
||||
bool MemoryCardEditorWindow::loadCard(const QString& filename, Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
|
@ -250,7 +250,7 @@ static void setCardTableItemProperties(QTableWidgetItem* item, const MemoryCardI
|
|||
}
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::updateCardTable(Card* card)
|
||||
void MemoryCardEditorWindow::updateCardTable(Card* card)
|
||||
{
|
||||
card->table->setRowCount(0);
|
||||
|
||||
|
@ -289,20 +289,20 @@ void MemoryCardEditorDialog::updateCardTable(Card* card)
|
|||
}
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::updateCardBlocksFree(Card* card)
|
||||
void MemoryCardEditorWindow::updateCardBlocksFree(Card* card)
|
||||
{
|
||||
card->blocks_free = MemoryCardImage::GetFreeBlockCount(card->data);
|
||||
card->blocks_free_label->setText(
|
||||
tr("%n block(s) free%1", "", card->blocks_free).arg(card->dirty ? QStringLiteral(" (*)") : QString()));
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::setCardDirty(Card* card)
|
||||
void MemoryCardEditorWindow::setCardDirty(Card* card)
|
||||
{
|
||||
card->dirty = true;
|
||||
card->save_button->setEnabled(true);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::newCard(Card* card)
|
||||
void MemoryCardEditorWindow::newCard(Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
|
@ -328,7 +328,7 @@ void MemoryCardEditorDialog::newCard(Card* card)
|
|||
saveCard(card);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::openCard(Card* card)
|
||||
void MemoryCardEditorWindow::openCard(Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
|
@ -357,7 +357,7 @@ void MemoryCardEditorDialog::openCard(Card* card)
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::saveCard(Card* card)
|
||||
void MemoryCardEditorWindow::saveCard(Card* card)
|
||||
{
|
||||
if (card->filename.empty())
|
||||
return;
|
||||
|
@ -374,7 +374,7 @@ void MemoryCardEditorDialog::saveCard(Card* card)
|
|||
updateCardBlocksFree(card);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::promptForSave(Card* card)
|
||||
void MemoryCardEditorWindow::promptForSave(Card* card)
|
||||
{
|
||||
if (card->filename.empty() || !card->dirty)
|
||||
return;
|
||||
|
@ -390,7 +390,7 @@ void MemoryCardEditorDialog::promptForSave(Card* card)
|
|||
saveCard(card);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::doCopyFile()
|
||||
void MemoryCardEditorWindow::doCopyFile()
|
||||
{
|
||||
const auto [src, fi] = getSelectedFile();
|
||||
if (!fi)
|
||||
|
@ -440,7 +440,7 @@ void MemoryCardEditorDialog::doCopyFile()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::doDeleteFile()
|
||||
void MemoryCardEditorWindow::doDeleteFile()
|
||||
{
|
||||
const auto [card, fi] = getSelectedFile();
|
||||
if (!fi)
|
||||
|
@ -459,7 +459,7 @@ void MemoryCardEditorDialog::doDeleteFile()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::doUndeleteFile()
|
||||
void MemoryCardEditorWindow::doUndeleteFile()
|
||||
{
|
||||
const auto [card, fi] = getSelectedFile();
|
||||
if (!fi)
|
||||
|
@ -481,7 +481,7 @@ void MemoryCardEditorDialog::doUndeleteFile()
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::doExportSaveFile()
|
||||
void MemoryCardEditorWindow::doExportSaveFile()
|
||||
{
|
||||
QString filename = QDir::toNativeSeparators(
|
||||
QFileDialog::getSaveFileName(this, tr("Select Single Savefile"), QString(), tr(SINGLE_SAVEFILE_FILTER)));
|
||||
|
@ -502,7 +502,7 @@ void MemoryCardEditorDialog::doExportSaveFile()
|
|||
}
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::importCard(Card* card)
|
||||
void MemoryCardEditorWindow::importCard(Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
|
@ -527,7 +527,7 @@ void MemoryCardEditorDialog::importCard(Card* card)
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::formatCard(Card* card)
|
||||
void MemoryCardEditorWindow::formatCard(Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
|
@ -550,7 +550,7 @@ void MemoryCardEditorDialog::formatCard(Card* card)
|
|||
updateButtonState();
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::importSaveFile(Card* card)
|
||||
void MemoryCardEditorWindow::importSaveFile(Card* card)
|
||||
{
|
||||
QString filename =
|
||||
QFileDialog::getOpenFileName(this, tr("Select Import Save File"), QString(), tr(SINGLE_SAVEFILE_FILTER));
|
||||
|
@ -571,7 +571,7 @@ void MemoryCardEditorDialog::importSaveFile(Card* card)
|
|||
updateCardBlocksFree(card);
|
||||
}
|
||||
|
||||
std::tuple<MemoryCardEditorDialog::Card*, const MemoryCardImage::FileInfo*> MemoryCardEditorDialog::getSelectedFile()
|
||||
std::tuple<MemoryCardEditorWindow::Card*, const MemoryCardImage::FileInfo*> MemoryCardEditorWindow::getSelectedFile()
|
||||
{
|
||||
QList<QTableWidgetSelectionRange> sel = m_card_a.table->selectedRanges();
|
||||
Card* card = &m_card_a;
|
||||
|
@ -591,7 +591,7 @@ std::tuple<MemoryCardEditorDialog::Card*, const MemoryCardImage::FileInfo*> Memo
|
|||
return std::tuple<Card*, const MemoryCardImage::FileInfo*>(card, &card->files[index]);
|
||||
}
|
||||
|
||||
void MemoryCardEditorDialog::updateButtonState()
|
||||
void MemoryCardEditorWindow::updateButtonState()
|
||||
{
|
||||
const auto [selected_card, selected_file] = getSelectedFile();
|
||||
const bool is_card_b = (selected_card == &m_card_b);
|
|
@ -1,9 +1,12 @@
|
|||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_memorycardeditorwindow.h"
|
||||
|
||||
#include "core/memory_card_image.h"
|
||||
#include "ui_memorycardeditordialog.h"
|
||||
|
||||
#include <QtWidgets/QComboBox>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
|
@ -11,13 +14,13 @@
|
|||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QTableWidget>
|
||||
|
||||
class MemoryCardEditorDialog : public QDialog
|
||||
class MemoryCardEditorWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemoryCardEditorDialog(QWidget* parent);
|
||||
~MemoryCardEditorDialog();
|
||||
MemoryCardEditorWindow();
|
||||
~MemoryCardEditorWindow();
|
||||
|
||||
bool setCardA(const QString& path);
|
||||
bool setCardB(const QString& path);
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MemoryCardEditorDialog</class>
|
||||
<widget class="QDialog" name="MemoryCardEditorDialog">
|
||||
<widget class="QWidget" name="MemoryCardEditorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -13,6 +13,10 @@
|
|||
<property name="windowTitle">
|
||||
<string>Memory Card Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources/resources.qrc">
|
||||
<normaloff>:/icons/duck.png</normaloff>:/icons/duck.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableWidget" name="cardA">
|
Loading…
Reference in New Issue