bool
MapDisplayConfigPanel::Save(bool &_changed)
{
    bool changed = false;

    MapSettings &settings_map = CommonInterface::SetMapSettings();
    PageSettings &page_settings = CommonInterface::SetUISettings().pages;

    changed |= SaveValueEnum(OrientationCruise, ProfileKeys::OrientationCruise,
                             settings_map.cruise_orientation);

    changed |= SaveValueEnum(OrientationCircling, ProfileKeys::OrientationCircling,
                             settings_map.circling_orientation);

    changed |= SaveValueEnum(MAP_SHIFT_BIAS, ProfileKeys::MapShiftBias,
                             settings_map.map_shift_bias);

    changed |= SaveValue(GliderScreenPosition, ProfileKeys::GliderScreenPosition,
                         settings_map.glider_screen_position);

    changed |= SaveValue(CirclingZoom, ProfileKeys::CircleZoom,
                         settings_map.circle_zoom_enabled);

    changed |= SaveValue(MaxAutoZoomDistance, UnitGroup::DISTANCE,
                         ProfileKeys::MaxAutoZoomDistance,
                         settings_map.max_auto_zoom_distance);

    changed |= SaveValue(PAGES_DISTINCT_ZOOM, ProfileKeys::PagesDistinctZoom,
                         page_settings.distinct_zoom);

    _changed |= changed;

    return true;
}
bool
WaypointDisplayConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  WaypointRendererSettings &settings = CommonInterface::SetMapSettings().waypoint;

  changed |= SaveValueEnum(WaypointLabels, ProfileKeys::DisplayText, settings.display_text_type);

  changed |= SaveValueEnum(WaypointArrivalHeightDisplay, ProfileKeys::WaypointArrivalHeightDisplay,
                           settings.arrival_height_display);

  changed |= SaveValueEnum(WaypointLabelStyle, ProfileKeys::WaypointLabelStyle,
                           settings.landable_render_mode);

  changed |= SaveValueEnum(WaypointLabelSelection, ProfileKeys::WaypointLabelSelection,
                           settings.label_selection);

  changed |= SaveValueEnum(AppIndLandable, ProfileKeys::AppIndLandable, settings.landable_style);

  changed |= SaveValue(AppUseSWLandablesRendering, ProfileKeys::AppUseSWLandablesRendering,
                       settings.vector_landable_rendering);

  changed |= SaveValue(AppLandableRenderingScale, ProfileKeys::AppLandableRenderingScale,
                       settings.landable_rendering_scale);

  changed |= SaveValue(AppScaleRunwayLength, ProfileKeys::AppScaleRunwayLength,
                       settings.scale_runway_length);

  _changed |= changed;

  return true;
}
Exemple #3
0
bool
TaskRulesConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings();
  TaskBehaviour &task_behaviour = settings_computer.task;
  OrderedTaskBehaviour &otb = task_behaviour.ordered_defaults;

  changed |= SaveValue(StartMaxSpeed, UnitGroup::HORIZONTAL_SPEED, ProfileKeys::StartMaxSpeed, otb.start_max_speed);

  changed |= SaveValue(StartMaxSpeedMargin, UnitGroup::HORIZONTAL_SPEED, ProfileKeys::StartMaxSpeedMargin,
                       task_behaviour.start_max_speed_margin);

  changed |= SaveValue(StartMaxHeight, UnitGroup::ALTITUDE, ProfileKeys::StartMaxHeight, otb.start_max_height);

  changed |= SaveValue(StartMaxHeightMargin, UnitGroup::ALTITUDE, ProfileKeys::StartMaxHeightMargin,
                       task_behaviour.start_max_height_margin);

  changed |= SaveValueEnum(StartHeightRef, ProfileKeys::StartHeightRef, otb.start_max_height_ref);

  changed |= SaveValue(FinishMinHeight, UnitGroup::ALTITUDE, ProfileKeys::FinishMinHeight,
                       otb.finish_min_height);

  changed |= SaveValueEnum(FinishHeightRef, ProfileKeys::FinishHeightRef, otb.finish_min_height_ref);

  changed |= SaveValueEnum(Contests, ProfileKeys::OLCRules, task_behaviour.contest);
  changed |= SaveValueEnum(PREDICT_CONTEST, ProfileKeys::PredictContest,
                           task_behaviour.predict_contest);

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
RouteConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;
  ComputerSettings &settings_computer = CommonInterface::SetComputerSettings();
  RoutePlannerConfig &route_planner = settings_computer.task.route_planner;

  changed |= SaveValueEnum(RoutePlannerMode, ProfileKeys::RoutePlannerMode,
                           route_planner.mode);

  changed |= SaveValueEnum(ReachPolarMode, ProfileKeys::ReachPolarMode,
                           route_planner.reach_polar_mode);

  changed |= SaveValueEnum(FinalGlideTerrain, ProfileKeys::FinalGlideTerrain,
                           settings_computer.features.final_glide_terrain);

  changed |= SaveValue(RoutePlannerAllowClimb, ProfileKeys::RoutePlannerAllowClimb,
                       route_planner.allow_climb);

  changed |= SaveValue(RoutePlannerUseCeiling, ProfileKeys::RoutePlannerUseCeiling,
                       route_planner.use_ceiling);

  changed |= SaveValueEnum(TurningReach, ProfileKeys::TurningReach,
                           route_planner.reach_calc_mode);
  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
SymbolsConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  MapSettings &settings_map = CommonInterface::SetMapSettings();

  changed |= SaveValueEnum(DisplayTrackBearing, szProfileDisplayTrackBearing,
                           settings_map.display_track_bearing);

  changed |= SaveValue(EnableFLARMMap, szProfileEnableFLARMMap,
                       settings_map.show_flarm_on_map);

  changed |= SaveValueEnum(Trail, szProfileSnailTrail, settings_map.trail.length);

  changed |= SaveValue(TrailDrift, szProfileTrailDrift, settings_map.trail.wind_drift_enabled);

  changed |= SaveValueEnum(SnailType, szProfileSnailType, settings_map.trail.type);

  changed |= SaveValue(SnailWidthScale, szProfileSnailWidthScale,
                       settings_map.trail.scaling_enabled);

  changed |= SaveValue(DetourCostMarker, szProfileDetourCostMarker,
                       settings_map.detour_cost_markers_enabled);

  changed |= SaveValueEnum(AircraftSymbol, szProfileAircraftSymbol, settings_map.aircraft_symbol);

  changed |= SaveValueEnum(WindArrowStyle, szProfileWindArrowStyle, settings_map.wind_arrow_style);

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
GlideComputerConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings();

  changed |= SaveValueEnum(AutoMcMode, szProfileAutoMcMode, settings_computer.task.auto_mc_mode);

  changed |= SaveValue(BlockSTF, szProfileBlockSTF,
                       settings_computer.features.block_stf_enabled);

  changed |= SaveValue(EnableNavBaroAltitude, szProfileEnableNavBaroAltitude,
                       settings_computer.features.nav_baro_altitude_enabled);

  changed |= SaveValue(EnableExternalTriggerCruise, szProfileEnableExternalTriggerCruise,
                       settings_computer.external_trigger_cruise_enabled);

  changed |= require_restart |=
      SaveValueEnum(AverEffTime, szProfileAverEffTime, settings_computer.average_eff_time);

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
MapDisplayConfigPanel::Save(bool &_changed, bool &require_restart)
{
    bool changed = false;

    MapSettings &settings_map = CommonInterface::SetMapSettings();

    changed |= SaveValueEnum(OrientationCruise, szProfileOrientationCruise,
                             settings_map.cruise_orientation);

    changed |= SaveValueEnum(OrientationCircling, szProfileOrientationCircling,
                             settings_map.circling_orientation);

    changed |= SaveValueEnum(MapShiftBias, szProfileMapShiftBias,
                             settings_map.map_shift_bias);

    changed |= SaveValue(GliderScreenPosition, szProfileGliderScreenPosition,
                         settings_map.glider_screen_position);

    changed |= SaveValue(CirclingZoom, szProfileCircleZoom,
                         settings_map.circle_zoom_enabled);

    changed |= SaveValue(MaxAutoZoomDistance, UnitGroup::DISTANCE,
                         szProfileMaxAutoZoomDistance,
                         settings_map.max_auto_zoom_distance);

    _changed |= changed;

    return true;
}
bool
AirspaceConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  AirspaceComputerSettings &computer =
    CommonInterface::SetComputerSettings().airspace;
  AirspaceRendererSettings &renderer =
    CommonInterface::SetMapSettings().airspace;
  UISettings &ui_settings = CommonInterface::SetUISettings();

  changed |= SaveValueEnum(AirspaceDisplay, ProfileKeys::AltMode, renderer.altitude_mode);

  changed |= SaveValueEnum(AirspaceLabelSelection, ProfileKeys::AirspaceLabelSelection, renderer.label_selection);

  changed |= SaveValue(ClipAltitude, UnitGroup::ALTITUDE, ProfileKeys::ClipAlt, renderer.clip_altitude);

  changed |= SaveValue(AltWarningMargin, UnitGroup::ALTITUDE, ProfileKeys::AltMargin, computer.warnings.altitude_warning_margin);

  changed |= SaveValue(AirspaceWarnings, ProfileKeys::AirspaceWarning, computer.enable_warnings);

  changed |= SaveValue(WarningDialog, ProfileKeys::AirspaceWarningDialog,
                       ui_settings.enable_airspace_warning_dialog);

  if (SaveValue(WarningTime, ProfileKeys::WarningTime, computer.warnings.warning_time)) {
    changed = true;
    require_restart = true;
  }

  changed |= SaveValue(RepetitiveSound, ProfileKeys::RepetitiveSound,
                       computer.warnings.repetitive_sound);

  if (SaveValue(AcknowledgeTime, ProfileKeys::AcknowledgementTime,
                computer.warnings.acknowledgement_time)) {
    changed = true;
    require_restart = true;
  }

  changed |= SaveValue(UseBlackOutline, ProfileKeys::AirspaceBlackOutline, renderer.black_outline);

  changed |= SaveValueEnum(AirspaceFillMode, ProfileKeys::AirspaceFillMode, renderer.fill_mode);

#if defined(HAVE_HATCHED_BRUSH) && defined(HAVE_ALPHA_BLEND)
  changed |= SaveValue(AirspaceTransparency, ProfileKeys::AirspaceTransparency,
                       renderer.transparency);
