Initialize new workspace with some example projects #1307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far, new workspaces didn't contain any projects after their initial creation so the Control Panel project tree was completely empty. However, as suggested in #1267 it would be useful to have some example projects available to help new users evaluating LibrePCB. Thus this PR implements this feature in two ways:
Auto-Initialize New Workspaces
The initial idea was actually to provide a way to open example projects, for example through a menu item File -> Open -> Example Project. However, the question was where they will be opened from and if they are read-only or writable. Also the menu option might not be visible and convenient enough for new users to make them actually using this feature.
Now I decided to go with a different approach. When creating a new workspace, just automatically add some example projects in a subdirectory named "Examples" to the workspace. So the projects will immediately be shown in the Control Panel for new users, ready to be opened like normal projects (also writable!). One might argue that not everyone likes to have these example projects, but in the end it's very easy to just delete them and you only need to do this once. Also I remember EAGLE did it the same way and it never felt annoying to me.
The only question left was whether these example projects shall be bundled with the application or downloaded from the internet on demand. Since this feature is not really important (no problem if the download takes some time or even fails), I decided for the on-demand download to avoid bloating the application with example projects. We just should store them at some reliable, persistent URL.
Manually Add Example Projects
To also allow adding the example projects to existing workspaces, the Control Panel contains a new menu item File -> Import -> Add Example Projects which initiates the download and installation of these projects asynchronously, exactly the same way as described above.
Demo
ToDo
Decide which and how many example projects to install, and make sure to host them at a reliable location.
Closes #1267