Merge pull request #6350 from spycrab/qt_gc_selbug

Qt/GameCubePane: Fix file selection
This commit is contained in:
Stenzek 2018-02-03 00:48:08 +10:00 committed by GitHub
commit 75583ab098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 9 deletions

View File

@ -169,7 +169,7 @@ void GameCubePane::OnConfigPressed(int slot)
if (filename.isEmpty() || !File::Exists(filename.toStdString())) if (filename.isEmpty() || !File::Exists(filename.toStdString()))
return; return;
QString path_abs = QFileInfo(filename).absolutePath(); QString path_abs = QFileInfo(filename).absoluteFilePath();
// Memcard validity checks // Memcard validity checks
if (memcard) if (memcard)
@ -178,17 +178,22 @@ void GameCubePane::OnConfigPressed(int slot)
if (!mc.IsValid()) if (!mc.IsValid())
{ {
QMessageBox::critical(this, tr("Error"), tr("Cannot use that file as a memory card.\n%s\n" QMessageBox::critical(this, tr("Error"), tr("Cannot use that file as a memory card.\n%1\n"
"is not a valid GameCube memory card file") "is not a valid GameCube memory card file")
.arg(filename)); .arg(filename));
return; return;
} }
bool other_slot_memcard =
m_slot_combos[slot == 0 ? SLOT_B_INDEX : SLOT_A_INDEX]->currentIndex() == EXP_MEMORYCARD;
if (other_slot_memcard)
{
QString path_b = QString path_b =
QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strMemoryCardB : QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strMemoryCardB :
SConfig::GetInstance().m_strMemoryCardA)) SConfig::GetInstance().m_strMemoryCardA))
.absolutePath(); .absoluteFilePath();
if (path_abs == path_b) if (path_abs == path_b)
{ {
@ -196,6 +201,7 @@ void GameCubePane::OnConfigPressed(int slot)
return; return;
} }
} }
}
if (memcard) if (memcard)
{ {