[companion] Horus models didn't get their defaults set (thanks @Max)

This commit is contained in:
Andre Bernet
2017-03-05 08:40:16 +01:00
parent 51cad78030
commit 86fbb071da
+7 -7
View File
@@ -472,16 +472,16 @@ void MdiChild::modelAdd()
}
ModelData model;
model.category = categoryIndex;
model.used = true;
strcpy(model.filename, radioData.getNextModelFilename().toStdString().c_str());
strcpy(model.name, qPrintable(tr("New model")));
radioData.models.push_back(model);
int row = radioData.models.size() - 1;
checkAndInitModel(row);
radioData.models[row].category = categoryIndex;
strcpy(radioData.models[row].filename, radioData.getNextModelFilename().toStdString().c_str());
strcpy(radioData.models[row].name, qPrintable(tr("New model")));
// Only set the default model if we just added the first one.
int newModelIndex = radioData.models.size() - 1;
if (newModelIndex == 0) {
radioData.setCurrentModel(newModelIndex);
if (row == 0) {
radioData.setCurrentModel(row);
}
setModified();
emit copyAvailable(false); // workaround : nothing is selected after model creation