3liz / QuickOSM

QGIS plugin to fetch OSM data with the Overpass API
GNU General Public License v2.0
181 stars 54 forks source link

Asking about unsaved layers before closing project #32

Closed sfkeller closed 8 years ago

sfkeller commented 9 years ago

Given a user

Now when reopening, QGIS project manager says "Layer ...not found" and all data is lost.

I therefore propose, that QuickOSM plugin asks user something like "There are unsaved layers. Do you really want to close project?"

Gustry commented 9 years ago

A lot of plugins generates some layers in memory or in the temp folder (Processing is the biggest one). I think it's QGIS which should have a look about the source before saving (if a layer is not in /tmp or in memory). Maybe improving&using this plugin : https://plugins.qgis.org/plugins/MemoryLayerSaver/ ?

sfkeller commented 9 years ago

I thought about this too, that QGIS should care about this and I discussed it with QGIS core programmers. The conclusion is that QGIS can't be made responsible for this. QGIS can't know if a Memory Layer should finally be persisted. Therefore it's still the app/plugin has to care about saving.

Gustry commented 9 years ago

About "QGIS can't know if a Memory Layer should finally be persisted", it's useless for QGIS to save some layers which are in /tmp or in memory, because in 99% these layers won't exist in a few minutes. QGIS must inform the user about these layers : "Be careful, you have some layers in /tmp ...." QuickOSM is just a data provider for QGIS, not responsible for what will happen next. We could just inform better the user that layers won't be saved persistently if they saved the project when the query is finished.

sfkeller commented 9 years ago

That's what I thought first too. But if QGIS would always ask about saving, it would also ask in cases where it shouldn't. So, yes: QuickOSM is a data provider for QGIS and just because of this, it remains responsible what happens to the data and what's stored in the project file.

Gustry commented 8 years ago

Processing has the same behaviour than QuickOSM. I'm closing this issue as I think it's related to QGIS.