[Companion] Horus models export for simulation now OK

This commit is contained in:
Bertrand Songis
2016-11-27 00:45:24 +01:00
parent 0ca0785912
commit 8854cf9e87
9 changed files with 429 additions and 325 deletions
+2 -36
View File
@@ -343,51 +343,17 @@ bool MdiChild::loadFile(const QString & fileName, bool resetCurrentFile)
return true;
}
else if (fileType == FILE_TYPE_OTX) { //read zip archive
if (loadOtxFile(fileName)) {
if (!GetEepromInterface()->loadFile(radioData, fileName)) {
ui->modelsList->refreshList();
if (resetCurrentFile)
setCurrentFile(fileName);
return true;
}
}
return false;
}
bool MdiChild::loadOtxFile(const QString & fileName)
{
// example of StorageSdcard usage
StorageSdcard storage;
storage.read(fileName);
// display models.txt
QString modelList = QString(storage.modelList);
qDebug() << "Models: size" << modelList.size() << "contents" << modelList;
// info about radio.bin
qDebug() << "Radio settings:" << storage.radio.size();
// info about all models
QList<QString> models = storage.getModelsFileNames();
qDebug() << "We have" << models.size() << "models:";
#if 0
foreach(QString filename, models) {
QList<ModelFile>::const_iterator i = storage.getModelIterator(filename);
if (i != storage.models.end()) {
qDebug() << "\tModel:" << i->filename << "size" << i->data.size();
}
}
#endif
int index = 0;
for (QList<ModelFile>::iterator i = storage.models.begin(); i != storage.models.end(); ++i, ++index) {
GetEepromInterface()->loadModel(radioData.models[index], i->data);
}
return true;
}
bool MdiChild::save()
{
if (isUntitled) {