38 Commits

Author SHA1 Message Date
Denis Rouzaud
f2b3ed0a9b run sipify 2017-12-15 11:12:19 -04:00
Denis Rouzaud
e48cf98edb run sipify 2017-12-06 07:19:50 -04:00
Nyall Dawson
01e8ed85e3 More flexible API for preview job determination 2017-12-05 09:02:40 +10:00
Nyall Dawson
144e9a2e45 Fix handling of ogr sublayers with ':' in their name
Unlikely to happen, but it does occur with some layers coming
from processing models. In any case we want QGIS to be super-tolerant
of corner cases like this!
2017-11-26 12:23:32 +10:00
Denis Rouzaud
6e14854f90 [sipify] remove redundant private sections 2017-10-09 09:51:40 +02:00
Nyall Dawson
42676dc93c Move some getters which are incorrectly marked as slots,
remove some unnecessary 'const's from signals

Thanks to clazy const-signal-or-slot check
2017-10-09 11:53:06 +10:00
Vincent Mora
02e3916bf5 [FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]

In vector layer properties (only usefull for postgres datasources)

**in the rendering tab**

A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.

For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.

If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.

**in the actions tab**

A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.

Note that, as opposed to the "layer refresh" that

Exemple:
  - QGIS side "Execute if notification message matches" `^trigger my action`
  - Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
  - Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
  - Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action

Please note that if the `^`, which means "starts with",  in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`

A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:

```python
print('[% @notification_message %]')
```

The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```

User Warning:

For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.

Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.

IMPLEMENTATION DETAILS:

A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.

For the moment only the postgres provider implements the notification.

QgsAction has a notificationMessage member function that holds the regex
to match to trigger action

QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.

The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.

For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.

It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.

Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.

The service will not restart in the next qgis session though.

If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-22 12:51:51 +02:00
Nyall Dawson
1fddfcf622 Flip Q_ENUMS to Q_ENUM
See https://woboq.com/blog/q_enum.html for rationale
2017-08-29 18:03:41 +10:00
Denis Rouzaud
f20b9b96e7 [sipify] better remove body, remove duplicate code 2017-04-30 16:34:08 +02:00
Matthias Kuhn
c219116358 Add QgsDataProvider::uri property 2017-04-28 00:27:46 +02:00
Denis Rouzaud
7812d4fb17 remove the-prefix from source code
this might result in variables having the same name as some methods
2017-02-21 18:14:58 +01:00
Nyall Dawson
5d78d60bf3 Remove duplicate QgsDataProvider::dataChanged( int ) signal
Was not needed and not emitted anywhere
2016-11-15 07:00:49 +10:00
Nyall Dawson
1bafa80089 Const correctness for numerous data provider methods 2016-07-15 05:57:57 +10:00
Matthias Kuhn
000eb072b0 Add support for adding custom properties to providers 2016-06-03 10:02:38 +02:00
Juergen E. Fischer
e07986009f more typo fixes 2016-06-02 22:36:32 +02:00
Even Rouault
dc18b5b36b [BUGFIX / FEATURE] [OGR] Allow concurrent edition of Shapefiles and Tabfiles in QGIS & MapInfo
- Closes https://hub.qgis.org/issues/14378
- Adds new virtual methods in QgsDataProvider(): enterUpdateMode() and leaveUpdateMode()
  and implement them in the OGR provider. Limited to shapefiles and tabfiles
- Implements QgsOGRProvider:reloadData()
- Robustify OGR provider methods so they don't crash if dataset re-opening fails.
2016-05-04 22:00:30 +02:00
Even Rouault
62bd4061fe Add QgsDataProvider::invalidateConnections() and implement in Spatialite provider
This invalidates all cached connections to the given database name.
This will be used by the WFS provider to cleanup any cached connections before
removing its temporary Spatialite DB
2016-04-05 21:49:52 +02:00
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +01:00
Nyall Dawson
881074b194 Boost coverage of SIP bindings
Now all classes and members are either exposed to bindings or marked
as "not available in Python bindings" in the docs.

