Modify

Opened 5 years ago

Last modified 5 years ago

#19666 new enhancement

GPXSettingsPanel should leverage IPreferences

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: gpx preference refactoring Cc: Bjoeni

Description

Since #16796/r15496, GPXSettingsPanel duplicates many parsing/formatting preference functions which are specified by the interface IPreferences. GPXSettingsPanel should be refactored to use a layer MemoryPreferences instance and fallback to the global Config#getPref (by using the draw.rawgps. prefix).

Attachments (0)

Change History (1)

comment:1 by Bjoeni, 5 years ago

There were a couple of issues with that:

  • I needed methods for reading the layer specific prefs directly. So eventually I'd duplicate all methods anyways.
  • I needed access to the global default values that cannot be changed by the user. That's because prefs will only be saved to the GPX file if they differ from those values. And for example the "lines" preference has a "use default" option when the panel is called for a specific layer which requires different handling of global and local preferences.
  • I don't think using MemoryPreferences makes much sense here since all layer specific prefs are stored in the GpxData object. And eventually they anyways have to be converted to strings when being saved to the file. Sure we can add a property of type MemoryPreferences to GpxData, but I simply don't see the benefits here. It's just converting back and forth.

So I just decided against it because it's quite different from the existing preferences handling, but if you want to refactor that stuff go ahead :)

I agree though that GpxSettingsPanel is a mess. In my opinion at least all the preferences logic should be extracted to another class, it makes no sense that for example GpxDrawHelper is calling GpxSettingsPanel in order to read preferences.

But anyways I don't really have the time to write a patch at the moment.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to simon04.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.