Commit 29db9519 authored by Patrick José Pereira's avatar Patrick José Pereira

VehicleSetup: Change from foreach to c++11 for

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent dce90f44
......@@ -354,7 +354,7 @@ void FirmwareUpgradeController::_initFirmwareHash()
#endif
// PX4 Firmwares
foreach (const FirmwareType_t& firmwareType, px4MapFirmwareTypeToDir.keys()) {
for (const FirmwareType_t& firmwareType: px4MapFirmwareTypeToDir.keys()) {
QString dir = px4MapFirmwareTypeToDir[firmwareType];
_rgPX4FMUV5Firmware.insert (FirmwareIdentifier(AutoPilotStackPX4, firmwareType, DefaultVehicleFirmware), px4Url.arg(dir).arg("v5"));
_rgPX4FMUV4PROFirmware.insert (FirmwareIdentifier(AutoPilotStackPX4, firmwareType, DefaultVehicleFirmware), px4Url.arg(dir).arg("v4pro"));
......@@ -365,9 +365,9 @@ void FirmwareUpgradeController::_initFirmwareHash()
#if !defined(NO_ARDUPILOT_DIALECT)
// ArduPilot Firmwares
foreach (const FirmwareType_t& firmwareType, apmMapFirmwareTypeToDir.keys()) {
for (const FirmwareType_t& firmwareType: apmMapFirmwareTypeToDir.keys()) {
QString firmwareTypeDir = apmMapFirmwareTypeToDir[firmwareType];
foreach (const FirmwareVehicleType_t& vehicleType, apmMapVehicleTypeToDir.keys()) {
for (const FirmwareVehicleType_t& vehicleType: apmMapVehicleTypeToDir.keys()) {
QString vehicleTypeDir = apmMapVehicleTypeToDir[vehicleType];
QString px4Dir = apmMapVehicleTypeToPX4Dir[vehicleType];
QString filename = apmMapVehicleTypeToFilename[vehicleType];
......@@ -382,9 +382,9 @@ void FirmwareUpgradeController::_initFirmwareHash()
#if !defined(NO_ARDUPILOT_DIALECT)
// ArduPilot ChibiOS Firmwares
foreach (const FirmwareType_t& firmwareType, apmMapFirmwareTypeToDir.keys()) {
for (const FirmwareType_t& firmwareType: apmMapFirmwareTypeToDir.keys()) {
QString firmwareTypeDir = apmMapFirmwareTypeToDir[firmwareType];
foreach (const FirmwareVehicleType_t& vehicleType, apmChibiOSMapVehicleTypeToDir.keys()) {
for (const FirmwareVehicleType_t& vehicleType: apmChibiOSMapVehicleTypeToDir.keys()) {
QString vehicleTypeDir = apmChibiOSMapVehicleTypeToDir[vehicleType];
QString fmuDir = apmChibiOSMapVehicleTypeToFmuDir[vehicleType];
QString filename = apmChibiOSMapVehicleTypeToFilename[vehicleType];
......@@ -692,7 +692,7 @@ void FirmwareUpgradeController::_loadAPMVersions(uint32_t bootloaderBoardID)
QHash<FirmwareIdentifier, QString>* prgFirmware = _firmwareHashForBoardId(static_cast<int>(bootloaderBoardID));
foreach (FirmwareIdentifier firmwareId, prgFirmware->keys()) {
for (FirmwareIdentifier firmwareId: prgFirmware->keys()) {
if (firmwareId.autopilotStackType == AutoPilotStackAPM) {
QString versionFile = QFileInfo(prgFirmware->value(firmwareId)).path() + "/git-version.txt";
......@@ -733,7 +733,7 @@ void FirmwareUpgradeController::_apmVersionDownloadFinished(QString remoteFile,
QHash<FirmwareIdentifier, QString>* prgFirmware = _firmwareHashForBoardId(static_cast<int>(_bootloaderBoardID));
QString remotePath = QFileInfo(remoteFile).path();
foreach (FirmwareIdentifier firmwareId, prgFirmware->keys()) {
for (FirmwareIdentifier firmwareId: prgFirmware->keys()) {
if (remotePath == QFileInfo((*prgFirmware)[firmwareId]).path()) {
qCDebug(FirmwareUpgradeLog) << "Adding version to map, version:firwmareType:vehicleType" << version << firmwareId.firmwareType << firmwareId.firmwareVehicleType;
_apmVersionMap[firmwareId.firmwareType][firmwareId.firmwareVehicleType] = version;
......@@ -761,7 +761,7 @@ QStringList FirmwareUpgradeController::apmAvailableVersions(void)
_apmVehicleTypeFromCurrentVersionList.clear();
foreach (FirmwareVehicleType_t vehicleType, vehicleTypes) {
for (FirmwareVehicleType_t vehicleType: vehicleTypes) {
if (_apmVersionMap[_selectedFirmwareType].contains(vehicleType)) {
QString version;
......
......@@ -119,7 +119,7 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void)
bool PX4FirmwareUpgradeThreadWorker::_findBoardFromPorts(QGCSerialPortInfo& portInfo, QGCSerialPortInfo::BoardType_t& boardType, QString& boardName)
{
foreach (QGCSerialPortInfo info, QGCSerialPortInfo::availablePorts()) {
for (QGCSerialPortInfo info: QGCSerialPortInfo::availablePorts()) {
info.getBoardInfo(boardType, boardName);
qCDebug(FirmwareUpgradeVerboseLog) << "Serial Port --------------";
......
......@@ -54,7 +54,7 @@ void VehicleComponent::addSummaryQmlComponent(QQmlContext* context, QQuickItem*
void VehicleComponent::setupTriggerSignals(void)
{
// Watch for changed on trigger list params
foreach (const QString &paramName, setupCompleteChangedTriggerList()) {
for (const QString &paramName: setupCompleteChangedTriggerList()) {
if (_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, paramName)) {
Fact* fact = _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, paramName);
connect(fact, &Fact::valueChanged, this, &VehicleComponent::_triggerUpdated);
......
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