diff --git a/src/Settings.cpp b/src/Settings.cpp index f1dcc56e..05244b32 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -123,54 +123,51 @@ ParametersMap Settings::loadSettings(const QString & fileName) if(str.size() != getParameter(key).toString().size()) { // If a string list is modified, update the value - // (assuming that index < 10... one character for index) - QChar index = str.at(0); + // Assuming format ##:VA;VB;VC + int index = str.split(':').first().toInt(); str = getParameter(key).toString(); - str[0] = index.toLatin1(); + str = QString::number(index)+":"+ str.split(':').back(); value = QVariant(str); UINFO("Updated list of parameter \"%s\"", key.toStdString().c_str()); } #if FINDOBJECT_NONFREE == 0 - QChar index = str.at(0); + int index = str.split(':').first().toInt(); if(key.compare(Settings::kFeature2D_1Detector()) == 0) { - if(index == '5' || index == '7') + if(index == 5 || index == 7) { - index = Settings::defaultFeature2D_1Detector().at(0); - int indexInt = Settings::defaultFeature2D_1Detector().split(':').first().toInt(); + index = Settings::defaultFeature2D_1Detector().split(':').first().toInt(); UWARN("Trying to set \"%s\" to SIFT/SURF but Find-Object isn't built " "with the nonfree module from OpenCV. Keeping default combo value: %s.", Settings::kFeature2D_1Detector().toStdString().c_str(), - Settings::defaultFeature2D_1Detector().split(':').last().split(";").at(indexInt).toStdString().c_str()); + Settings::defaultFeature2D_1Detector().split(':').last().split(";").at(index).toStdString().c_str()); } } else if(key.compare(Settings::kFeature2D_2Descriptor()) == 0) { - if(index == '2' || index == '3') + if(index == 2 || index == 3) { - index = Settings::defaultFeature2D_2Descriptor().at(0); - int indexInt = Settings::defaultFeature2D_2Descriptor().split(':').first().toInt(); + index = Settings::defaultFeature2D_2Descriptor().split(':').first().toInt(); UWARN("Trying to set \"%s\" to SIFT/SURF but Find-Object isn't built " "with the nonfree module from OpenCV. Keeping default combo value: %s.", Settings::kFeature2D_2Descriptor().toStdString().c_str(), - Settings::defaultFeature2D_2Descriptor().split(':').last().split(";").at(indexInt).toStdString().c_str()); + Settings::defaultFeature2D_2Descriptor().split(':').last().split(";").at(index).toStdString().c_str()); } } else if(key.compare(Settings::kNearestNeighbor_1Strategy()) == 0) { - if(index <= '4') + if(index <= 4) { - index = Settings::defaultNearestNeighbor_1Strategy().at(0); - int indexInt = Settings::defaultNearestNeighbor_1Strategy().split(':').first().toInt(); + index = Settings::defaultNearestNeighbor_1Strategy().split(':').first().toInt(); UWARN("Trying to set \"%s\" to one FLANN approach but Find-Object isn't built " "with the nonfree module from OpenCV and FLANN cannot be used " "with binary descriptors. Keeping default combo value: %s.", Settings::kNearestNeighbor_1Strategy().toStdString().c_str(), - Settings::defaultNearestNeighbor_1Strategy().split(':').last().split(";").at(indexInt).toStdString().c_str()); + Settings::defaultNearestNeighbor_1Strategy().split(':').last().split(";").at(index).toStdString().c_str()); } } str = getParameter(key).toString(); - str[0] = index.toLatin1(); + str = QString::number(index)+":"+ str.split(':').back(); value = QVariant(str); #endif }