From ff7c6983713997d09ef2518f81d41f3ab86c032e Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 22 Jan 2017 18:17:14 +0100 Subject: [PATCH] [Companion] Files automatically named during XXX => Horus conversions --- companion/src/radiodata.cpp | 59 +++++++++++++++++++++++++++++++++++++ companion/src/radiodata.h | 57 ++++------------------------------- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/companion/src/radiodata.cpp b/companion/src/radiodata.cpp index a0d68878d..626e6236f 100644 --- a/companion/src/radiodata.cpp +++ b/companion/src/radiodata.cpp @@ -33,6 +33,61 @@ void GeneralSettings::convert(BoardEnum before, BoardEnum after) // Here we can add explicit conversions when moving from one board to another } +void RadioData::setCurrentModel(unsigned int index) +{ + generalSettings.currModelIndex = index; + strcpy(generalSettings.currModelFilename, models[index].filename); +} + +void RadioData::fixModelFilename(unsigned int index) +{ + ModelData & model = models[index]; + QString filename(model.filename); + bool ok = filename.endsWith(".bin"); + if (ok) { + if (filename.startsWith("model") && filename.mid(5, filename.length()-9).toInt() > 0) { + ok = false; + } + } + if (ok) { + for (unsigned i=0; i 0) { - ok = false; - } - } - if (ok) { - for (unsigned i=0; i