#endif

  _changed |= changed;

  return true;
}
bool
VoiceSettingsPanel::Save(bool &_changed)
{
  VoiceSettings &settings = CommonInterface::SetComputerSettings().voice;
  bool changed = false;

  changed |= SaveValueEnum(CLIMB_RATE, ProfileKeys::VoiceClimbRate,
                           settings.voice_climb_rate_enabled);
  changed |= SaveValueEnum(TERRAIN, ProfileKeys::VoiceTerrain,
                           settings.voice_terrain_enabled);
  changed |= SaveValueEnum(WAYPOINT_DISTANCE,
                           ProfileKeys::VoiceWaypointDistance,
                           settings.voice_waypoint_distance_enabled);
  changed |= SaveValueEnum(TASK_ALTITUDE_DIFFERENCE,
                           ProfileKeys::VoiceTaskAltitudeDifference,
                           settings.voice_task_altitude_difference_enabled);
  changed |= SaveValueEnum(MAC_CREADY, ProfileKeys::VoiceMacCready,
                           settings.voice_mac_cready_enabled);
  changed |= SaveValueEnum(NEXT_WAYPOINT, ProfileKeys::VoiceNewWaypoint,
                           settings.voice_new_waypoint_enabled);
  changed |= SaveValueEnum(IN_SECTOR, ProfileKeys::VoiceInSector,
                           settings.voice_in_sector_enabled);
  changed |= SaveValueEnum(AIRSPACE, ProfileKeys::VoiceAirspace,
                           settings.voice_airspace_enabled);

  _changed |= changed;
  return true;
}
Exemple #10
0
bool
UnitsConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  UnitSetting &config = CommonInterface::SetUISettings().format.units;
  CoordinateFormat &coordinate_format =
      CommonInterface::SetUISettings().format.coordinate_format;

  /* the Units settings affect how other form values are read and translated
   * so changes to Units settings should be processed after all other form settings
   */
  changed |= SaveValueEnum(UnitsSpeed, ProfileKeys::SpeedUnitsValue, config.speed_unit);
  config.wind_speed_unit = config.speed_unit; // Mapping the wind speed to the speed unit

  changed |= SaveValueEnum(UnitsDistance, ProfileKeys::DistanceUnitsValue, config.distance_unit);

  changed |= SaveValueEnum(UnitsLift, ProfileKeys::LiftUnitsValue, config.vertical_speed_unit);

  changed |= SaveValueEnum(UnitsAltitude, ProfileKeys::AltitudeUnitsValue, config.altitude_unit);

  changed |= SaveValueEnum(UnitsTemperature, ProfileKeys::TemperatureUnitsValue, config.temperature_unit);

  changed |= SaveValueEnum(UnitsTaskSpeed, ProfileKeys::TaskSpeedUnitsValue, config.task_speed_unit);

  changed |= SaveValueEnum(UnitsPressure, ProfileKeys::PressureUnitsValue, config.pressure_unit);

  changed |= SaveValueEnum(UnitsLatLon, ProfileKeys::LatLonUnits, coordinate_format);

  _changed |= changed;

  return true;
}
bool
LoggerConfigPanel::Save(bool &changed)
{
    ComputerSettings &settings_computer = CommonInterface::SetComputerSettings();
    LoggerSettings &logger = settings_computer.logger;

    changed |= SaveValue(LoggerTimeStepCruise, ProfileKeys::LoggerTimeStepCruise,
                         logger.time_step_cruise);

    changed |= SaveValue(LoggerTimeStepCircling, ProfileKeys::LoggerTimeStepCircling,
                         logger.time_step_circling);

    /* GUI label is "Enable Auto Logger" */
    changed |= SaveValueEnum(DisableAutoLogger, ProfileKeys::AutoLogger,
                             logger.auto_logger);

    changed |= SaveValue(EnableNMEALogger, ProfileKeys::EnableNMEALogger,
                         logger.enable_nmea_logger);

    if (logger.enable_nmea_logger)
        NMEALogger::enabled = true;

    if (SaveValue(EnableFlightLogger, ProfileKeys::EnableFlightLogger,
                  logger.enable_flight_logger)) {
        changed = true;

        /* currently, the GlueFlightLogger instance is created on startup
           only, which means XCSoar needs to be restarted to apply the new
           setting */
        require_restart = true;
    }

    return true;
}
bool
GaugesConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  UISettings &ui_settings = CommonInterface::SetUISettings();
  MapSettings &map_settings = CommonInterface::SetMapSettings();

  changed |= SaveValue(EnableFLARMGauge, ProfileKeys::EnableFLARMGauge,
                       ui_settings.traffic.enable_gauge);

  changed |= SaveValue(AutoCloseFlarmDialog, ProfileKeys::AutoCloseFlarmDialog,
                       ui_settings.traffic.auto_close_dialog);

  changed |= SaveValue(EnableTAGauge, ProfileKeys::EnableTAGauge,
                       ui_settings.enable_thermal_assistant_gauge);

  changed |= SaveValue(EnableThermalProfile, ProfileKeys::EnableThermalProfile,
                       map_settings.show_thermal_profile);

  changed |= SaveValueEnum(FinalGlideBarDisplayModeControl,
                           ProfileKeys::FinalGlideBarDisplayMode,
                           map_settings.final_glide_bar_display_mode);

  changed |= SaveValue(EnableFinalGlideBarMC0, ProfileKeys::EnableFinalGlideBarMC0,
                       map_settings.final_glide_bar_mc0_enabled);

  changed |= SaveValue(EnableVarioBar, ProfileKeys::EnableVarioBar,
                       map_settings.vario_bar_enabled);
  _changed |= changed;

  return true;
}
bool
WindSettingsPanel::Save(bool &_changed, bool &_require_restart)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  WindSettings &settings = CommonInterface::SetComputerSettings().wind;
  MapSettings &map_settings = CommonInterface::SetMapSettings();

  bool changed = false;

  unsigned auto_wind_mode = settings.GetLegacyAutoWindMode();
  if (SaveValueEnum(AutoWind, szProfileAutoWind, auto_wind_mode)) {
    settings.SetLegacyAutoWindMode(auto_wind_mode);
    changed = true;
  }

  changed |= SaveValue(ExternalWind, szProfileExternalWind,
                       settings.use_external_wind);

  changed |= SaveValue(TrailDrift, szProfileTrailDrift,
                       map_settings.trail_drift_enabled);

  if (edit_manual_wind && !external_wind) {
    settings.manual_wind.norm = Units::ToSysWindSpeed(GetValueFloat(Speed));
    settings.manual_wind.bearing = Angle::Degrees(GetValueFloat(Direction));
    settings.manual_wind_available.Update(basic.clock);
  }

  _changed |= changed;
  return true;
}
bool
AirspaceConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  AirspaceComputerSettings &computer =
    CommonInterface::SetComputerSettings().airspace;
  AirspaceRendererSettings &renderer =
    CommonInterface::SetMapSettings().airspace;

  changed |= SaveValueEnum(AirspaceDisplay, ProfileKeys::AltMode, renderer.altitude_mode);

  changed |= SaveValue(ClipAltitude, UnitGroup::ALTITUDE, ProfileKeys::ClipAlt, renderer.clip_altitude);

  changed |= SaveValue(AltWarningMargin, UnitGroup::ALTITUDE, ProfileKeys::AltMargin, computer.warnings.altitude_warning_margin);

  changed |= SaveValue(AirspaceWarnings, ProfileKeys::AirspaceWarning, computer.enable_warnings);

  if (SaveValue(WarningTime, ProfileKeys::WarningTime, computer.warnings.warning_time)) {
    changed = true;
    require_restart = true;
  }

  if (SaveValue(AcknowledgeTime, ProfileKeys::AcknowledgementTime,
                computer.warnings.acknowledgement_time)) {
    changed = true;
    require_restart = true;
  }

  changed |= SaveValue(UseBlackOutline, ProfileKeys::AirspaceBlackOutline, renderer.black_outline);

  changed |= SaveValueEnum(AirspaceFillMode, ProfileKeys::AirspaceFillMode, renderer.fill_mode);

