From 6f64b236adfa56e198d4885ad57c3b19d895acaf Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Thu, 16 Jun 2016 16:28:22 -0400 Subject: [PATCH] Use QGroundControlQmlGlobal::offlineEditingFirmwareType to load offline mission type Instantiating QSettings on the stack is quite expensive (full file read+parse each time) and this was done in a tight loop with mission items as they were dragged. Very slow. --- src/MissionManager/MissionCommands.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/MissionManager/MissionCommands.cc b/src/MissionManager/MissionCommands.cc index 9e42ea340..5a3c57d19 100644 --- a/src/MissionManager/MissionCommands.cc +++ b/src/MissionManager/MissionCommands.cc @@ -86,12 +86,7 @@ MAV_AUTOPILOT MissionCommands::_firmwareTypeFromVehicle(Vehicle* vehicle) const if (vehicle) { return vehicle->firmwareType(); } else { - QSettings settings; - - // FIXME: Hack duplicated code from QGroundControlQmlGlobal. Had to do this for now since - // QGroundControlQmlGlobal is not available from C++ side. - - return (MAV_AUTOPILOT)settings.value("OfflineEditingFirmwareType", MAV_AUTOPILOT_ARDUPILOTMEGA).toInt(); + return (MAV_AUTOPILOT)QGroundControlQmlGlobal::offlineEditingFirmwareType()->rawValue().toInt(); } } -- 2.22.0