forked from qt-creator/qt-creator
Android: Create AVD: Show error messages
The check for errors was wrong and didn't even get the right string. Fix that, and also use a QMessageBox for the errors. Task-number: QTCREATORBUG-11729 Change-Id: I9aecd1dcbeabb35d60833419f7997ea4c704d65b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
@@ -479,11 +479,19 @@ QString AndroidConfig::createAVD(QWidget *parent, int minApiLevel, QString targe
|
||||
avdDialog.nameLineEdit->setValidator(&v);
|
||||
if (d.exec() != QDialog::Accepted)
|
||||
return QString();
|
||||
return createAVD(avdDialog.targetComboBox->currentText(), avdDialog.nameLineEdit->text(),
|
||||
avdDialog.abiComboBox->currentText(), avdDialog.sizeSpinBox->value());
|
||||
QString error;
|
||||
QString avd = createAVD(avdDialog.targetComboBox->currentText(), avdDialog.nameLineEdit->text(),
|
||||
avdDialog.abiComboBox->currentText(), avdDialog.sizeSpinBox->value(),
|
||||
&error);
|
||||
if (!error.isEmpty()) {
|
||||
QMessageBox::critical(parent, QApplication::translate("AndroidConfig", "Error Creating AVD"),
|
||||
error);
|
||||
}
|
||||
|
||||
return avd;
|
||||
}
|
||||
|
||||
QString AndroidConfig::createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize) const
|
||||
QString AndroidConfig::createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize, QString *error) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
|
||||
@@ -518,12 +526,16 @@ QString AndroidConfig::createAVD(const QString &target, const QString &name, con
|
||||
break;
|
||||
}
|
||||
|
||||
Core::MessageManager::write(QString::fromLocal8Bit(question), Core::MessageManager::Flash);
|
||||
|
||||
proc.waitForFinished();
|
||||
|
||||
if (proc.exitCode()) // error!
|
||||
QString errorOutput = QString::fromLocal8Bit(proc.readAllStandardError());
|
||||
// The exit code is always 0, so we need to check stderr
|
||||
// For now assume that any output at all indicates a error
|
||||
if (!errorOutput.isEmpty()) {
|
||||
*error = errorOutput;
|
||||
return QString();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user