#ifndef ENABLE_OPENGL
#ifdef HAVE_ALPHA_BLEND
  if (AlphaBlendAvailable())
    changed |= SaveValue(AirspaceTransparency, ProfileKeys::AirspaceTransparency,
                         renderer.transparency);
#endif
#endif /* !OpenGL */

  _changed |= changed;

  return true;
}
bool
TaskDefaultsConfigPanel::Save(bool &_changed, bool &_require_restart)
{
    bool changed = false, require_restart = false;

    ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings();
    TaskBehaviour &task_behaviour = settings_computer.task;

    changed |= SaveValueEnum(StartType, szProfileStartType, task_behaviour.sector_defaults.start_type);

    changed |= SaveValue(StartRadius, UnitGroup::DISTANCE, szProfileStartRadius,
                         task_behaviour.sector_defaults.start_radius);

    changed |= SaveValueEnum(TurnpointType, szProfileTurnpointType,
                             task_behaviour.sector_defaults.turnpoint_type);

    changed |= SaveValue(TurnpointRadius, UnitGroup::DISTANCE, szProfileTurnpointRadius,
                         task_behaviour.sector_defaults.turnpoint_radius);

    changed |= SaveValueEnum(FinishType, szProfileFinishType,
                             task_behaviour.sector_defaults.finish_type);

    changed |= SaveValue(FinishRadius, UnitGroup::DISTANCE, szProfileFinishRadius,
                         task_behaviour.sector_defaults.finish_radius);

    changed |= SaveValueEnum(TaskType, szProfileTaskType, task_behaviour.task_type_default);

    unsigned aatminutes = (unsigned)task_behaviour.ordered_defaults.aat_min_time;
    if (SaveValue(AATMinTime, aatminutes)) {
        task_behaviour.ordered_defaults.aat_min_time = fixed(aatminutes);
        Profile::Set(szProfileAATMinTime, aatminutes);
        changed = true;
    }

    unsigned aatmargin = task_behaviour.optimise_targets_margin;
    if (SaveValue(AATTimeMargin, aatmargin)) {
        task_behaviour.optimise_targets_margin = aatmargin;
        Profile::Set(szProfileAATTimeMargin, aatmargin);
        changed = true;
    }

    _changed |= changed;
    _require_restart |= require_restart;
    return true;
}
bool
TrackingConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  TrackingSettings &settings =
    CommonInterface::SetComputerSettings().tracking;

#ifdef HAVE_LIVETRACK24
  changed |= SaveValue(TrackingInterval, ProfileKeys::TrackingInterval, settings.interval);

  changed |= SaveValueEnum(TrackingVehicleType, ProfileKeys::TrackingVehicleType,
                           settings.vehicleType);

  changed |= SaveValue(TrackingVehicleName, ProfileKeys::TrackingVehicleName,
                       settings.vehicle_name);
#endif

#ifdef HAVE_SKYLINES_TRACKING
  changed |= SaveValue(SL_ENABLED, ProfileKeys::SkyLinesTrackingEnabled,
                       settings.skylines.enabled);

#ifdef HAVE_NET_STATE_ROAMING
  changed |= SaveValue(SL_ROAMING, ProfileKeys::SkyLinesRoaming,
                       settings.skylines.roaming);
#endif

  changed |= SaveValue(SL_INTERVAL, ProfileKeys::SkyLinesTrackingInterval,
                       settings.skylines.interval);

  changed |= SaveValue(SL_TRAFFIC_ENABLED, ProfileKeys::SkyLinesTrafficEnabled,
                       settings.skylines.traffic_enabled);
  changed |= SaveValue(SL_NEAR_TRAFFIC_ENABLED,
                       ProfileKeys::SkyLinesNearTrafficEnabled,
                       settings.skylines.near_traffic_enabled);

  changed |= SaveKey(*this, SL_KEY, ProfileKeys::SkyLinesTrackingKey,
                     settings.skylines.key);
#endif

#ifdef HAVE_LIVETRACK24
  changed |= SaveValue(LT24Enabled, ProfileKeys::LiveTrack24Enabled, settings.livetrack24.enabled);

  changed |= SaveValue(LT24Server, ProfileKeys::LiveTrack24Server,
                       settings.livetrack24.server);

  changed |= SaveValue(LT24Username, ProfileKeys::LiveTrack24Username,
                       settings.livetrack24.username);

  changed |= SaveValue(LT24Password, ProfileKeys::LiveTrack24Password,
                       settings.livetrack24.password);
#endif

  _changed |= changed;

  return true;
}
bool
LoggerConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false, plane_settings_changed = false;

  ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings();
  LoggerSettings &logger = settings_computer.logger;
  Plane &plane = settings_computer.plane;

  changed |= SaveValue(LoggerTimeStepCruise, szProfileLoggerTimeStepCruise,
                       logger.time_step_cruise);

  changed |= SaveValue(LoggerTimeStepCircling, szProfileLoggerTimeStepCircling,
                       logger.time_step_circling);

  changed |= SaveValue(LoggerID, szProfilePilotName,
                       logger.pilot_name.buffer(), logger.pilot_name.MAX_SIZE);

  plane_settings_changed |= SaveValue(AircraftType, plane.type.buffer(),
                                      plane.type.MAX_SIZE);
  plane_settings_changed |= SaveValue(AircraftReg, plane.registration.buffer(),
                                      plane.registration.MAX_SIZE);
  plane_settings_changed |= SaveValue(CompetitionID, plane.competition_id.buffer(),
                                      plane.competition_id.MAX_SIZE);
  changed |= plane_settings_changed;

  changed |= SaveValue(LoggerID, szProfileLoggerID,
                       logger.logger_id.buffer(), logger.logger_id.MAX_SIZE);

  changed |= SaveValue(LoggerShortName, szProfileLoggerShort,
                       logger.short_name);

  /* GUI label is "Enable Auto Logger" */
  changed |= SaveValueEnum(DisableAutoLogger, szProfileAutoLogger,
                           logger.auto_logger);

  if (SaveValue(EnableFlightLogger, szProfileEnableFlightLogger,
                logger.enable_flight_logger)) {
    changed = true;

    /* currently, the GlueFlightLogger instance is created on startup
       only, which means XCSoar needs to be restarted to apply the new
       setting */
    require_restart = true;
  }

  if (plane_settings_changed) {
    PlaneGlue::DetachFromPlaneFile();
    PlaneGlue::ToProfile(settings_computer.plane);
  }

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
SymbolsConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  MapSettings &settings_map = CommonInterface::SetMapSettings();

  changed |= SaveValueEnum(DISPLAY_TRACK_BEARING, ProfileKeys::DisplayTrackBearing,
                           settings_map.display_ground_track);

  changed |= SaveValue(ENABLE_FLARM_MAP, ProfileKeys::EnableFLARMMap,
                       settings_map.show_flarm_on_map);

  changed |= SaveValueEnum(TRAIL_LENGTH, ProfileKeys::SnailTrail, settings_map.trail.length);

  changed |= SaveValue(TRAIL_DRIFT, ProfileKeys::TrailDrift, settings_map.trail.wind_drift_enabled);

  changed |= SaveValueEnum(TRAIL_TYPE, ProfileKeys::SnailType, settings_map.trail.type);

  changed |= SaveValue(TRAIL_WIDTH, ProfileKeys::SnailWidthScale,
                       settings_map.trail.scaling_enabled);

  changed |= SaveValue(ENABLE_DETOUR_COST_MARKERS, ProfileKeys::DetourCostMarker,
                       settings_map.detour_cost_markers_enabled);

  changed |= SaveValueEnum(AIRCRAFT_SYMBOL, ProfileKeys::AircraftSymbol, settings_map.aircraft_symbol);

  changed |= SaveValueEnum(WIND_ARROW_STYLE, ProfileKeys::WindArrowStyle, settings_map.wind_arrow_style);

  changed |= SaveValue(SHOW_FAI_TRIANGLE_AREAS,
                       ProfileKeys::ShowFAITriangleAreas,
                       settings_map.show_fai_triangle_areas);

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
void
TaskPropertiesPanel::ReadValues()
{
  OrderedTaskBehaviour &p = ordered_task->GetOrderedTaskBehaviour();

  TaskFactoryType newtype = ordered_task->GetFactoryType();
  *task_changed |= SaveValueEnum(TASK_TYPE, newtype);

  int min_time = GetValueInteger(MIN_TIME);
  if (min_time != (int)p.aat_min_time) {
    p.aat_min_time = fixed(min_time);
    *task_changed = true;
  }

  fixed max_speed = Units::ToSysSpeed(GetValueFloat(START_MAX_SPEED));
  if (max_speed != p.start_max_speed) {
    p.start_max_speed = max_speed;
    *task_changed = true;
  }

  unsigned max_height =
    iround(Units::ToSysAltitude(GetValueFloat(START_MAX_HEIGHT)));
  if (max_height != p.start_max_height) {
    p.start_max_height = max_height;
    *task_changed = true;
  }

  *task_changed |= SaveValueEnum(START_HEIGHT_REF, p.start_max_height_ref);

  unsigned min_height =
    iround(Units::ToSysAltitude(GetValueFloat(FINISH_MIN_HEIGHT)));
  if (min_height != p.finish_min_height) {
    p.finish_min_height = min_height;
    *task_changed = true;
  }

  *task_changed |= SaveValueEnum(FINISH_HEIGHT_REF, p.finish_min_height_ref);
}
bool
SafetyFactorsConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  ComputerSettings &settings_computer = CommonInterface::SetComputerSettings();
  TaskBehaviour &task_behaviour = settings_computer.task;

  changed |= SaveValue(ArrivalHeight, UnitGroup::ALTITUDE,
                       ProfileKeys::SafetyAltitudeArrival,
                       task_behaviour.safety_height_arrival);

  changed |= SaveValue(TerrainHeight, UnitGroup::ALTITUDE,
                       ProfileKeys::SafetyAltitudeTerrain,
                       task_behaviour.route_planner.safety_height_terrain);

  changed |= SaveValueEnum(AlternateMode, ProfileKeys::AbortTaskMode,
                           task_behaviour.abort_task_mode);

  fixed degradation = (fixed(1) - settings_computer.polar.degradation_factor) * 100;
  if (SaveValue(PolarDegradation, degradation)) {
    settings_computer.polar.SetDegradationFactor(fixed(1) - degradation / 100);
    Profile::Set(ProfileKeys::PolarDegradation,
                 settings_computer.polar.degradation_factor);
    if (protected_task_manager != NULL)
      protected_task_manager->SetGlidePolar(settings_computer.polar.glide_polar_task);
    changed = true;
  }

  if (SaveValue(AutoBugs, settings_computer.polar.auto_bugs)) {
    Profile::Set(ProfileKeys::AutoBugs, settings_computer.polar.auto_bugs);
    changed = true;
  }

  if (SaveValue(SafetyMC, UnitGroup::VERTICAL_SPEED, task_behaviour.safety_mc)) {
    Profile::Set(ProfileKeys::SafetyMacCready,
                 iround(task_behaviour.safety_mc * 10));
    changed = true;
  }

  if (SaveValue(RiskFactor, task_behaviour.risk_gamma)) {
    Profile::Set(ProfileKeys::RiskGamma,
                 iround(task_behaviour.risk_gamma * 10));
    changed = true;
  }

  _changed |= changed;

  return true;
}
bool
TaskRulesConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  ComputerSettings &settings_computer = CommonInterface::SetComputerSettings();
  TaskBehaviour &task_behaviour = settings_computer.task;
  OrderedTaskSettings &otb = task_behaviour.ordered_defaults;

  changed |= SaveValue(StartMaxSpeed, UnitGroup::HORIZONTAL_SPEED,
                       ProfileKeys::StartMaxSpeed,
                       otb.start_constraints.max_speed);

  changed |= SaveValue(StartMaxSpeedMargin, UnitGroup::HORIZONTAL_SPEED, ProfileKeys::StartMaxSpeedMargin,
                       task_behaviour.start_margins.max_speed_margin);

  changed |= SaveValue(StartMaxHeight, UnitGroup::ALTITUDE,
                       ProfileKeys::StartMaxHeight,
                       otb.start_constraints.max_height);

  changed |= SaveValue(StartMaxHeightMargin, UnitGroup::ALTITUDE, ProfileKeys::StartMaxHeightMargin,
                       task_behaviour.start_margins.max_height_margin);

  changed |= SaveValueEnum(StartHeightRef, ProfileKeys::StartHeightRef,
                           otb.start_constraints.max_height_ref);

  changed |= SaveValue(FinishMinHeight, UnitGroup::ALTITUDE,
                       ProfileKeys::FinishMinHeight,
                       otb.finish_constraints.min_height);

  changed |= SaveValueEnum(FinishHeightRef, ProfileKeys::FinishHeightRef,
                           otb.finish_constraints.min_height_ref);

  _changed |= changed;

  return true;
}
bool
DeviceEditWidget::Save(bool &_changed)
{
  bool changed = false;

  changed |= FinishPortField(config, (const DataFieldEnum &)GetDataField(Port));

  if (config.MaybeBluetooth())
    changed |= SaveValue(K6Bt, config.k6bt);

  if (config.UsesSpeed()) {
    changed |= SaveValue(BaudRate, config.baud_rate);
    changed |= SaveValue(BulkBaudRate, config.bulk_baud_rate);
  }

  if (config.UsesIPAddress())
    changed |= SaveValue(IP_ADDRESS, config.ip_address);

  if (config.UsesTCPPort())
    changed |= SaveValue(TCPPort, config.tcp_port);

  if (config.UsesI2C()) {
    changed |= SaveValue(I2CBus, config.i2c_bus);
    changed |= SaveValue(I2CAddr, config.i2c_addr);
    changed |= SaveValueEnum(PressureUsage, config.press_use);
  }

  if (config.UsesDriver()) {
    changed |= SaveValue(Driver, config.driver_name);

    if (CanReceiveSettings(GetDataField(Driver)))
      changed |= SaveValue(SyncFromDevice, config.sync_from_device);

    if (CanSendSettings(GetDataField(Driver)))
      changed |= SaveValue(SyncToDevice, config.sync_to_device);

    if (CanPassThrough(GetDataField(Driver))) {
      changed |= SaveValue(UseSecondDriver, config.use_second_device);
      changed |= SaveValue(SecondDriver, config.driver2_name.buffer(),
                           config.driver2_name.CAPACITY);
    }
  }

  if (CommonInterface::Basic().sensor_calibration_available)
    changed = true;

  _changed |= changed;
  return true;
}
Exemple #23
0
bool
DeviceEditWidget::Save(bool &_changed, bool &require_restart)
{
  bool changed = false;

  changed |= FinishPortField(config, (const DataFieldEnum &)GetDataField(Port));

  if (config.MaybeBluetooth())
    changed |= SaveValue(K6Bt, config.k6bt);

  if (config.UsesSpeed() || (config.MaybeBluetooth() && config.k6bt)) {
    changed |= SaveValue(BaudRate, config.baud_rate);
    changed |= SaveValue(BulkBaudRate, config.bulk_baud_rate);
  }

  if (config.UsesTCPPort())
    changed |= SaveValue(TCPPort, config.tcp_port);

  if (config.UsesI2C()) {
    changed |= SaveValue(I2CBus, config.i2c_bus);
    changed |= SaveValue(I2CAddr, config.i2c_addr);
    changed |= SaveValueEnum(PressureUsage, config.press_use);
  }

  if (config.UsesDriver()) {
    changed |= SaveValue(Driver, config.driver_name.buffer(),
                         config.driver_name.MAX_SIZE);

    if (CanReceiveSettings(GetDataField(Driver)))
      changed |= SaveValue(SyncFromDevice, config.sync_from_device);

    if (CanSendSettings(GetDataField(Driver)))
      changed |= SaveValue(SyncToDevice, config.sync_to_device);

    changed |= SaveValue(IgnoreCheckSum, config.ignore_checksum);
  }

  if (CommonInterface::Basic().sensor_calibration_available)
    changed = true;

#ifndef NDEBUG
  if (config.UsesPort())
    changed |= SaveValue(DumpPort, config.dump_port);
#endif

  _changed |= changed;
  return true;
}
Exemple #24
0
bool
TrackingConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  TrackingSettings &settings =
    CommonInterface::SetComputerSettings().tracking;

