51862 Commits

Author SHA1 Message Date
Alessandro Pasotti
64bd7a7ced Added ~QgsDataSourceSelectDialog destructor 2018-11-05 10:45:40 +01:00
Alessandro Pasotti
f02345bd8b Remove unnecessary project from test data 2018-11-05 10:27:02 +01:00
Alessandro Pasotti
eb02004b60 Store original style as QDomDocument instead of an XML string 2018-11-05 10:27:02 +01:00
Nyall Dawson
bc8574ce5c Small cleanups for QgsDataSourceSelectDialog 2018-11-05 10:27:02 +01:00
Alessandro Pasotti
a4182c1e04 Remove unnecessary project from test data 2018-11-05 10:26:39 +01:00
Alessandro Pasotti
7a259c6ea5 Better handling of invalid relations ...
- do not add them to the manager dialog
- do not add relations to not existent layers (but keep relations to invalid layers)
2018-11-05 10:26:39 +01:00
Alessandro Pasotti
2d1a521fe4 Check for raster validity in raster style widget 2018-11-05 10:26:39 +01:00
Alessandro Pasotti
bc424d09c1 Store original style as QDomDocument instead of an XML string 2018-11-05 10:26:39 +01:00
Alessandro Pasotti
d46d765d58 Restore handle bad layers dialog original behavior 2018-11-05 10:26:39 +01:00
Alessandro Pasotti
8493636f18 Data source select dialog now accepts a model 2018-11-05 10:26:39 +01:00
Alessandro Pasotti
086be3832c Rendering test for bad layers and setDataSource 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
64c23dec34 Spelling 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
17433181aa Fix raster style restore when setDataSource 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
fbea9f5d50 Renamed buttons for bad layers dialog 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
70d9b6ca43 Fix check condition for layer style restore 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
4481127b9a Fix raster set data source (with test) 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
29cbb23ab3 Take context by copy in lambda 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
661aad7ef9 Add … to change data source action 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
8d84a6fcbd Remove unused connection 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
ab7b45704c Copy! References in lambdas are dangerous
Note to self: repeat 3 times:

Copy! References in lambdas are dangerous
Copy! References in lambdas are dangerous
Copy! References in lambdas are dangerous
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
fd40042514 Move change data source action to app 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
8d9d52d128 Add test data for relations 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
0cf8a33dab Fix crash due to index on wrong model 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
0cd21c91f1 Keep invalid relations and update them when the data source changes
Added a check for layer.isValid in relation.isValid, keep
relations in the manager even if they are not valid and
connect dataSourceChanged with updateRelationStatus
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
2bd90da9c1 Added a validOnly flag to mapLayers to filter for valid layers only 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
455b660e6b Fix crash in raster readXml when data provide cannot be created
Actually it was a consequence of a broken test, but there
is no need to crash.
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
bd71df0054 Add the bad layers test to cmake and fix it for renamed methods 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
adc3b741e8 Only filter by layer type: ignore provider key 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
d995eeb0d7 Filter layers by type in the data source select dialog 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
3e9d5c7326 Restore original layer style (tested with vectors only) 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
3fe7848c16 Noted in the method documentation that dataProvider() may return null 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
f856b4c8e3 Renamed originalXmlProperties methods and variables 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
9cfb4369f9 Tests for bad layers raster support 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
2af5fd1950 Bad layers indicator raster support 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
66b9b5fd55 Changed debug message text for bad layers 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
acb6f42d60 Variable rename (get rid of "my" prefix) 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
326640d881 Implement setDataSource for rasters 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
c32d542be5 Move setDataSource to QgsMapLayer
also setter and getter for providerType
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
7bbd1ca252 [ogr] do not crash if ogr layer is null 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
147608ea98 Bad layers: open a browser widget dialog to select a data source
when indicator is clicked
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
f2654f25c6 Remove modal warning when closing the bad layer dialog 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
99638cfdb6 More readable test 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
5010956cb4 Add test case for getFeatures on invalid bad layer 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
4077104293 Silence longstanding debug warning 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
497a7da9de Added API methods to retrieve only valid maplayers
... and to count them

Tests updated accordingly, note that from now on
the assumption that a layer store or a layer project
contains only valid layers will not be true anymore.

To be honest it has never been true, because a
layer can become invalid at any time during
its life cycle, so better never assume that a
layer from the store or from the project is vaid.
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
f9289802a3 Add test for handle bad layers and invalid layers pass through 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
670c31b059 Do not bail out from reading the layer xml if layer is not valid 2018-11-05 10:24:35 +01:00
Alessandro Pasotti
7a0faed5f0 Handles invalid layer properties when saving
Invalid layers just pass through if the layer
was saved without changing the data source.
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
1b041f4f4f Add storeInvalidLayersProperties to store invalid layers
This can be used to restore initial layer status or to
apply styles and other layer properties if the data
source is changed.

The idea is that the user can fix bad layers at any time,
and by setting a new datasource she probably wants
to keep the original layer properties.
2018-11-05 10:24:35 +01:00
Alessandro Pasotti
bcd8581f89 Add menu items also if invalid (but check for it) 2018-11-05 10:24:35 +01:00