mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-12 06:15:45 -04:00
Qt/MemoryCardEditor: Add format button
This commit is contained in:
@ -94,6 +94,8 @@ void MemoryCardEditorDialog::connectUi()
|
|||||||
connect(m_ui.saveCardB, &QPushButton::clicked, [this]() { saveCard(&m_card_b); });
|
connect(m_ui.saveCardB, &QPushButton::clicked, [this]() { saveCard(&m_card_b); });
|
||||||
connect(m_ui.importCardA, &QPushButton::clicked, [this]() { importCard(&m_card_a); });
|
connect(m_ui.importCardA, &QPushButton::clicked, [this]() { importCard(&m_card_a); });
|
||||||
connect(m_ui.importCardB, &QPushButton::clicked, [this]() { importCard(&m_card_b); });
|
connect(m_ui.importCardB, &QPushButton::clicked, [this]() { importCard(&m_card_b); });
|
||||||
|
connect(m_ui.formatCardA, &QPushButton::clicked, [this]() { formatCard(&m_card_a); });
|
||||||
|
connect(m_ui.formatCardB, &QPushButton::clicked, [this]() { formatCard(&m_card_b); });
|
||||||
connect(m_ui.exportFile, &QPushButton::clicked, this, &MemoryCardEditorDialog::doExportSaveFile);
|
connect(m_ui.exportFile, &QPushButton::clicked, this, &MemoryCardEditorDialog::doExportSaveFile);
|
||||||
connect(m_ui.importFileToCardA, &QPushButton::clicked, [this]() { importSaveFile(&m_card_a); });
|
connect(m_ui.importFileToCardA, &QPushButton::clicked, [this]() { importSaveFile(&m_card_a); });
|
||||||
connect(m_ui.importFileToCardB, &QPushButton::clicked, [this]() { importSaveFile(&m_card_b); });
|
connect(m_ui.importFileToCardB, &QPushButton::clicked, [this]() { importSaveFile(&m_card_b); });
|
||||||
@ -435,6 +437,29 @@ void MemoryCardEditorDialog::importCard(Card* card)
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemoryCardEditorDialog::formatCard(Card* card)
|
||||||
|
{
|
||||||
|
promptForSave(card);
|
||||||
|
|
||||||
|
if (QMessageBox::question(this, tr("Format memory card?"),
|
||||||
|
tr("Formatting the memory card will destroy all saves, and they will not be recoverable. "
|
||||||
|
"The memory card which will be formatted is located at '%1'.")
|
||||||
|
.arg(QString::fromStdString(card->filename)),
|
||||||
|
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearSelection();
|
||||||
|
|
||||||
|
MemoryCardImage::Format(&card->data);
|
||||||
|
|
||||||
|
updateCardTable(card);
|
||||||
|
updateCardBlocksFree(card);
|
||||||
|
setCardDirty(card);
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryCardEditorDialog::importSaveFile(Card* card)
|
void MemoryCardEditorDialog::importSaveFile(Card* card)
|
||||||
{
|
{
|
||||||
QString filename =
|
QString filename =
|
||||||
@ -492,4 +517,6 @@ void MemoryCardEditorDialog::updateButtonState()
|
|||||||
m_ui.importCardB->setEnabled(card_b_present);
|
m_ui.importCardB->setEnabled(card_b_present);
|
||||||
m_ui.importFileToCardA->setEnabled(card_a_present);
|
m_ui.importFileToCardA->setEnabled(card_a_present);
|
||||||
m_ui.importFileToCardB->setEnabled(card_b_present);
|
m_ui.importFileToCardB->setEnabled(card_b_present);
|
||||||
|
m_ui.formatCardA->setEnabled(card_a_present);
|
||||||
|
m_ui.formatCardB->setEnabled(card_b_present);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ private:
|
|||||||
void saveCard(Card* card);
|
void saveCard(Card* card);
|
||||||
void promptForSave(Card* card);
|
void promptForSave(Card* card);
|
||||||
void importCard(Card* card);
|
void importCard(Card* card);
|
||||||
|
void formatCard(Card* card);
|
||||||
|
|
||||||
void doExportSaveFile();
|
void doExportSaveFile();
|
||||||
void importSaveFile(Card* card);
|
void importSaveFile(Card* card);
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3">
|
<item row="2" column="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="cardBUsage">
|
<widget class="QLabel" name="cardBUsage">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -105,6 +105,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="formatCardB">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Format Card</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="importFileToCardB">
|
<widget class="QPushButton" name="importFileToCardB">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -138,7 +148,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="cardAUsage">
|
<widget class="QLabel" name="cardAUsage">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -146,6 +156,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="formatCardA">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Format Card</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="importFileToCardA">
|
<widget class="QPushButton" name="importFileToCardA">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
Reference in New Issue
Block a user