#ifdef HAVE_LIVETRACK24
  changed |= SaveValue(TrackingInterval, ProfileKeys::TrackingInterval, settings.interval);

  changed |= SaveValueEnum(TrackingVehicleType, ProfileKeys::TrackingVehicleType,
                           settings.vehicleType);
#endif

#ifdef HAVE_SKYLINES_TRACKING
  changed |= SaveValue(SL_ENABLED, ProfileKeys::SkyLinesTrackingEnabled,
                       settings.skylines.enabled);

  changed |= SaveValue(SL_INTERVAL, ProfileKeys::SkyLinesTrackingInterval,
                       settings.skylines.interval);

#ifdef HAVE_SKYLINES_TRACKING_HANDLER
  changed |= SaveValue(SL_TRAFFIC_ENABLED, ProfileKeys::SkyLinesTrafficEnabled,
                       settings.skylines.traffic_enabled);
#endif

  changed |= SaveKey(*this, SL_KEY, ProfileKeys::SkyLinesTrackingKey,
                     settings.skylines.key);
#endif

#ifdef HAVE_LIVETRACK24
  changed |= SaveValue(LT24Enabled, ProfileKeys::LiveTrack24Enabled, settings.livetrack24.enabled);

  changed |= SaveValue(LT24Server, ProfileKeys::LiveTrack24Server,
                       settings.livetrack24.server.buffer(), settings.livetrack24.server.MAX_SIZE);

  changed |= SaveValue(LT24Username, ProfileKeys::LiveTrack24Username,
                       settings.livetrack24.username.buffer(), settings.livetrack24.username.MAX_SIZE);

  changed |= SaveValue(LT24Password, ProfileKeys::LiveTrack24Password,
                       settings.livetrack24.password.buffer(), settings.livetrack24.password.MAX_SIZE);
