qgis / QGIS-Enhancement-Proposals

QEP's (QGIS Enhancement Proposals) are used in the process of creating and discussing new enhancements for QGIS
117 stars 37 forks source link

QEP 82: Unified Application Profiles #82

Closed NathanW2 closed 4 years ago

NathanW2 commented 7 years ago

QGIS Enhancement 82: Unified Application Configuration

Date 2016/11/12 Author Nathan Woodrow @NathanW2 Contact woodrow.nathan@gmail.com maintainer @NathanW2 Version QGIS 3.0

Summary

This QEP is to add and expand Unified Application Configuration support into core QGIS. The main idea is to bundle everything that is normally in .qgis2 and settings (registry on windows, config files on OS X/*nix, etc) into a single folder in the users platform based settings folder. This would allow the creation of saved config folder, you can think of them like profiles in Chrome/Firebreak, etc

The config folder would be a single folder with all .qgis2 and settings files which currently the result of doing the following in QGIS 2:

qgis --configpath folder\qgis

As saved configs contain isolated settings and plugins they can be great for different workflows, demos, users of the same machine, or testing settings, etc.

Proposal includes removing the use of current .qgis2 and settings paths (registry on Windows) in QGIS 3.x in favour of new profiles folder setup.

I think this method of storing settings and plugins, etc, could remove a lot of current confusion in how QGIS stores settings, as well as increase the flexibility in enterprise style deployments of QGIS.

Backups of user profiles also because very easy. A simple copy the profile folder to make a backup.

Proposed Solution

This proposal is to add new option --profile, as well as UI related to creating and switching saved configs.

All configs would live in a single top level folder in the platform dependent location e.g appdata on windows, etc, A link the about screen would also have the option to locate the current profile folder in the OS file manager.

An example of profile layout:

%APPDATA%
 - \QGIS
   - \configs
      - .default
      - \config1
      - \config2
      - \config3

By default, QGIS would run using the default config which is found in .default, e.g profile1

Part of this QEP is also loading machine-wide settings that are installed in the QGIS install folder. These should be loaded and then joined with the users saved config settings. Settings will follow the same format as the a users folder setup however there is only one.

Affected Files.

main() of QGIS would be altered to load configs from the settings folder.

A new class will also be introduced called QgsSettings which hides the implementation of config loading away from the code base. QgsSettings will be used in place of QSettings though out the core code base.

QgsSettings will have an API similar to QSettings in order to be a drop in replacement. The current implementation is to just be a wrapper for QSettings however in the future this could hold other logic for finding settings.

Performance Implications

None.

Further Considerations/Improvements

Cloud config

By hiding any implementation details inside QgsSettings we can also add loading config from a database and webserver in the future.

Webserver could expose endpoints to download/upload zip files of the user's config folder into a hosted environment. This is out of the scope of this QEP, however, this can be used as a building block for that function in future.

Backups

Built in backup process to allow rollbacks of settings. As the settings file is simply text files each change and is backed up and compressed for later rollback.

Backwards Compatibility

If QGIS 3.0 will inherit the settings of QGIS 2.x would migrate any existing settings and plugins into the new profile folder layout.

Issue Tracking ID(s)

(optional)

dakcarto commented 7 years ago

Ok. So if one were to just want to set defaults, add [QGIS]/QGIS3 to the QgsApplication::pkgDataPath()/<some standard name for defaults>/ directory? Or, some variation on that?

NathanW2 commented 7 years ago

Yeah

On Tue, Jan 31, 2017 at 9:39 AM, Larry Shaffer notifications@github.com wrote:

Ok. So if one were to just want to set defaults, add [QGIS]/QGIS3 to the QgsApplication::pkgDataPath()// directory? Or, some variation on that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Enhancement-Proposals/issues/82#issuecomment-276227727, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXS3Byh7wH9OJqkcdEX5Agkkx8N0nieks5rXnTFgaJpZM4KwZyI .

dakcarto commented 7 years ago

Seems like the install-relative defaults wouldn't necessarily be something you would want copied over to a user config directory, if the referenced directory is also the template for such a user config.

Or, maybe you do, as a starting point for editing, since, in user space, those settings are just user overrides, not defaults?

NathanW2 commented 7 years ago

No they aren't copied over. I'm just saying we use the same folder layout in the install folder as we do for the user configs.

Or we can just have it load a .ini file if that is easier. I was just trying to think if we wanted to be able to deploy other non settings based stuff, like symbols etc.

On Tue, Jan 31, 2017 at 9:45 AM, Larry Shaffer notifications@github.com wrote:

Seems like the install-relative defaults wouldn't necessarily be something you would want copied over to a user config directory, if the referenced directory is also the template for such a user config.

Or, maybe you do, as a starting point for editing, since, in user space, those settings are just user overrides, not defaults?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Enhancement-Proposals/issues/82#issuecomment-276228839, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXS3GUOj85AeDVGbWlFaCAnwsaMu2Mtks5rXnYpgaJpZM4KwZyI .

dakcarto commented 7 years ago

Ah, ok, good point. Yeah, seems like a good idea to me.

elpaso commented 7 years ago

@NathanW2 @dakcarto I've updated the dev branch with a full implementation with bindings and tests for the QgsSettings class: https://github.com/boundlessgeo/QGIS/tree/qgssettings-prototype https://github.com/boundlessgeo/QGIS/blob/qgssettings-prototype/src/core/qgssettings.h

doxigen comments are still missing and I'd probably add some more shortcuts.

haubourg commented 7 years ago

I just had a look of current master's status concerning profiles management. --configpath has no more effect and is replaced by the profiles-path and profile-name.

Shouldn't we raise a message if a qgis session is launched with deprecated options ?

NathanW2 commented 7 years ago

Yep that is a good idea.

On Fri, Sep 1, 2017 at 12:32 AM, Régis Haubourg notifications@github.com wrote:

I just had a look of current master's status concerning profiles management. --configpath has no more effect and is replaced by the profiles-path and profile-name.

Shouldn't we raise a message if a qgis session is launched with deprecated options ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Enhancement-Proposals/issues/82#issuecomment-326314156, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXS3K6RM-KXxIZ0_zoR4r4MHOeajkqwks5sdsQAgaJpZM4KwZyI .