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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user