#endif

  _changed |= changed;

  return true;
}
Exemple #25
0
bool
ExperimentalConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

#ifdef HAVE_MODEL_TYPE
  // VENTA-ADDON MODEL CHANGE
  changed |= SaveValueEnum(DeviceModelType, szProfileAppInfoBoxModel, global_model_type);
  if (changed) {
    require_restart = true;
  }
#endif

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
ExperimentalConfigPanel::Save(bool &_changed)
{
  bool changed = false;

#ifdef HAVE_MODEL_TYPE
  SystemSettings &system_settings = CommonInterface::SetSystemSettings();
  changed |= SaveValueEnum(DeviceModelType, ProfileKeys::AppInfoBoxModel,
                           system_settings.model_type);
  if (changed) {
    global_model_type = system_settings.model_type;
    require_restart = true;
  }
#endif

  _changed |= changed;

  return true;
}
bool
WindSettingsPanel::Save(bool &_changed)
{
  WindSettings &settings = CommonInterface::SetComputerSettings().wind;
  MapSettings &map_settings = CommonInterface::SetMapSettings();

  bool changed = false;

  unsigned auto_wind_mode = settings.GetLegacyAutoWindMode();
  if (SaveValueEnum(AutoWind, ProfileKeys::AutoWind, auto_wind_mode)) {
    settings.SetLegacyAutoWindMode(auto_wind_mode);
    changed = true;
  }

  if (edit_trail_drift)
    changed |= SaveValue(TrailDrift, ProfileKeys::TrailDrift,
                         map_settings.trail.wind_drift_enabled);

  _changed |= changed;
  return true;
}
Exemple #28
0
bool
LayoutConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  UISettings &ui_settings = CommonInterface::SetUISettings();

  bool orientation_changed = false;

  if (Display::RotateSupported()) {
    orientation_changed =
      SaveValueEnum(MapOrientation, ProfileKeys::MapOrientation,
                    ui_settings.display.orientation);
    changed |= orientation_changed;
  }

  bool info_box_geometry_changed = false;

  info_box_geometry_changed |=
    SaveValueEnum(AppInfoBoxGeom, ProfileKeys::InfoBoxGeometry,
                  ui_settings.info_boxes.geometry);

  info_box_geometry_changed |=
    SaveValueEnum(AppFlarmLocation, ProfileKeys::FlarmLocation,
                  ui_settings.traffic.gauge_location);

  changed |= info_box_geometry_changed;

  changed |= SaveValueEnum(AppStatusMessageAlignment, ProfileKeys::AppStatusMessageAlignment,
                           ui_settings.popup_message_position);

  changed |= SaveValueEnum(AppInfoBoxBorder, ProfileKeys::AppInfoBoxBorder,
                           ui_settings.info_boxes.border_style);

  if (SaveValue(AppInverseInfoBox, ProfileKeys::AppInverseInfoBox,
                ui_settings.info_boxes.inverse))
    require_restart = changed = true;

  if (HasColors() &&
      SaveValue(AppInfoBoxColors, ProfileKeys::AppInfoBoxColors,
                ui_settings.info_boxes.use_colors))
    require_restart = changed = true;

