Commit 9eb2f360 authored by Don Gagne's avatar Don Gagne

Merge pull request #2439 from anselmolsm/foreach-qstring

Review iterations over QStrings
parents a4e6fd28 7d47b470
...@@ -59,7 +59,7 @@ bool APMRadioComponent::setupComplete(void) const ...@@ -59,7 +59,7 @@ bool APMRadioComponent::setupComplete(void) const
// controls to be mapped. // controls to be mapped.
QStringList attitudeMappings; QStringList attitudeMappings;
attitudeMappings << "RCMAP_ROLL" << "RCMAP_PITCH" << "RCMAP_YAW" << "RCMAP_THROTTLE"; attitudeMappings << "RCMAP_ROLL" << "RCMAP_PITCH" << "RCMAP_YAW" << "RCMAP_THROTTLE";
foreach(QString mapParam, attitudeMappings) { foreach(const QString &mapParam, attitudeMappings) {
if (_autopilot->getParameterFact(FactSystem::defaultComponentId, mapParam)->rawValue().toInt() == 0) { if (_autopilot->getParameterFact(FactSystem::defaultComponentId, mapParam)->rawValue().toInt() == 0) {
return false; return false;
} }
......
...@@ -395,7 +395,7 @@ void APMSensorsComponentController::_refreshParams(void) ...@@ -395,7 +395,7 @@ void APMSensorsComponentController::_refreshParams(void)
fastRefreshList << "COMPASS_OFS_X" << "COMPASS_OFS_X" << "COMPASS_OFS_X" fastRefreshList << "COMPASS_OFS_X" << "COMPASS_OFS_X" << "COMPASS_OFS_X"
<< "INS_ACCOFFS_X" << "INS_ACCOFFS_Y" << "INS_ACCOFFS_Z"; << "INS_ACCOFFS_X" << "INS_ACCOFFS_Y" << "INS_ACCOFFS_Z";
foreach (QString paramName, fastRefreshList) { foreach (const QString &paramName, fastRefreshList) {
_autopilot->refreshParameter(FactSystem::defaultComponentId, paramName); _autopilot->refreshParameter(FactSystem::defaultComponentId, paramName);
} }
......
...@@ -119,7 +119,7 @@ void FlightModesComponentController::_init(void) ...@@ -119,7 +119,7 @@ void FlightModesComponentController::_init(void)
QStringList attitudeParams; QStringList attitudeParams;
attitudeParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2"; attitudeParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2";
foreach(QString attitudeParam, attitudeParams) { foreach(const QString &attitudeParam, attitudeParams) {
int channel = getParameterFact(-1, attitudeParam)->rawValue().toInt(); int channel = getParameterFact(-1, attitudeParam)->rawValue().toInt();
if (channel != 0) { if (channel != 0) {
usedChannels << channel; usedChannels << channel;
...@@ -195,7 +195,7 @@ void FlightModesComponentController::_validateConfiguration(void) ...@@ -195,7 +195,7 @@ void FlightModesComponentController::_validateConfiguration(void)
thresholdParams << "RC_ASSIST_TH" << "RC_AUTO_TH" << "RC_ACRO_TH" << "RC_POSCTL_TH" << "RC_LOITER_TH" << "RC_RETURN_TH" << "RC_OFFB_TH"; thresholdParams << "RC_ASSIST_TH" << "RC_AUTO_TH" << "RC_ACRO_TH" << "RC_POSCTL_TH" << "RC_LOITER_TH" << "RC_RETURN_TH" << "RC_OFFB_TH";
foreach(QString thresholdParam, thresholdParams) { foreach(const QString &thresholdParam, thresholdParams) {
float threshold = getParameterFact(-1, thresholdParam)->rawValue().toFloat(); float threshold = getParameterFact(-1, thresholdParam)->rawValue().toFloat();
if (threshold < 0.0f || threshold > 1.0f) { if (threshold < 0.0f || threshold > 1.0f) {
_validConfiguration = false; _validConfiguration = false;
...@@ -735,7 +735,7 @@ void FlightModesComponentController::generateThresholds(void) ...@@ -735,7 +735,7 @@ void FlightModesComponentController::generateThresholds(void)
thresholdParams << "RC_ASSIST_TH" << "RC_AUTO_TH" << "RC_ACRO_TH" << "RC_POSCTL_TH" << "RC_LOITER_TH" << "RC_RETURN_TH" << "RC_OFFB_TH"; thresholdParams << "RC_ASSIST_TH" << "RC_AUTO_TH" << "RC_ACRO_TH" << "RC_POSCTL_TH" << "RC_LOITER_TH" << "RC_RETURN_TH" << "RC_OFFB_TH";
foreach(QString thresholdParam, thresholdParams) { foreach(const QString &thresholdParam, thresholdParams) {
getParameterFact(-1, thresholdParam)->setRawValue(0.0f); getParameterFact(-1, thresholdParam)->setRawValue(0.0f);
} }
......
...@@ -38,7 +38,7 @@ PX4Component::PX4Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject ...@@ -38,7 +38,7 @@ PX4Component::PX4Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject
void PX4Component::setupTriggerSignals(void) void PX4Component::setupTriggerSignals(void)
{ {
// Watch for changed on trigger list params // Watch for changed on trigger list params
foreach (QString paramName, setupCompleteChangedTriggerList()) { foreach (const QString &paramName, setupCompleteChangedTriggerList()) {
Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName); Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName);
connect(fact, &Fact::valueChanged, this, &PX4Component::_triggerUpdated); connect(fact, &Fact::valueChanged, this, &PX4Component::_triggerUpdated);
......
...@@ -59,7 +59,7 @@ bool PX4RadioComponent::setupComplete(void) const ...@@ -59,7 +59,7 @@ bool PX4RadioComponent::setupComplete(void) const
// controls to be mapped. // controls to be mapped.
QStringList attitudeMappings; QStringList attitudeMappings;
attitudeMappings << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE"; attitudeMappings << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
foreach(QString mapParam, attitudeMappings) { foreach(const QString &mapParam, attitudeMappings) {
if (_autopilot->getParameterFact(FactSystem::defaultComponentId, mapParam)->rawValue().toInt() == 0) { if (_autopilot->getParameterFact(FactSystem::defaultComponentId, mapParam)->rawValue().toInt() == 0) {
return false; return false;
} }
......
...@@ -61,7 +61,7 @@ bool SensorsComponent::requiresSetup(void) const ...@@ -61,7 +61,7 @@ bool SensorsComponent::requiresSetup(void) const
bool SensorsComponent::setupComplete(void) const bool SensorsComponent::setupComplete(void) const
{ {
foreach(QString triggerParam, setupCompleteChangedTriggerList()) { foreach(const QString &triggerParam, setupCompleteChangedTriggerList()) {
if (_autopilot->getParameterFact(FactSystem::defaultComponentId, triggerParam)->rawValue().toFloat() == 0.0f) { if (_autopilot->getParameterFact(FactSystem::defaultComponentId, triggerParam)->rawValue().toFloat() == 0.0f) {
return false; return false;
} }
......
...@@ -434,7 +434,7 @@ void SensorsComponentController::_refreshParams(void) ...@@ -434,7 +434,7 @@ void SensorsComponentController::_refreshParams(void)
// We ask for a refresh on these first so that the rotation combo show up as fast as possible // We ask for a refresh on these first so that the rotation combo show up as fast as possible
fastRefreshList << "CAL_MAG0_ID" << "CAL_MAG1_ID" << "CAL_MAG2_ID" << "CAL_MAG0_ROT" << "CAL_MAG1_ROT" << "CAL_MAG2_ROT"; fastRefreshList << "CAL_MAG0_ID" << "CAL_MAG1_ID" << "CAL_MAG2_ID" << "CAL_MAG0_ROT" << "CAL_MAG1_ROT" << "CAL_MAG2_ROT";
foreach (QString paramName, fastRefreshList) { foreach (const QString &paramName, fastRefreshList) {
_autopilot->refreshParameter(FactSystem::defaultComponentId, paramName); _autopilot->refreshParameter(FactSystem::defaultComponentId, paramName);
} }
......
...@@ -61,7 +61,7 @@ void FactPanelController::setFactPanel(QQuickItem* panel) ...@@ -61,7 +61,7 @@ void FactPanelController::setFactPanel(QQuickItem* panel)
// missing fact notices that were waiting to go out // missing fact notices that were waiting to go out
_factPanel = panel; _factPanel = panel;
foreach (QString missingParam, _delayedMissingParams) { foreach (const QString &missingParam, _delayedMissingParams) {
_notifyPanelMissingParameter(missingParam); _notifyPanelMissingParameter(missingParam);
} }
_delayedMissingParams.clear(); _delayedMissingParams.clear();
...@@ -112,7 +112,7 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name ...@@ -112,7 +112,7 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name
{ {
bool noMissingFacts = true; bool noMissingFacts = true;
foreach (QString name, names) { foreach (const QString &name, names) {
if (_autopilot && !_autopilot->parameterExists(componentId, name)) { if (_autopilot && !_autopilot->parameterExists(componentId, name)) {
_reportMissingParameter(componentId, name); _reportMissingParameter(componentId, name);
noMissingFacts = false; noMissingFacts = false;
......
...@@ -380,7 +380,7 @@ void ParameterLoader::refreshParametersPrefix(int componentId, const QString& na ...@@ -380,7 +380,7 @@ void ParameterLoader::refreshParametersPrefix(int componentId, const QString& na
componentId = _actualComponentId(componentId); componentId = _actualComponentId(componentId);
qCDebug(ParameterLoaderLog) << "refreshParametersPrefix (component id:" << componentId << "name:" << namePrefix << ")"; qCDebug(ParameterLoaderLog) << "refreshParametersPrefix (component id:" << componentId << "name:" << namePrefix << ")";
foreach(QString name, _mapParameterName2Variant[componentId].keys()) { foreach(const QString &name, _mapParameterName2Variant[componentId].keys()) {
if (name.startsWith(namePrefix)) { if (name.startsWith(namePrefix)) {
refreshParameter(componentId, name); refreshParameter(componentId, name);
} }
...@@ -415,7 +415,7 @@ QStringList ParameterLoader::parameterNames(int componentId) ...@@ -415,7 +415,7 @@ QStringList ParameterLoader::parameterNames(int componentId)
{ {
QStringList names; QStringList names;
foreach(QString paramName, _mapParameterName2Variant[_actualComponentId(componentId)].keys()) { foreach(const QString &paramName, _mapParameterName2Variant[_actualComponentId(componentId)].keys()) {
names << paramName; names << paramName;
} }
...@@ -425,7 +425,7 @@ QStringList ParameterLoader::parameterNames(int componentId) ...@@ -425,7 +425,7 @@ QStringList ParameterLoader::parameterNames(int componentId)
void ParameterLoader::_setupGroupMap(void) void ParameterLoader::_setupGroupMap(void)
{ {
foreach (int componentId, _mapParameterName2Variant.keys()) { foreach (int componentId, _mapParameterName2Variant.keys()) {
foreach (QString name, _mapParameterName2Variant[componentId].keys()) { foreach (const QString &name, _mapParameterName2Variant[componentId].keys()) {
Fact* fact = _mapParameterName2Variant[componentId][name].value<Fact*>(); Fact* fact = _mapParameterName2Variant[componentId][name].value<Fact*>();
_mapGroup2ParameterName[componentId][fact->group()] += name; _mapGroup2ParameterName[componentId][fact->group()] += name;
} }
...@@ -471,7 +471,7 @@ void ParameterLoader::_waitingParamTimeout(void) ...@@ -471,7 +471,7 @@ void ParameterLoader::_waitingParamTimeout(void)
if (!paramsRequested) { if (!paramsRequested) {
foreach(int componentId, _waitingWriteParamNameMap.keys()) { foreach(int componentId, _waitingWriteParamNameMap.keys()) {
foreach(QString paramName, _waitingWriteParamNameMap[componentId].keys()) { foreach(const QString &paramName, _waitingWriteParamNameMap[componentId].keys()) {
paramsRequested = true; paramsRequested = true;
_waitingWriteParamNameMap[componentId][paramName]++; // Bump retry count _waitingWriteParamNameMap[componentId][paramName]++; // Bump retry count
_writeParameterRaw(componentId, paramName, _autopilot->getFact(FactSystem::ParameterProvider, componentId, paramName)->rawValue()); _writeParameterRaw(componentId, paramName, _autopilot->getFact(FactSystem::ParameterProvider, componentId, paramName)->rawValue());
...@@ -486,7 +486,7 @@ void ParameterLoader::_waitingParamTimeout(void) ...@@ -486,7 +486,7 @@ void ParameterLoader::_waitingParamTimeout(void)
if (!paramsRequested) { if (!paramsRequested) {
foreach(int componentId, _waitingReadParamNameMap.keys()) { foreach(int componentId, _waitingReadParamNameMap.keys()) {
foreach(QString paramName, _waitingReadParamNameMap[componentId].keys()) { foreach(const QString &paramName, _waitingReadParamNameMap[componentId].keys()) {
paramsRequested = true; paramsRequested = true;
_waitingReadParamNameMap[componentId][paramName]++; // Bump retry count _waitingReadParamNameMap[componentId][paramName]++; // Bump retry count
_readParameterRaw(componentId, paramName, -1); _readParameterRaw(componentId, paramName, -1);
...@@ -715,7 +715,7 @@ void ParameterLoader::writeParametersToStream(QTextStream &stream) ...@@ -715,7 +715,7 @@ void ParameterLoader::writeParametersToStream(QTextStream &stream)
stream << "# MAV ID COMPONENT ID PARAM NAME VALUE (FLOAT)\n"; stream << "# MAV ID COMPONENT ID PARAM NAME VALUE (FLOAT)\n";
foreach (int componentId, _mapParameterName2Variant.keys()) { foreach (int componentId, _mapParameterName2Variant.keys()) {
foreach (QString paramName, _mapParameterName2Variant[componentId].keys()) { foreach (const QString &paramName, _mapParameterName2Variant[componentId].keys()) {
Fact* fact = _mapParameterName2Variant[componentId][paramName].value<Fact*>(); Fact* fact = _mapParameterName2Variant[componentId][paramName].value<Fact*>();
Q_ASSERT(fact); Q_ASSERT(fact);
......
...@@ -97,7 +97,7 @@ void HomePositionManager::_loadSettings(void) ...@@ -97,7 +97,7 @@ void HomePositionManager::_loadSettings(void)
settings.beginGroup(_settingsGroup); settings.beginGroup(_settingsGroup);
foreach(QString name, settings.childGroups()) { foreach(const QString &name, settings.childGroups()) {
QGeoCoordinate coordinate; QGeoCoordinate coordinate;
qDebug() << "Load setting" << name; qDebug() << "Load setting" << name;
......
...@@ -145,7 +145,7 @@ QVariantList JoystickManager::joysticks(void) ...@@ -145,7 +145,7 @@ QVariantList JoystickManager::joysticks(void)
{ {
QVariantList list; QVariantList list;
foreach (QString name, _name2JoystickMap.keys()) { foreach (const QString &name, _name2JoystickMap.keys()) {
list += QVariant::fromValue(_name2JoystickMap[name]); list += QVariant::fromValue(_name2JoystickMap[name]);
} }
......
...@@ -172,7 +172,7 @@ void LogCompressor::run() ...@@ -172,7 +172,7 @@ void LogCompressor::run()
// Fill holes if necessary // Fill holes if necessary
if (holeFillingEnabled) { if (holeFillingEnabled) {
int index = 0; int index = 0;
foreach (QString str, list) { foreach (const QString& str, list) {
if (str == "" || str == "NaN") { if (str == "" || str == "NaN") {
list.replace(index, lastList.at(index)); list.replace(index, lastList.at(index));
} }
......
...@@ -130,7 +130,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) ...@@ -130,7 +130,7 @@ void MissionCommands::_loadMavCmdInfoJson(void)
// Make sure we have the required keys // Make sure we have the required keys
QStringList requiredKeys; QStringList requiredKeys;
requiredKeys << _idJsonKey << _rawNameJsonKey; requiredKeys << _idJsonKey << _rawNameJsonKey;
foreach (QString key, requiredKeys) { foreach (const QString &key, requiredKeys) {
if (!jsonObject.contains(key)) { if (!jsonObject.contains(key)) {
qWarning() << "Mission required key" << key; qWarning() << "Mission required key" << key;
return; return;
...@@ -211,7 +211,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) ...@@ -211,7 +211,7 @@ void MissionCommands::_loadMavCmdInfoJson(void)
paramInfo->_units = paramObject.value(_unitsJsonKey).toString(); paramInfo->_units = paramObject.value(_unitsJsonKey).toString();
QStringList enumValues = paramObject.value(_enumValuesJsonKey).toString().split(",", QString::SkipEmptyParts); QStringList enumValues = paramObject.value(_enumValuesJsonKey).toString().split(",", QString::SkipEmptyParts);
foreach (QString enumValue, enumValues) { foreach (const QString &enumValue, enumValues) {
bool convertOk; bool convertOk;
double value = enumValue.toDouble(&convertOk); double value = enumValue.toDouble(&convertOk);
...@@ -295,7 +295,7 @@ const QStringList MissionCommands::categories(Vehicle* vehicle) const ...@@ -295,7 +295,7 @@ const QStringList MissionCommands::categories(Vehicle* vehicle) const
{ {
QStringList list; QStringList list;
foreach (QString category, _categoryToMavCmdInfoListMap[_firmwareTypeFromVehicle(vehicle)].keys()) { foreach (const QString &category, _categoryToMavCmdInfoListMap[_firmwareTypeFromVehicle(vehicle)].keys()) {
list << category; list << category;
} }
......
...@@ -226,7 +226,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -226,7 +226,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
filterRules += ".debug=false\n"; filterRules += ".debug=false\n";
} }
} else { } else {
foreach(QString rule, logList) { foreach(const QString &rule, logList) {
filterRules += rule; filterRules += rule;
filterRules += ".debug=true\n"; filterRules += ".debug=true\n";
} }
...@@ -261,7 +261,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -261,7 +261,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
QTextStream out(&loggingFile); QTextStream out(&loggingFile);
out << "[Rules]\n"; out << "[Rules]\n";
out << "*Log.debug=false\n"; out << "*Log.debug=false\n";
foreach(QString category, QGCLoggingCategoryRegister::instance()->registeredCategories()) { foreach(const QString &category, QGCLoggingCategoryRegister::instance()->registeredCategories()) {
out << category << ".debug=false\n"; out << category << ".debug=false\n";
} }
} else { } else {
...@@ -737,7 +737,7 @@ void QGCApplication::_missingParamsDisplay(void) ...@@ -737,7 +737,7 @@ void QGCApplication::_missingParamsDisplay(void)
Q_ASSERT(_missingParams.count()); Q_ASSERT(_missingParams.count());
QString params; QString params;
foreach (QString name, _missingParams) { foreach (const QString &name, _missingParams) {
if (params.isEmpty()) { if (params.isEmpty()) {
params += name; params += name;
} else { } else {
......
...@@ -69,7 +69,7 @@ QStringList ParameterEditorController::searchParametersForComponent(int componen ...@@ -69,7 +69,7 @@ QStringList ParameterEditorController::searchParametersForComponent(int componen
{ {
QStringList list; QStringList list;
foreach(QString paramName, _autopilot->parameterNames(componentId)) { foreach(const QString &paramName, _autopilot->parameterNames(componentId)) {
if (searchText.isEmpty()) { if (searchText.isEmpty()) {
list += paramName; list += paramName;
} else { } else {
......
...@@ -98,7 +98,7 @@ void initializeVideoStreaming(int &argc, char* argv[]) ...@@ -98,7 +98,7 @@ void initializeVideoStreaming(int &argc, char* argv[])
qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0");
qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0");
// QStringList env = QProcessEnvironment::systemEnvironment().keys(); // QStringList env = QProcessEnvironment::systemEnvironment().keys();
// foreach(QString key, env) { // foreach(const QString &key, env) {
// qDebug() << key << QProcessEnvironment::systemEnvironment().value(key); // qDebug() << key << QProcessEnvironment::systemEnvironment().value(key);
// } // }
#endif #endif
......
...@@ -562,7 +562,7 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg) ...@@ -562,7 +562,7 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
uint16_t paramIndex = 0; uint16_t paramIndex = 0;
int cParameters = _mapParamName2Value[componentId].count(); int cParameters = _mapParamName2Value[componentId].count();
foreach(QString paramName, _mapParamName2Value[componentId].keys()) { foreach(const QString &paramName, _mapParamName2Value[componentId].keys()) {
char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN]; char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN];
mavlink_message_t responseMsg; mavlink_message_t responseMsg;
...@@ -596,7 +596,7 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg) ...@@ -596,7 +596,7 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
int cParameters = _mapParamName2Value[componentId].count(); int cParameters = _mapParamName2Value[componentId].count();
bool skipParam = true; bool skipParam = true;
foreach(QString paramName, _mapParamName2Value[componentId].keys()) { foreach(const QString &paramName, _mapParamName2Value[componentId].keys()) {
if (skipParam) { if (skipParam) {
// We've already sent the first param // We've already sent the first param
skipParam = false; skipParam = false;
......
...@@ -988,7 +988,7 @@ void QGCFlightGearLink::_printFgfsOutput(void) ...@@ -988,7 +988,7 @@ void QGCFlightGearLink::_printFgfsOutput(void)
QByteArray byteArray = _fgProcess->readAllStandardOutput(); QByteArray byteArray = _fgProcess->readAllStandardOutput();
QStringList strLines = QString(byteArray).split("\n"); QStringList strLines = QString(byteArray).split("\n");
foreach (QString line, strLines){ foreach (const QString &line, strLines){
qDebug() << line; qDebug() << line;
} }
} }
...@@ -1000,7 +1000,7 @@ void QGCFlightGearLink::_printFgfsError(void) ...@@ -1000,7 +1000,7 @@ void QGCFlightGearLink::_printFgfsError(void)
QByteArray byteArray = _fgProcess->readAllStandardError(); QByteArray byteArray = _fgProcess->readAllStandardError();
QStringList strLines = QString(byteArray).split("\n"); QStringList strLines = QString(byteArray).split("\n");
foreach (QString line, strLines){ foreach (const QString &line, strLines){
qDebug() << line; qDebug() << line;
} }
} }
......
...@@ -231,7 +231,7 @@ void UDPLink::_sendBytes(const char* data, qint64 size) ...@@ -231,7 +231,7 @@ void UDPLink::_sendBytes(const char* data, qint64 size)
} }
} while (_config->nextHost(host, port)); } while (_config->nextHost(host, port));
//-- Remove hosts that are no longer there //-- Remove hosts that are no longer there
foreach (QString ghost, goneHosts) { foreach (const QString& ghost, goneHosts) {
_config->removeHost(ghost); _config->removeHost(ghost);
} }
} }
......
...@@ -51,7 +51,7 @@ void MavlinkLogTest::init(void) ...@@ -51,7 +51,7 @@ void MavlinkLogTest::init(void)
// Make sure temp directory is clear of mavlink logs // Make sure temp directory is clear of mavlink logs
QDir tmpDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QDir tmpDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
QStringList logFiles(tmpDir.entryList(QStringList(QString("*.%1").arg(_logFileExtension)), QDir::Files)); QStringList logFiles(tmpDir.entryList(QStringList(QString("*.%1").arg(_logFileExtension)), QDir::Files));
foreach(QString logFile, logFiles) { foreach(const QString &logFile, logFiles) {
bool success = tmpDir.remove(logFile); bool success = tmpDir.remove(logFile);
Q_UNUSED(success); Q_UNUSED(success);
Q_ASSERT(success); Q_ASSERT(success);
......
...@@ -407,7 +407,7 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType) ...@@ -407,7 +407,7 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType)
QStringList switchList; QStringList switchList;
switchList << "RC_MAP_MODE_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_ACRO_SW"; switchList << "RC_MAP_MODE_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_ACRO_SW";
foreach (QString switchParam, switchList) { foreach (const QString &switchParam, switchList) {
Q_ASSERT(_autopilot->getParameterFact(FactSystem::defaultComponentId, switchParam)->rawValue().toInt() != channel + 1); Q_ASSERT(_autopilot->getParameterFact(FactSystem::defaultComponentId, switchParam)->rawValue().toInt() != channel + 1);
} }
} }
......
...@@ -183,7 +183,7 @@ void LinechartPlot::setActive(bool active) ...@@ -183,7 +183,7 @@ void LinechartPlot::setActive(bool active)
void LinechartPlot::removeTimedOutCurves() void LinechartPlot::removeTimedOutCurves()
{ {
foreach(QString key, lastUpdate.keys()) foreach(const QString &key, lastUpdate.keys())
{ {
quint64 time = lastUpdate.value(key); quint64 time = lastUpdate.value(key);
if (QGC::groundTimeMilliseconds() - time > 10000) if (QGC::groundTimeMilliseconds() - time > 10000)
...@@ -499,7 +499,7 @@ bool LinechartPlot::isVisible(QString id) ...@@ -499,7 +499,7 @@ bool LinechartPlot::isVisible(QString id)
bool LinechartPlot::anyCurveVisible() bool LinechartPlot::anyCurveVisible()
{ {
bool visible = false; bool visible = false;
foreach (QString key, curves.keys()) foreach (const QString &key, curves.keys())
{ {
if (curves.value(key)->isVisible()) if (curves.value(key)->isVisible())
{ {
......
...@@ -673,7 +673,7 @@ void LinechartWidget::removeCurve(QString curve) ...@@ -673,7 +673,7 @@ void LinechartWidget::removeCurve(QString curve)
void LinechartWidget::recolor() void LinechartWidget::recolor()
{ {
activePlot->styleChanged(qgcApp()->styleIsDark()); activePlot->styleChanged(qgcApp()->styleIsDark());
foreach (QString key, colorIcons.keys()) foreach (const QString &key, colorIcons.keys())
{ {
QWidget* colorIcon = colorIcons.value(key, 0); QWidget* colorIcon = colorIcons.value(key, 0);
if (colorIcon && !colorIcon->styleSheet().isEmpty()) if (colorIcon && !colorIcon->styleSheet().isEmpty())
...@@ -713,7 +713,7 @@ void LinechartWidget::filterCurves(const QString &filter) ...@@ -713,7 +713,7 @@ void LinechartWidget::filterCurves(const QString &filter)
{ {
/* Hide Elements which do not match the filter pattern */ /* Hide Elements which do not match the filter pattern */
QStringMatcher stringMatcher(filter, Qt::CaseInsensitive); QStringMatcher stringMatcher(filter, Qt::CaseInsensitive);
foreach (QString key, colorIcons.keys()) foreach (const QString &key, colorIcons.keys())
{ {
if (stringMatcher.indexIn(key) < 0) if (stringMatcher.indexIn(key) < 0)
{ {
...@@ -728,7 +728,7 @@ void LinechartWidget::filterCurves(const QString &filter) ...@@ -728,7 +728,7 @@ void LinechartWidget::filterCurves(const QString &filter)
else else
{ {
/* Show all Elements */ /* Show all Elements */
foreach (QString key, colorIcons.keys()) foreach (const QString &key, colorIcons.keys())
{ {
filterCurve(key, true); filterCurve(key, true);
} }
...@@ -796,7 +796,7 @@ QString LinechartWidget::getCurveName(const QString& key, bool shortEnabled) ...@@ -796,7 +796,7 @@ QString LinechartWidget::getCurveName(const QString& key, bool shortEnabled)
void LinechartWidget::setShortNames(bool enable) void LinechartWidget::setShortNames(bool enable)
{ {
foreach (QString key, curveNames.keys()) foreach (const QString &key, curveNames.keys())
{ {
curveNameLabels.value(key)->setText(getCurveName(key, enable)); curveNameLabels.value(key)->setText(getCurveName(key, enable));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment