feat(cpn): model notes and checklist files packaged with model files (#6578)

This commit is contained in:
Neil Horne
2025-10-02 14:47:29 +10:00
committed by GitHub
parent 7e53dd87fd
commit 96400a7aff
17 changed files with 191 additions and 207 deletions
+35
View File
@@ -160,6 +160,9 @@ bool LabelsStorageFormat::load(RadioData & radioData)
return false;
}
if (!loadChecklist(model))
return false;
model.modelIndex = modelIdx;
strncpy(model.filename, mc.filename.c_str(), sizeof(model.filename)-1);
@@ -235,6 +238,9 @@ bool LabelsStorageFormat::write(const RadioData & radioData)
writeModelToYaml(model, modelData);
if (!writeFile(modelData, modelFilename))
return false;
if (!writeChecklist(model))
return false;
}
if (hasLabels) {
@@ -245,3 +251,32 @@ bool LabelsStorageFormat::write(const RadioData & radioData)
return true;
}
bool LabelsStorageFormat::loadChecklist(ModelData & model)
{
const QString fname("MODELS/" + model.getChecklistFilename());
//qDebug() << "Searching for checklist file:" << fname;
if (!loadFile(model.checklistData, fname, true)) {
setError(tr("Cannot load ") + fname);
return false;
}
return true;
}
bool LabelsStorageFormat::writeChecklist(const ModelData & model)
{
const QString fname("MODELS/" + model.getChecklistFilename());
// not every model has a checklist
if (!model.checklistData.isEmpty()) {
//qDebug() << "Writing checklist file:" << fname;
if (!writeFile(model.checklistData, fname)) {
setError(tr("Cannot write ") + fname);
return false;
}
}
return true;
}