#ifdef KOBO
  if (SaveValue(ShowMenuButton, ProfileKeys::ShowMenuButton,ui_settings.show_menu_button))
    require_restart = changed = true;
#endif

  DialogSettings &dialog_settings = CommonInterface::SetUISettings().dialog;
  changed |= SaveValueEnum(TabDialogStyle, ProfileKeys::AppDialogTabStyle, dialog_settings.tab_style);

  if (orientation_changed) {
    assert(Display::RotateSupported());

    if (ui_settings.display.orientation == DisplayOrientation::DEFAULT)
      Display::RotateRestore();
    else {
      if (!Display::Rotate(ui_settings.display.orientation))
        LogFormat("Display rotation failed");
    }

#ifdef KOBO
    event_queue->SetMouseRotation(ui_settings.display.orientation);
#endif

    CommonInterface::main_window->CheckResize();
  } else if (info_box_geometry_changed)
    CommonInterface::main_window->ReinitialiseLayout();

  _changed |= changed;

  return true;
}
Exemple #29
0
bool
LayoutConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  UISettings &ui_settings = CommonInterface::SetUISettings();

  bool orientation_changed = false;

  if (Display::RotateSupported()) {
    orientation_changed =
      SaveValueEnum(DisplayOrientation, szProfileDisplayOrientation,
                    ui_settings.display.orientation);
    changed |= orientation_changed;
  }

  bool info_box_geometry_changed = false;

  info_box_geometry_changed |=
    SaveValueEnum(AppInfoBoxGeom, szProfileInfoBoxGeometry,
                  ui_settings.info_boxes.geometry);

  info_box_geometry_changed |=
    SaveValueEnum(AppFlarmLocation, szProfileFlarmLocation,
                  ui_settings.traffic.gauge_location);

  changed |= info_box_geometry_changed;

  changed |= SaveValueEnum(AppStatusMessageAlignment, szProfileAppStatusMessageAlignment,
                           ui_settings.popup_message_position);

  changed |= SaveValueEnum(DialogStyle, szProfileAppDialogStyle,
                           ui_settings.dialog.dialog_style);

  changed |= require_restart |=
    SaveValueEnum(AppInfoBoxBorder, szProfileAppInfoBoxBorder, ui_settings.info_boxes.border_style);

  changed |= require_restart |=
    SaveValue(AppInverseInfoBox, szProfileAppInverseInfoBox, ui_settings.info_boxes.inverse);

  changed |= require_restart |=
    SaveValue(AppInfoBoxColors, szProfileAppInfoBoxColors, ui_settings.info_boxes.use_colors);

  DialogSettings &dialog_settings = CommonInterface::SetUISettings().dialog;
  changed |= SaveValueEnum(TabDialogStyle, szProfileAppDialogTabStyle, dialog_settings.tab_style);

  if (orientation_changed) {
    assert(Display::RotateSupported());

    if (ui_settings.display.orientation == DisplaySettings::Orientation::DEFAULT)
      Display::RotateRestore();
    else {
      if (!Display::Rotate(ui_settings.display.orientation))
        LogStartUp(_T("Display rotation failed"));
    }
  } else if (info_box_geometry_changed)
    XCSoarInterface::main_window.ReinitialiseLayout();

  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
bool
InterfaceConfigPanel::Save(bool &_changed)
{
  UISettings &settings = CommonInterface::SetUISettings();
  bool changed = false;;

#ifdef HAVE_BLANK
  changed |= SaveValue(AutoBlank, ProfileKeys::AutoBlank,
                       settings.display.enable_auto_blank);
#endif

  if (SaveValueFileReader(InputFile, ProfileKeys::InputFile))
    require_restart = changed = true;

#ifndef HAVE_NATIVE_GETTEXT
  WndProperty *wp = (WndProperty *)&GetControl(LanguageFile);
  if (wp != NULL) {
    DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField();

    TCHAR old_value[MAX_PATH];
    if (!Profile::GetPath(ProfileKeys::LanguageFile, old_value))
      old_value[0] = _T('\0');

    const TCHAR *old_base = BaseName(old_value);
    if (old_base == NULL)
      old_base = old_value;

    TCHAR buffer[MAX_PATH];
    const TCHAR *new_value, *new_base;

    switch (df.GetValue()) {
    case 0:
      new_value = new_base = _T("auto");
      break;

    case 1:
      new_value = new_base = _T("none");
      break;

    default:
      _tcscpy(buffer, df.GetAsString());
      ContractLocalPath(buffer);
      new_value = buffer;
      new_base = BaseName(new_value);
      if (new_base == NULL)
        new_base = new_value;
      break;
    }

    if (_tcscmp(old_value, new_value) != 0 &&
        _tcscmp(old_base, new_base) != 0) {
      Profile::Set(ProfileKeys::LanguageFile, new_value);
      LanguageChanged = changed = true;
    }
  }
#endif

  if (SaveValueFileReader(StatusFile, ProfileKeys::StatusFile))
    require_restart = changed = true;

  unsigned menu_timeout = GetValueInteger(MenuTimeout) * 2;
  if (settings.menu_timeout != menu_timeout) {
    settings.menu_timeout = menu_timeout;
    Profile::Set(ProfileKeys::MenuTimeout, menu_timeout);
    changed = true;
  }

#ifdef HAVE_VIBRATOR
  changed |= SaveValueEnum(HapticFeedback, ProfileKeys::HapticFeedback, settings.haptic_feedback);
#endif

  _changed |= changed;
  return true;
}