setupComBox->setSelected(sup);
}
+/* Returns a pointer to Setup object which must be deleted by calling code */
Setup* MediaImagePathDialog::getSelectedSetup()
{
- EmuFrontObject *ob = setupComBox->getSelected();
+ EmuFrontObject *ob = 0;
+
+ try {
+ ob = setupComBox->getSelected();
+ }
+ catch(EmuFrontException &e){
+ errorMessage->showMessage(e.what());
+ }
+
if (!ob) return 0;
return dynamic_cast<Setup*>(ob);
}
QMessageBox::information(this, tr("Set up"), tr("Set up not selected"), QMessageBox::Ok);
return;
}
+ bool change = false;
qDebug() << "Setup selected " << sup->getName();
QString filePath = filePathLabel->text();
if (filePath.isEmpty())
QMessageBox::information(this, tr("File path"), tr("File path was not selected"), QMessageBox::Ok);
return;
}
+ if (filePath != fpo->getName()) {
+ fpo->setName(filePath);
+ change = true;
+ }
+
Setup *tmp = fpo->getSetup();
- if (sup != tmp)
+
+ if (!tmp || *sup != *tmp)
{
delete tmp;
fpo->setSetup(sup);
+ change = true;
}
- fpo->setName(filePath);
- emit dataObjectUpdated();
+ if (change) emit dataObjectUpdated();
efObject = 0;
close();
}