-
Notifications
You must be signed in to change notification settings - Fork 455
Add theme background image feature #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
felixse
merged 42 commits into
felixse:master
from
YohskDista:539-ThemeBackgroundImageFeature
Oct 20, 2019
Merged
Add theme background image feature #545
felixse
merged 42 commits into
felixse:master
from
YohskDista:539-ThemeBackgroundImageFeature
Oct 20, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The goal was to create a command that permit to browse user pictures. The user can now select is picture by browsing file or to simply copy the link of the image in the textbox.
We call the method `ImportImageFile` so that we can show a picker dialog and directly import the image in the roaming folder. We make some check to avoid the application crash, still need to test
Now that we have a background image we need to set the background according to the theme color or the selected image. To do this we need to use the `ThemeViewModel` and the new converter to select the right brush to use (`ImageBrush` or ` AcrylicBrush`)
If we don't notify the view that the selected theme has changed with another theme that has the same background but a different background image we'll never see this image appear. In fact the background change is triggered by the background color change.
Looks good so far, nice work 👍 Some things I have noticed:
|
Thanks ! I've made the suggestion that you were talking. I let you check if it's ok for you now 👍 |
felixse
approved these changes
Oct 20, 2019
This is such a cool feature! Thanks a lot! :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal
The goal of this PR is to be able to select and show a background image for a custom theme and have a more fancy terminal. This refers to the issue #539.
What was done
Theme settings
Add / Edit the theme
Firstly we add a browse button when we create or edit a theme so that the user can select an image in a specific folder of his computer. Once the image is selected we will put it in the
LocalCache/BackgroundImageTmp
folder so that we can show a preview to the user.We need to do this because our application cannot access or show an image that is outside its application folder unless we gave the application the specific capabilities.
To do a preview of the background image we must have a background color below the toolbar and the color configuration otherwise we didn't see anything because of the image.
When we save the theme we will remove all the image in the temporary folder and save the selected one in the
Roaming
folder.We create an interface to manage the selection of these image functionnality called
IImageFileSystemService
. That allow us to separate the file system managment from the image theme managment.Remove the background image
We put a button to be able to remove the background image any time we want. If we click on the cancel button after we deleted the image don't worry, we don't loose your precious image :)
Import / Export
We add the possibility to import and export the theme with the background image (if it exists). When we export it we encode the image in a base64 string and decode it when we import the theme.
To export/import the theme we need to create an
ExportedTerminalTheme
object that contains aTerminalTheme
and the encoded image string. We did this because it was a pitty to change theTerminalTheme
object for this encoded image that we need only for the import/export theme.Show the background image
Now we can show the background image of the selected theme directly in the
TerminalView
. Be carefull to select a good image so that you can still see the text of the console ;)