Fix companion model edit image names (#848)
* Fix companion model edit bitmap image names * Add radio conversion of file extension
This commit is contained in:
@@ -407,6 +407,21 @@ void ModelData::convert(RadioDataConversionState & cstate)
|
||||
thrTraceSrc = RawSource(SOURCE_TYPE_STICK, (int)thrTraceSrc + 3).convert(cstate).index - 3;
|
||||
}
|
||||
|
||||
Firmware *fw = getCurrentFirmware();
|
||||
|
||||
if (fw->getCapability(HasModelImage) && bitmap[0] != '\0') {
|
||||
QString filename = bitmap;
|
||||
QFileInfo file(filename);
|
||||
if (fw->getCapability(ModelImageKeepExtn) && file.suffix() == "")
|
||||
filename.append(".bmp"); // bmp is assumed default for radios that do not store file extension
|
||||
else if (!fw->getCapability(ModelImageKeepExtn) && file.suffix() != "") {
|
||||
int posn = filename.indexOf("." % file.suffix(), + 1);
|
||||
filename.remove(posn, filename.size() - posn + 1);
|
||||
}
|
||||
memset(bitmap, 0, CPN_MAX_BITMAP_LEN);
|
||||
strncpy(bitmap, filename.toLatin1().data(), fw->getCapability(ModelImageNameLen));
|
||||
}
|
||||
|
||||
for (int i = 0; i < CPN_MAX_MODULES; i++) {
|
||||
moduleData[i].convert(cstate.withComponentIndex(i));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user