Modify

Opened 3 years ago

Last modified 3 years ago

#20573 assigned enhancement

[WIP Patch] Search preferences dialog

Reported by: Bjoeni Owned by: Bjoeni
Priority: normal Milestone:
Component: Core Version:
Keywords: preferences search Cc:

Description

I think it would be a good idea to allow users searching the (regular, not advanced) preferences.
It got much better with #7548, but I just think that there are a lot of preferences and at this point a search function could be helpful.

The issue is that the preferences are not unified but each panel is created separately (including by plugins). And I don't think that is going to change anytime soon (or ever).

So I attached a proof of concept (WIP patch) that does the following:

  • Go through the panels and extract searchable items (build the panels if that didn't happen yet)
  • Put them in a structured SearchIndex based on placement in Containers and Constraints (inset, location in grid, EOL markers)
  • Allow components to override the default item extraction (or disallow searching) by implementing the interface ISearchableComponent. I implemented it for the following prefs:
    • SearchPanel (disallow searching)
    • Advanced Prefs (disallow searching)
    • Keyboard Shortcuts (only searching the actions, not the corresponding keys)
  • Output the resulting searchIndex to a file called searchableSettings.txt on the desktop (this is just for debugging, not intended for caching. I attached a searchableSettings.txt example to this ticket. For anyone applying the patch, this file is printed when you enter anything in the searchbox.

I would suggest searching by going through the index and printing all matching items including its parents, still not sure how exactly how the UI could look.
When clicking on an item the user should be taken to the corresponding tab and the component could be highlighted and/or scrolled to.

I'm also not yet sure how to handle the preferences that load external content, e.g. plugins/imagery/validator. Currently they are only searched when they have previously been loaded by the user, otherwise not. That should probably change as it kind of defeats the purpose or at least limits the search.

Any ideas/suggestions/comments?

Attachments (9)

20573-0.1.diff (74.5 KB ) - added by Bjoeni 3 years ago.
searchableSettings.txt (731.6 KB ) - added by Bjoeni 3 years ago.
20573-0.2.diff (83.0 KB ) - added by Bjoeni 3 years ago.
search_fixme.png (90.7 KB ) - added by Bjoeni 3 years ago.
search_gpx.png (100.7 KB ) - added by Bjoeni 3 years ago.
search_waypoint.png (106.6 KB ) - added by Bjoeni 3 years ago.
20573-0.3.png (86.1 KB ) - added by Bjoeni 3 years ago.
20573-0.3-click.png (94.1 KB ) - added by Bjoeni 3 years ago.
20573-0.3.diff (127.5 KB ) - added by Bjoeni 3 years ago.

Download all attachments as: .zip

Change History (14)

by Bjoeni, 3 years ago

Attachment: 20573-0.1.diff added

by Bjoeni, 3 years ago

Attachment: searchableSettings.txt added

comment:1 by Don-vip, 3 years ago

Can you please add a screenshot for the proof of concept?

comment:2 by Bjoeni, 3 years ago

Not really, because the UI doesn't exist yet. There's nothing to see except a text field in the preferences dialog.

But you can have a look at the text file I attached, that contains the human-readable structure and searchable texts. The actual search logic also isn't implemented yet, but that is just basic filtering.

by Bjoeni, 3 years ago

Attachment: 20573-0.2.diff added

by Bjoeni, 3 years ago

Attachment: search_fixme.png added

by Bjoeni, 3 years ago

Attachment: search_gpx.png added

by Bjoeni, 3 years ago

Attachment: search_waypoint.png added

comment:3 by Bjoeni, 3 years ago

I implemented some basic filtering and printing of the raw output to the search tab, the concept might be easier to understand now.

Also I attached a few screenshots of that.

comment:4 by Bjoeni, 3 years ago

Actually, the search_fixme.png above is a good examples of the problems caused by this approach: "Tag checker" is considered a child of the checkbox "Similarly named ways", because it has a higher inset. But actually somebody only increased that inset for visual reasons (because it's a label below a CheckBox and it looks better this way).

That specific case I can fix by requiring a minimum additional inset of 10-15px, below that it's probably not meant to be a child of the previous item. But there will always be some cases that are not caught by the default SearchTextFinder, and they need to be manually handled on a case-by-case basis (that's what the interface ISearchableComponent is for).

in reply to:  1 comment:5 by Bjoeni, 3 years ago

Replying to Don-vip:

Can you please add a screenshot for the proof of concept?

I implemented a basic UI, so here you go:

When the user clicks on a search result:

TODO:

  • fix memory leaks (probably the biggest issue at the moment. Each preference tab is created in order to search it, and some add listeners that are not removed)
  • reduce total memory consumption by reusing resources
  • handle out of memory errors gracefully
  • fix categorizing of items
  • maybe some sort of caching mechanism for the search index
  • warn user if they click on an item that is only available in expert mode which is currently not activated
  • scroll and highlight the right component in lists, when the user clicks on it (plugins, presets etc.)
  • improve UI
  • clean code (Javadoc, checkstyle, pmd, comments etc)

(note: the patch below contains some files twice. So it's not actually that big)

Last edited 3 years ago by Bjoeni (previous) (diff)

by Bjoeni, 3 years ago

Attachment: 20573-0.3.png added

by Bjoeni, 3 years ago

Attachment: 20573-0.3-click.png added

by Bjoeni, 3 years ago

Attachment: 20573-0.3.diff added

Modify Ticket

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

Add Comment


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