18 Commits

Author SHA1 Message Date
Nyall Dawson
8267fa3ddd Allow filters to provide configuration dialogs 2017-05-17 21:33:48 +10:00
Nyall Dawson
df9d9f6748 Invalidate current locator results when locator options are changed 2017-05-17 21:33:48 +10:00
Nyall Dawson
e8d3ae9264 Enable disabling filters via options dialog 2017-05-17 21:33:48 +10:00
Nyall Dawson
ce66393636 Add (non-functional) locator configuration dialog 2017-05-17 21:33:48 +10:00
Nyall Dawson
5a0bcf0776 Style fixes 2017-05-17 21:33:48 +10:00
Nyall Dawson
2435dbc712 Nicer results, always show an icon, show description 2017-05-17 21:33:47 +10:00
Nyall Dawson
ea86049c5e Show a list of shortcut prefixes in locator bar if no text is entered 2017-05-17 21:33:47 +10:00
Nyall Dawson
56c8baaccb Provide a standard string comparison method in QgsLocatorFilter
Subclasses should use this method instead of directly calling
QString::contains or using Python 's in search' type matches.
This ensures consistent matching behaviour across different filters.
2017-05-17 21:33:47 +10:00
Nyall Dawson
6649d2b1ed Sort filter results so closer matches appear higher
A closer match means more of the text is matched, ie
a short string inside a long string is penalised
2017-05-17 21:33:47 +10:00
Nyall Dawson
a53516d71d Only show action results when . prefix is used 2017-05-17 21:33:47 +10:00
Nyall Dawson
102a46662b Implement prefix based locator searching
Filters can indicate their preferred search prefix. Searches which
begin with this character will be restricted to the single matching
filter.

E.g. entering 'l buffer' will searching only layers containing 'buffer'

Other prefixes are:
- . search actions
- pl search print layouts
- a search algorithms

Plugins are restricted to a minimum 3 character prefix. We do this
to avoid plugins 'stealing' desirable prefixes, and instead we
want to reserve them for future core filters.
2017-05-17 21:33:47 +10:00
Nyall Dawson
b33ce0bf47 Allow speciyfing the priority for filters
Higher priority (i.e. more important) filter results get shown
first. This means filters like project layers & composers will
show above 'cruder' filters like the actions/processing filters.
2017-05-17 21:33:47 +10:00
Nyall Dawson
0f80df09a7 Show locator filter names in results, sort results and group by filter 2017-05-17 21:33:47 +10:00
Nyall Dawson
ab02f2b79c Allowing associating QgsLocatorWidget with a map canvas
This allows the widget's locator to prioritise results which
are close to the current canvas extent
2017-05-17 21:33:47 +10:00
Nyall Dawson
a7d590e041 Add a context variable for locator searches
This allows encapsulation of properties relating to the context
of a search, such as a target map extent. Locator filters could
use this to prioritise results close to the current canvas extent.
2017-05-17 21:33:47 +10:00
Nyall Dawson
376d6b3d08 Add missing docs, sip bindings 2017-05-17 21:33:47 +10:00
Nyall Dawson
1174b335dc Add inbuilt filters for project layers and compositions
The project layer filter allows you to quickly select a layer
from the current project and highlight it in the layer tree.
It's useful for complex project with lots of groups, where
it's easy to "lose" layers somewhere in the tree...

The composition filter allows searching for and opening
compositions from the current project
2017-05-17 21:33:47 +10:00
Nyall Dawson
71f7872251 [FEATURE] Implement a QtCreator style locator bar in the QGIS status bar
This adds a new "locator" bar to the QGIS status bar. If you're not
familiar with QtCreator's locator, it's a quick search bar
(activated by Ctrl+K) which displays matching search results
from any number of registered search filters.

Search filters are subclassed from QgsLocatorFilter, and
added to the app's locator via iface.registerLocatorFilter(...)

Searching is handled using threads, so that results always
become available as quickly as possible, regardless of whether
any slow search filters may be installed. They also appear
as soon as each result is encountered by each filter, which means
that e.g. a file search filter will show results one by one
as the file tree is scanned. This ensures that the UI is always
responsive even if a very slow search filter is present (e.g.
one which uses an online service).

This framework is designed to be extended by plugins, such as
OSM nominatim searches, direct database searching (i.e. Discovery
plugin), layer catalog searches, etc...
2017-05-17 21:33:47 +10:00