Drop test thresholds to 0. Now it should be much easier to determine
what missing members have been added which are causing test
failures.
2016-01-05 11:16:15 +11:00
Matthias Kuhn
56ccb2b858 sipClass_Klass is deprecated for a long time: replace with sipType_Klass 2015-11-11 23:22:51 +01:00
Nyall Dawson
70bff3f6aa Finish flipping a lot of methods to take const references for
non-trivial types
2015-10-26 22:46:14 +11:00
Larry Shaffer
95214e9125 [auth system] Core data source URI integration 2015-09-21 08:51:18 -06:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Juergen E. Fischer
9ceb5ceab6 sip sync 2014-11-21 01:17:21 +01:00
Juergen E. Fischer
74e7314c36 update sip bindings II 2014-01-27 09:22:53 +01:00
Juergen E. Fischer
4cbec1811c fix warnings, add copyright headers, cosmetics 2013-01-28 01:39:58 +01:00
Juergen E. Fischer
f3cb57b1eb SIP bindings update:
- update methods of existing classes
- add comment to methods missing in the sip bindings
- split up collective sip files into single files and use
  same directory structure in python/ as in src/
- add a lot of missing classes (some might not make sense because of
  missing python methods in those classes)
- remove some non-existing methods from the header files
- add scripts/sipdiff
- replace some usages of std::vector and std::set with QVector/QSet
2012-09-24 02:42:57 +02:00
jef
173037d6c9 revert r15747
git-svn-id: http://svn.osgeo.org/qgis/trunk@15762 c8812cc2-4d05-0410-92ff-de0c093fc19c
2011-04-18 20:54:50 +00:00
jef
a168fb98e5 fix #7: GetCapabilities no done twice anymore
git-svn-id: http://svn.osgeo.org/qgis/trunk@15747 c8812cc2-4d05-0410-92ff-de0c093fc19c
2011-04-17 13:58:59 +00:00
wonder
61d970a2d5 PyQIS: subclassing code for QgsDataProvider
git-svn-id: http://svn.osgeo.org/qgis/trunk@14911 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-12-14 20:43:51 +00:00
mhugent
2222397334 [FEATURE]: added reload method to map layers and provider interface. Like this, caching providers (currently WMS and WFS) can synchronize with changes in the datasource
git-svn-id: http://svn.osgeo.org/qgis/trunk@14264 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-09-20 11:27:12 +00:00
jef
f130f103c7 fix #2036
git-svn-id: http://svn.osgeo.org/qgis/trunk@11861 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-10-28 00:51:34 +00:00
jef
4ed28f36b8 wider support for vector layer queries:
- add query support for OGR and spatialite layers (additional to postgres)
- QgsDataProvider::setSubsetString() now returns if the query is successful.
- add optional parameter to limit number of values returned from QgsVectorDataProvider::uniqueValues() 
- rename QgsDbSourceSelect to QgsPgSourceSelect, use QgsVectorLayer for layer queries and make it wider
- QgsDataSourceURI: improve quoting
- fix relative path support for SpatiaLite on windows
- rename QgsPgQueryBuilder to QgsQueryBuilder and use QgsVectorLayer for
  queries instead of postgres

cleanups:
- rename QgsServerSourceSelect to QgsWMSSourceSelect



git-svn-id: http://svn.osgeo.org/qgis/trunk@11762 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-10-06 22:05:52 +00:00
timlinux
b40ceb2d62 API cleanups for QgsRect that got overlooked...
git-svn-id: http://svn.osgeo.org/qgis/trunk@9605 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-11-09 00:14:12 +00:00
timlinux
dcfedaad21 remove get prefix for crs accessor
git-svn-id: http://svn.osgeo.org/qgis/trunk@9501 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-10-20 20:08:43 +00:00
timlinux
a4bd78c9f8 Refactor spatial reference system to coordinate reference system (finalise fix of ticket #15). Also updated some more core api docs / module assignments.
git-svn-id: http://svn.osgeo.org/qgis/trunk@9108 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-08-21 21:11:56 +00:00
wonder
1ac580270f Merged provider0_9-branch (r6844:6878) back to trunk.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6879 c8812cc2-4d05-0410-92ff-de0c093fc19c
2007-04-11 11:46:35 +00:00
wonder
46a2d125a2 Merged refactoring branch back to trunk.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6415 c8812cc2-4d05-0410-92ff-de0c093fc19c
2007-01-09 02:39:15 +00:00