Gave error dlg a description of the error for the user.

This commit is contained in:
Ira Aspen 2016-02-09 03:10:57 +00:00
parent d078cf52c9
commit aa658f95f6
3 changed files with 17 additions and 8 deletions

View file

@ -885,16 +885,23 @@ void TabDeckEditor::actAddCustomSet()
if (!dialog.exec())
return;
QString fileName = dialog.selectedFiles().at(0);
if (!QFile::exists(fileName)) {
DlgAddSetResult dlg(this, false, QString("Selected file cannot be found."));
dlg.exec();
return;
}
QDir dir(dataDir + "/customsets");
int nextPrefix = getNextCustomSetPrefix(dir);
QString fileName = dialog.selectedFiles().at(0);
bool res = QFile::copy(
fileName, dir.absolutePath() + "/" + (nextPrefix > 9 ? "" : "0") +
QString::number(nextPrefix) + "." + QFileInfo(fileName).fileName()
);
DlgAddSetResult dlg(this, res);
DlgAddSetResult dlg(this, res, QString());
dlg.exec();
}