WiiSave: Move dialogs to UI code

This moves the result dialogs to DolphinQt2, since WiiSave should not
really be responsible for interacting with the user as a simple
Wii save importing/exporting class.

This also fixes Wii save import/export showing result dialogs twice,
once from WiiSave, and another time from DolphinQt2.
This commit is contained in:
Léo Lam 2018-05-13 13:18:19 +02:00
parent 41c4486c65
commit a93d816c28
4 changed files with 31 additions and 30 deletions

View file

@ -896,13 +896,21 @@ void MenuBar::ImportWiiSave()
tr("Wii save files (*.bin);;"
"All Files (*)"));
if (!file.isEmpty())
WiiSave::Import(file.toStdString());
if (file.isEmpty())
return;
if (WiiSave::Import(file.toStdString()))
QMessageBox::information(this, tr("Save Import"), tr("Successfully imported save files."));
else
QMessageBox::critical(this, tr("Save Import"), tr("Failed to import save files."));
}
void MenuBar::ExportWiiSaves()
{
WiiSave::ExportAll();
const std::pair<size_t, std::string> result = WiiSave::ExportAll();
QMessageBox::information(this, tr("Save Export"),
tr("Exported %n save(s) to %1", "", static_cast<int>(result.first))
.arg(QString::fromStdString(result.second)));
}
void MenuBar::CheckNAND()