mirror of https://github.com/PCSX2/pcsx2.git
QT/Settings: ensure that a memory card is formatted before conversion
This commit is contained in:
parent
f1a947af92
commit
009b4ff5e7
|
@ -183,6 +183,16 @@ QString MemoryCardSettingsWidget::getSelectedCard() const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MemoryCardSettingsWidget::isSelectedCardFormatted() const
|
||||||
|
{
|
||||||
|
QString ret;
|
||||||
|
|
||||||
|
const QList<QTreeWidgetItem*> selection(m_ui.cardList->selectedItems());
|
||||||
|
if (!selection.empty())
|
||||||
|
return selection[0]->data(0, Qt::UserRole).toBool();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryCardSettingsWidget::updateCardActions()
|
void MemoryCardSettingsWidget::updateCardActions()
|
||||||
{
|
{
|
||||||
QString selectedCard = getSelectedCard();
|
QString selectedCard = getSelectedCard();
|
||||||
|
@ -263,6 +273,13 @@ void MemoryCardSettingsWidget::convertCard()
|
||||||
if (selectedCard.isEmpty())
|
if (selectedCard.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!isSelectedCardFormatted())
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Cannot convert an unformatted memory card."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MemoryCardConvertDialog dialog(QtUtils::GetRootWidget(this), selectedCard);
|
MemoryCardConvertDialog dialog(QtUtils::GetRootWidget(this), selectedCard);
|
||||||
|
|
||||||
if (dialog.IsSetup() && dialog.exec() == QDialog::Accepted)
|
if (dialog.IsSetup() && dialog.exec() == QDialog::Accepted)
|
||||||
|
@ -442,6 +459,10 @@ void MemoryCardListWidget::refresh(SettingsWindow* dialog)
|
||||||
item->setText(1, getSizeSummary(mcd));
|
item->setText(1, getSizeSummary(mcd));
|
||||||
item->setText(2, mcd.formatted ? tr("Yes") : tr("No"));
|
item->setText(2, mcd.formatted ? tr("Yes") : tr("No"));
|
||||||
item->setText(3, mtime.toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)));
|
item->setText(3, mtime.toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)));
|
||||||
|
|
||||||
|
// store formatted metadata
|
||||||
|
item->setData(0, Qt::UserRole, mcd.formatted);
|
||||||
|
|
||||||
addTopLevelItem(item);
|
addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ private:
|
||||||
void createCard();
|
void createCard();
|
||||||
|
|
||||||
QString getSelectedCard() const;
|
QString getSelectedCard() const;
|
||||||
|
bool isSelectedCardFormatted() const;
|
||||||
void updateCardActions();
|
void updateCardActions();
|
||||||
void deleteCard();
|
void deleteCard();
|
||||||
void renameCard();
|
void renameCard();
|
||||||
|
|
Loading…
Reference in New Issue