mirror of https://github.com/PCSX2/pcsx2.git
GUI: Only add extension to new memcards on save
This commit is contained in:
parent
298e626b6e
commit
9a323a9a8d
|
@ -60,20 +60,16 @@ CreateMemoryCardDialog::~CreateMemoryCardDialog() = default;
|
||||||
|
|
||||||
void CreateMemoryCardDialog::nameTextChanged()
|
void CreateMemoryCardDialog::nameTextChanged()
|
||||||
{
|
{
|
||||||
const QString controlName(m_ui.name->text());
|
QString controlName(m_ui.name->text());
|
||||||
const int cursorPos = m_ui.name->cursorPosition();
|
const int cursorPos = m_ui.name->cursorPosition();
|
||||||
|
|
||||||
QString nameWithoutExtension;
|
controlName.replace(".", "");
|
||||||
if (controlName.endsWith(QStringLiteral(".ps2")))
|
|
||||||
nameWithoutExtension = controlName.left(controlName.size() - 4);
|
|
||||||
else
|
|
||||||
nameWithoutExtension = controlName;
|
|
||||||
|
|
||||||
QSignalBlocker sb(m_ui.name);
|
QSignalBlocker sb(m_ui.name);
|
||||||
if (nameWithoutExtension.isEmpty())
|
if (controlName.isEmpty())
|
||||||
m_ui.name->setText(QString());
|
m_ui.name->setText(QString());
|
||||||
else
|
else
|
||||||
m_ui.name->setText(nameWithoutExtension + QStringLiteral(".ps2"));
|
m_ui.name->setText(controlName);
|
||||||
|
|
||||||
m_ui.name->setCursorPosition(cursorPos);
|
m_ui.name->setCursorPosition(cursorPos);
|
||||||
updateState();
|
updateState();
|
||||||
|
@ -109,8 +105,20 @@ void CreateMemoryCardDialog::updateState()
|
||||||
|
|
||||||
void CreateMemoryCardDialog::createCard()
|
void CreateMemoryCardDialog::createCard()
|
||||||
{
|
{
|
||||||
const QString name(m_ui.name->text());
|
QString name(m_ui.name->text());
|
||||||
const std::string nameStr(name.toStdString());
|
std::string nameStr;
|
||||||
|
|
||||||
|
if (m_fileType == MemoryCardFileType::PS1)
|
||||||
|
{
|
||||||
|
name += QStringLiteral(".mcr");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name += QStringLiteral(".ps2");
|
||||||
|
}
|
||||||
|
|
||||||
|
nameStr = name.toStdString();
|
||||||
|
|
||||||
if (FileMcd_GetCardInfo(nameStr).has_value())
|
if (FileMcd_GetCardInfo(nameStr).has_value())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Create Memory Card"),
|
QMessageBox::critical(this, tr("Create Memory Card"),
|
||||||
|
|
Loading…
Reference in New Issue