void Profile::Load(const ProfileMap &map, TaskBehaviour &settings) { Load(map, settings.glide); map.Get(ProfileKeys::AATTimeMargin, settings.optimise_targets_margin); map.Get(ProfileKeys::AutoMc, settings.auto_mc); map.GetEnum(ProfileKeys::AutoMcMode, settings.auto_mc_mode); unsigned Temp; if (map.Get(ProfileKeys::RiskGamma, Temp)) settings.risk_gamma = fixed(Temp) / 10; if (map.Get(ProfileKeys::SafetyMacCready, Temp)) settings.safety_mc = fixed(Temp) / 10; map.Get(ProfileKeys::SafetyAltitudeArrival, settings.safety_height_arrival); map.GetEnum(ProfileKeys::TaskType, settings.task_type_default); Load(map, settings.start_margins); Load(map, settings.sector_defaults); Load(map, settings.ordered_defaults); map.GetEnum(ProfileKeys::AbortTaskMode, settings.abort_task_mode); Load(map, settings.route_planner); }
void Profile::Load(const ProfileMap &map, DialogSettings &settings) { map.GetEnum(ProfileKeys::AppTextInputStyle, settings.text_input_style); map.GetEnum(ProfileKeys::AppDialogTabStyle, settings.tab_style); map.Get(ProfileKeys::UserLevel, settings.expert); }
void Profile::Load(const ProfileMap &map, UISettings &settings) { Load(map, settings.display); map.Get(ProfileKeys::MenuTimeout, settings.menu_timeout); #ifndef GNAV map.Get(ProfileKeys::UIScale, settings.scale); if (settings.scale < 50 || settings.scale > 200) settings.scale = 100; #endif map.Get(ProfileKeys::EnableTAGauge, settings.enable_thermal_assistant_gauge); map.Get(ProfileKeys::AirspaceWarningDialog, settings.enable_airspace_warning_dialog); map.GetEnum(ProfileKeys::AppStatusMessageAlignment, settings.popup_message_position); map.GetEnum(ProfileKeys::HapticFeedback, settings.haptic_feedback); Load(map, settings.format); Load(map, settings.map); Load(map, settings.info_boxes); Load(map, settings.vario); Load(map, settings.traffic); Load(map, settings.pages); Load(map, settings.dialog); Load(map, settings.sound); }
void Profile::Load(const ProfileMap &map, TrailSettings &settings) { map.Get(ProfileKeys::TrailDrift, settings.wind_drift_enabled); map.Get(ProfileKeys::SnailWidthScale, settings.scaling_enabled); map.GetEnum(ProfileKeys::SnailType, settings.type); map.GetEnum(ProfileKeys::SnailTrail, settings.length); }
void Profile::Load(const ProfileMap &map, SectorDefaults &settings) { map.GetEnum(ProfileKeys::StartType, settings.start_type); map.Get(ProfileKeys::StartRadius, settings.start_radius); map.GetEnum(ProfileKeys::TurnpointType, settings.turnpoint_type); map.Get(ProfileKeys::TurnpointRadius, settings.turnpoint_radius); map.GetEnum(ProfileKeys::FinishType, settings.finish_type); map.Get(ProfileKeys::FinishRadius, settings.finish_radius); }
void Profile::Load(const ProfileMap &map, FeaturesSettings &settings) { map.GetEnum(ProfileKeys::FinalGlideTerrain, settings.final_glide_terrain); map.Get(ProfileKeys::BlockSTF, settings.block_stf_enabled); map.Get(ProfileKeys::EnableNavBaroAltitude, settings.nav_baro_altitude_enabled); }
void Profile::Load(const ProfileMap &map, ComputerSettings &settings) { Load(map, settings.wind); Load(map, settings.polar); Load(map, settings.team_code); Load(map, settings.voice); Load(map, settings.poi); Load(map, settings.features); Load(map, settings.airspace); Load(map, settings.circling); Load(map, settings.wave); map.GetEnum(ProfileKeys::AverEffTime, settings.average_eff_time); map.Get(ProfileKeys::SetSystemTimeFromGPS, settings.set_system_time_from_gps); LoadUTCOffset(map, settings.utc_offset); Load(map, settings.task); Load(map, settings.contest); Load(map, settings.logger); #ifdef HAVE_TRACKING Load(map, settings.tracking); #endif Load(map, settings.weather); }
void Profile::Load(const ProfileMap &map, StartConstraints &constraints) { map.GetEnum(ProfileKeys::StartHeightRef, constraints.max_height_ref); map.Get(ProfileKeys::StartMaxHeight, constraints.max_height); map.Get(ProfileKeys::StartMaxSpeed, constraints.max_speed); }
static void Load(const ProfileMap &map, FAITriangleSettings &settings) { FAITriangleSettings::Threshold threshold; if (map.GetEnum(ProfileKeys::FAITriangleThreshold, threshold) && unsigned(threshold) < unsigned(FAITriangleSettings::Threshold::MAX)) settings.threshold = threshold; }
void Profile::Load(const ProfileMap &map, AirspaceRendererSettings &settings) { map.GetEnum(ProfileKeys::AirspaceLabelSelection, settings.label_selection); map.Get(ProfileKeys::AirspaceBlackOutline, settings.black_outline); map.GetEnum(ProfileKeys::AltMode, settings.altitude_mode); map.Get(ProfileKeys::ClipAlt, settings.clip_altitude); #if defined(HAVE_HATCHED_BRUSH) && defined(HAVE_ALPHA_BLEND) map.Get(ProfileKeys::AirspaceTransparency, settings.transparency); #endif map.GetEnum(ProfileKeys::AirspaceFillMode, settings.fill_mode); for (unsigned i = 0; i < AIRSPACECLASSCOUNT; i++) Load(map, i, settings.classes[i]); }
void Profile::Load(const ProfileMap &map, TrafficSettings &settings) { map.Get(ProfileKeys::EnableFLARMGauge, settings.enable_gauge); map.Get(ProfileKeys::AutoCloseFlarmDialog, settings.auto_close_dialog); map.Get(ProfileKeys::FlarmAutoZoom, settings.auto_zoom); map.Get(ProfileKeys::FlarmNorthUp, settings.north_up); map.GetEnum(ProfileKeys::FlarmLocation, settings.gauge_location); }
static bool GetPressureUnit(const ProfileMap &map, const char *key, Unit &value) { Unit tmp; if (!map.GetEnum(key, tmp) || !ValidPressureUnit(tmp)) return false; value = tmp; return true; }
void Profile::Load(const ProfileMap &map, ContestSettings &settings) { if (map.GetEnum(ProfileKeys::OLCRules, settings.contest)) { /* handle out-dated Sprint rule in profile */ if (settings.contest == Contest::OLC_SPRINT) settings.contest = Contest::OLC_LEAGUE; } map.Get(ProfileKeys::PredictContest, settings.predict); }
void Profile::Load(const ProfileMap &map, TrackingSettings &settings) { #ifdef HAVE_LIVETRACK24 map.Get(ProfileKeys::TrackingInterval, settings.interval); map.GetEnum(ProfileKeys::TrackingVehicleType, settings.vehicleType); map.Get(ProfileKeys::TrackingVehicleName, settings.vehicle_name); #endif #ifdef HAVE_SKYLINES_TRACKING Load(map, settings.skylines); #endif #ifdef HAVE_LIVETRACK24 Load(map, settings.livetrack24); #endif }
static bool GetSpeedUnit(const ProfileMap &map, const char *key, const char *legacy_key, Unit &value_r) { Unit tmp; if (!map.GetEnum(key, tmp)) /* migrate from XCSoar <= 6.2 profile */ return GetLegacySpeedUnit(map, legacy_key, value_r); if (!ValidSpeedUnit(tmp)) return false; value_r = tmp; return true; }
void Profile::Load(const ProfileMap &map, LoggerSettings &settings) { map.Get(ProfileKeys::LoggerTimeStepCruise, settings.time_step_cruise); map.Get(ProfileKeys::LoggerTimeStepCircling, settings.time_step_circling); if (!map.GetEnum(ProfileKeys::AutoLogger, settings.auto_logger)) { // Legacy bool disable_auto_logger; if (map.Get(ProfileKeys::DisableAutoLogger, disable_auto_logger)) settings.auto_logger = disable_auto_logger ? LoggerSettings::AutoLogger::OFF : LoggerSettings::AutoLogger::ON; } map.Get(ProfileKeys::LoggerID, settings.logger_id); map.Get(ProfileKeys::PilotName, settings.pilot_name); map.Get(ProfileKeys::EnableFlightLogger, settings.enable_flight_logger); map.Get(ProfileKeys::EnableNMEALogger, settings.enable_nmea_logger); }
void Profile::Load(const ProfileMap &map, unsigned i, AirspaceClassRendererSettings &settings) { char name[64]; MakeAirspaceSettingName(name, "AirspaceDisplay", i); if (!map.Get(name, settings.display)) { // Load setting from legacy key-value pair MakeAirspaceSettingName(name, "AirspaceMode", i); unsigned value; if (map.Get(name, value)) settings.display = (value & 0x1) != 0; } #ifdef HAVE_HATCHED_BRUSH MakeAirspaceSettingName(name, "Brush", i); map.Get(name, settings.brush); if (settings.brush >= ARRAY_SIZE(AirspaceLook::brushes)) settings.brush = 0; #endif MakeAirspaceSettingName(name, "AirspaceBorderColor", i); if (!map.GetColor(name, settings.border_color)) GetAirspaceColor(map, i, settings.border_color); MakeAirspaceSettingName(name, "AirspaceFillColor", i); if (!map.GetColor(name, settings.fill_color)) GetAirspaceColor(map, i, settings.fill_color); MakeAirspaceSettingName(name, "AirspaceBorderWidth", i); map.Get(name, settings.border_width); MakeAirspaceSettingName(name, "AirspaceFillMode", i); map.GetEnum(name, settings.fill_mode); }
void Profile::Load(const ProfileMap &map, DisplaySettings &settings) { map.Get(ProfileKeys::AutoBlank, settings.enable_auto_blank); map.GetEnum(ProfileKeys::MapOrientation, settings.orientation); }
void Profile::GetDeviceConfig(const ProfileMap &map, unsigned n, DeviceConfig &config) { char buffer[64]; bool have_port_type = ReadPortType(map, n, config.port_type); MakeDeviceSettingName(buffer, "Port", n, "BluetoothMAC"); map.Get(buffer, config.bluetooth_mac); MakeDeviceSettingName(buffer, "Port", n, "IOIOUartID"); map.Get(buffer, config.ioio_uart_id); MakeDeviceSettingName(buffer, "Port", n, "IPAddress"); if (!map.Get(buffer, config.ip_address)) config.ip_address.clear(); MakeDeviceSettingName(buffer, "Port", n, "TCPPort"); if (!map.Get(buffer, config.tcp_port)) config.tcp_port = 4353; config.path.clear(); if ((!have_port_type || config.port_type == DeviceConfig::PortType::SERIAL) && !LoadPath(map, config, n) && LoadPortIndex(map, config, n)) config.port_type = DeviceConfig::PortType::SERIAL; MakeDeviceSettingName(buffer, "Port", n, "BaudRate"); if (!map.Get(buffer, config.baud_rate)) { /* XCSoar before 6.2 used to store a "speed index", not the real baud rate - try to import the old settings */ static constexpr unsigned speed_index_table[] = { 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 }; MakeDeviceSettingName(buffer, "Speed", n, "Index"); unsigned speed_index; if (map.Get(buffer, speed_index) && speed_index < ARRAY_SIZE(speed_index_table)) config.baud_rate = speed_index_table[speed_index]; } MakeDeviceSettingName(buffer, "Port", n, "BulkBaudRate"); if (!map.Get(buffer, config.bulk_baud_rate)) config.bulk_baud_rate = 0; strcpy(buffer, "DeviceA"); buffer[strlen(buffer) - 1] += n; map.Get(buffer, config.driver_name); MakeDeviceSettingName(buffer, "Port", n, "Enabled"); map.Get(buffer, config.enabled); MakeDeviceSettingName(buffer, "Port", n, "SyncFromDevice"); map.Get(buffer, config.sync_from_device); MakeDeviceSettingName(buffer, "Port", n, "SyncToDevice"); map.Get(buffer, config.sync_to_device); MakeDeviceSettingName(buffer, "Port", n, "K6Bt"); map.Get(buffer, config.k6bt); MakeDeviceSettingName(buffer, "Port", n, "I2C_Bus"); map.Get(buffer, config.i2c_bus); MakeDeviceSettingName(buffer, "Port", n, "I2C_Addr"); map.Get(buffer, config.i2c_addr); MakeDeviceSettingName(buffer, "Port", n, "PressureUse"); map.GetEnum(buffer, config.press_use); MakeDeviceSettingName(buffer, "Port", n, "SensorOffset"); map.Get(buffer, config.sensor_offset); MakeDeviceSettingName(buffer, "Port", n, "SensorFactor"); map.Get(buffer, config.sensor_factor); MakeDeviceSettingName(buffer, "Port", n, "UseSecondDevice"); map.Get(buffer, config.use_second_device); MakeDeviceSettingName(buffer, "Port", n, "SecondDevice"); map.Get(buffer, config.driver2_name); }
void Profile::Load(const ProfileMap &map, MapSettings &settings) { map.Get(ProfileKeys::CircleZoom, settings.circle_zoom_enabled); map.Get(ProfileKeys::MaxAutoZoomDistance, settings.max_auto_zoom_distance); map.Get(ProfileKeys::DrawTopography, settings.topography_enabled); LoadTerrainRendererSettings(map, settings.terrain); map.GetEnum(ProfileKeys::AircraftSymbol, settings.aircraft_symbol); map.Get(ProfileKeys::DetourCostMarker, settings.detour_cost_markers_enabled); map.GetEnum(ProfileKeys::DisplayTrackBearing, settings.display_ground_track); map.Get(ProfileKeys::AutoZoom, settings.auto_zoom_enabled); map.GetEnum(ProfileKeys::WindArrowStyle, settings.wind_arrow_style); settings.waypoint.LoadFromProfile(); Load(map, settings.airspace); map.Get(ProfileKeys::GliderScreenPosition, settings.glider_screen_position); bool orientation_found = false; unsigned Temp = (unsigned)MapOrientation::NORTH_UP; if (map.Get(ProfileKeys::OrientationCircling, Temp)) { orientation_found = true; if (IsValidMapOrientation(Temp)) settings.circling_orientation = (MapOrientation)Temp; } Temp = (unsigned)MapOrientation::NORTH_UP; if (map.Get(ProfileKeys::OrientationCruise, Temp)) { orientation_found = true; if (IsValidMapOrientation(Temp)) settings.cruise_orientation = (MapOrientation)Temp; } if (!orientation_found) { Temp = 1; map.Get(ProfileKeys::DisplayUpValue, Temp); switch (Temp) { case 0: settings.cruise_orientation = MapOrientation::TRACK_UP; settings.circling_orientation = MapOrientation::TRACK_UP; break; case 1: settings.cruise_orientation = MapOrientation::NORTH_UP; settings.circling_orientation = MapOrientation::NORTH_UP; break; case 2: settings.cruise_orientation = MapOrientation::TRACK_UP; settings.circling_orientation = MapOrientation::NORTH_UP; break; case 3: settings.cruise_orientation = MapOrientation::TRACK_UP; settings.circling_orientation = MapOrientation::TARGET_UP; break; case 4: settings.cruise_orientation = MapOrientation::NORTH_UP; settings.circling_orientation = MapOrientation::TRACK_UP; break; } } fixed tmp; if (map.Get(ProfileKeys::ClimbMapScale, tmp)) settings.circling_scale = Clamp(tmp / 10000, fixed(0.0003), fixed(10)); if (map.Get(ProfileKeys::CruiseMapScale, tmp)) settings.cruise_scale = Clamp(tmp / 10000, fixed(0.0003), fixed(10)); map.GetEnum(ProfileKeys::MapShiftBias, settings.map_shift_bias); map.Get(ProfileKeys::EnableFLARMMap, settings.show_flarm_on_map); map.Get(ProfileKeys::EnableThermalProfile, settings.show_thermal_profile); map.Get(ProfileKeys::EnableFinalGlideBarMC0, settings.final_glide_bar_mc0_enabled); map.GetEnum(ProfileKeys::FinalGlideBarDisplayMode, settings.final_glide_bar_display_mode); map.Get(ProfileKeys::ShowFAITriangleAreas, settings.show_fai_triangle_areas); ::Load(map, settings.fai_triangle_settings); map.Get(ProfileKeys::EnableVarioBar, settings.vario_bar_enabled); Load(map, settings.trail); Load(map, settings.item_list); }
void Profile::Load(const ProfileMap &map, FinishConstraints &constraints) { map.GetEnum(ProfileKeys::FinishHeightRef, constraints.min_height_ref); map.Get(ProfileKeys::FinishMinHeight, constraints.min_height); }
void Profile::Load(const ProfileMap &map, FormatSettings &settings) { map.GetEnum(ProfileKeys::LatLonUnits, settings.coordinate_format); LoadUnits(map, settings.units); }