Bsongis/horus create radiodata from scratch (#4251)

[Companion] It's now possible to add models on an empty EEPROM, save and reload the .otx
This commit is contained in:
Bertrand Songis
2017-01-17 19:41:09 +01:00
committed by GitHub
parent 2bca437e55
commit 61d27ebd75
9 changed files with 42 additions and 20 deletions
+3
View File
@@ -57,6 +57,9 @@ bool CategorizedStorageFormat::load(RadioData & radioData)
setError(QObject::tr("Can't extract %1").arg(QString(line)));
return false;
}
if ((int)radioData.models.size() <= modelIndex) {
radioData.models.resize(modelIndex + 1);
}
if (!loadModelFromByteArray(radioData.models[modelIndex], modelBuffer)) {
return false;
}
+1 -2
View File
@@ -48,8 +48,7 @@ bool SdcardFormat::writeFile(const QByteArray & data, const QString & filename)
QString path = this->filename + "/" + filename;
QFile file(path);
if (!file.open(QFile::WriteOnly)) {
setError(QObject::tr("Error opening file %1:\n%2.").arg(path).arg(file.errorString()));
qDebug() << "File" << path << "write error";
setError(QObject::tr("Error opening file %1 in write mode:\n%2.").arg(path).arg(file.errorString()));
return false;
}
file.write(data.data(), data.size());