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, 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, StartConstraints &constraints) { map.GetEnum(ProfileKeys::StartHeightRef, constraints.max_height_ref); map.Get(ProfileKeys::StartMaxHeight, constraints.max_height); map.Get(ProfileKeys::StartMaxSpeed, constraints.max_speed); }
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, SoundSettings &settings) { map.Get(ProfileKeys::SoundTask, settings.sound_task_enabled); map.Get(ProfileKeys::SoundModes, settings.sound_modes_enabled); map.Get(ProfileKeys::SoundDeadband, settings.sound_deadband); Load(map, settings.vario); }
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); }
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, PolarSettings &settings) { fixed degradation; if (map.Get(ProfileKeys::PolarDegradation, degradation) && degradation >= fixed(0.5) && degradation <= fixed(1)) settings.SetDegradationFactor(degradation); map.Get(ProfileKeys::AutoBugs, settings.auto_bugs); }
static void Load(const ProfileMap &map, SkyLinesTracking::Settings &settings) { map.Get(ProfileKeys::SkyLinesTrackingEnabled, settings.enabled); map.Get(ProfileKeys::SkyLinesRoaming, settings.roaming); map.Get(ProfileKeys::SkyLinesTrackingInterval, settings.interval); map.Get(ProfileKeys::SkyLinesTrafficEnabled, settings.traffic_enabled); const char *key = map.Get(ProfileKeys::SkyLinesTrackingKey); if (key != NULL) settings.key = ParseUint64(key, NULL, 16); }
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 }
void Profile::Load(const ProfileMap &map, LiveTrack24Settings &settings) { map.Get(ProfileKeys::LiveTrack24Enabled, settings.enabled); if (!map.Get(ProfileKeys::LiveTrack24Server, settings.server)) settings.server = _T("www.livetrack24.com"); else if (StringIsEqual(settings.server, _T("livexc.dhv1.de"))) { // DHV tracking server moved to new host (#3208) settings.server = _T("livexc.dhv.de"); } map.Get(ProfileKeys::LiveTrack24Username, settings.username); map.Get(ProfileKeys::LiveTrack24Password, settings.password); }
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); }
static bool GetLegacyTemperatureUnit(const ProfileMap &map, const char *key, Unit &value) { unsigned tmp; return map.Get(key, tmp) && ApplyUnit(value, ImportTemperatureUnit(tmp)); }
static bool LoadPath(const ProfileMap &map, DeviceConfig &config, unsigned n) { char buffer[64]; MakeDeviceSettingName(buffer, "Port", n, "Path"); return map.Get(buffer, config.path); }
void Profile::Load(const ProfileMap &map, OrderedTaskSettings &settings) { Load(map, settings.start_constraints); Load(map, settings.finish_constraints); map.Get(ProfileKeys::AATMinTime, settings.aat_min_time); }
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, WindSettings &settings) { unsigned auto_wind_mode = settings.GetLegacyAutoWindMode(); if (map.Get(ProfileKeys::AutoWind, auto_wind_mode)) settings.SetLegacyAutoWindMode(auto_wind_mode); }
void Profile::Load(const ProfileMap &map, PlacesOfInterestSettings &settings) { map.Get(ProfileKeys::HomeWaypoint, settings.home_waypoint); settings.home_location_available = map.GetGeoPoint(ProfileKeys::HomeLocation, settings.home_location); }
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]); }
static bool ReadPortType(const ProfileMap &map, unsigned n, DeviceConfig::PortType &type) { char name[64]; MakeDeviceSettingName(name, "Port", n, "Type"); const char *value = map.Get(name); return value != NULL && StringToPortType(value, type); }
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, VoiceSettings &settings) { map.Get(ProfileKeys::VoiceClimbRate, settings.voice_climb_rate_enabled); map.Get(ProfileKeys::VoiceTerrain, settings.voice_terrain_enabled); map.Get(ProfileKeys::VoiceWaypointDistance, settings.voice_waypoint_distance_enabled); map.Get(ProfileKeys::VoiceTaskAltitudeDifference, settings.voice_task_altitude_difference_enabled); map.Get(ProfileKeys::VoiceMacCready, settings.voice_mac_cready_enabled); map.Get(ProfileKeys::VoiceNewWaypoint, settings.voice_new_waypoint_enabled); map.Get(ProfileKeys::VoiceInSector, settings.voice_in_sector_enabled); map.Get(ProfileKeys::VoiceAirspace, settings.voice_airspace_enabled); }
void Profile::Load(const ProfileMap &map, VarioSettings &settings) { map.Get(ProfileKeys::AppGaugeVarioSpeedToFly, settings.show_speed_to_fly); map.Get(ProfileKeys::AppGaugeVarioAvgText, settings.show_average); map.Get(ProfileKeys::AppGaugeVarioMc, settings.show_mc); map.Get(ProfileKeys::AppGaugeVarioBugs, settings.show_bugs); map.Get(ProfileKeys::AppGaugeVarioBallast, settings.show_ballast); map.Get(ProfileKeys::AppGaugeVarioGross, settings.show_gross); map.Get(ProfileKeys::AppAveNeedle, settings.show_average_needle); }
static bool LoadUTCOffset(const ProfileMap &map, RoughTimeDelta &value_r) { /* NOTE: Until 6.2.4 utc_offset was stored as a positive int in the settings file (with negative offsets stored as "utc_offset + 24 * 3600"). Later versions will create a new signed settings key. */ int value; if (map.Get(ProfileKeys::UTCOffsetSigned, value)) { } else if (map.Get(ProfileKeys::UTCOffset, value)) { if (value > 12 * 3600) value = (value % (24 * 3600)) - 24 * 3600; } else /* no profile value present */ return false; if (value > 13 * 3600 || value < -13 * 3600) /* illegal value */ return false; value_r = RoughTimeDelta::FromSeconds(value); return true; }
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, VarioSoundSettings &settings) { map.Get(ProfileKeys::SoundAudioVario, settings.enabled); map.Get(ProfileKeys::SoundVolume, settings.volume); map.Get(ProfileKeys::VarioDeadBandEnabled, settings.dead_band_enabled); map.Get(ProfileKeys::VarioMinFrequency, settings.min_frequency); map.Get(ProfileKeys::VarioZeroFrequency, settings.zero_frequency); map.Get(ProfileKeys::VarioMaxFrequency, settings.max_frequency); map.Get(ProfileKeys::VarioMinPeriod, settings.min_period_ms); map.Get(ProfileKeys::VarioMaxPeriod, settings.max_period_ms); map.Get(ProfileKeys::VarioDeadBandMin, settings.min_dead); map.Get(ProfileKeys::VarioDeadBandMax, settings.max_dead); }
ProfilePasswordResult CheckProfilePassword(const ProfileMap &map) { /* oh no, profile passwords are not truly secure! */ StringBuffer<TCHAR, 80> profile_password; if (!map.Get(ProfileKeys::Password, profile_password)) /* not password protected */ return ProfilePasswordResult::UNPROTECTED; StringBuffer<TCHAR, 80> user_password; user_password.clear(); if (!TextEntryDialog(user_password, _("Enter your password"))) return ProfilePasswordResult::CANCEL; return StringIsEqualIgnoreCase(profile_password, user_password) ? ProfilePasswordResult::MATCH : ProfilePasswordResult::MISMATCH; }
static bool LoadPortIndex(const ProfileMap &map, DeviceConfig &config, unsigned n) { char buffer[64]; MakeDeviceSettingName(buffer, "Port", n, "Index"); unsigned index; if (!map.Get(buffer, index)) return false; /* adjust the number, compatibility quirk for XCSoar 5 */ if (index < 10) ++index; else if (index == 10) index = 0; TCHAR path[64]; _stprintf(path, _T("COM%u:"), index); config.path = path; 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); }