Skip to content
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

Add Profile.BellSound to Settings UI #17983

Merged
merged 17 commits into from
Dec 12, 2024
Merged

Conversation

carlos-zamora
Copy link
Member

Summary of the Pull Request

Adds the Profile.BellSound setting to the Settings UI under the Profile > Advanced page.

  • View changes:
    • The setting is exposed via an expander placed near the Profile.BellStyle setting.
    • Added a button to be able to preview the added sound
    • Added a browse button that opens a file picker
    • Added a delete button to be able to delete each sound entry
  • View model changes:
    • CurrentBellSounds keeps track of the bell sounds added and exposed via the UI.
    • BellSoundViewModel wraps each sound. This allows us to listen (and propagate) changes to the registered sounds.
    • BellSoundPreview provides a written preview of the current bell sound to display in the expander

#10000

@carlos-zamora

This comment was marked as outdated.

This comment has been minimized.

@DHowett
Copy link
Member

DHowett commented Oct 1, 2024

Probably we don't need to have one browse button per line. Since the indices don't matter in the backend, there is no difference between "replace an entry inline" and "delete old entry, click add (which opens a Browse window)", except that the first is much more complicated from both a developer standpoint (tracking which index to replace) and a user one ("why are there so many buttons?")

This comment has been minimized.

@carlos-zamora
Copy link
Member Author

Probably we don't need to have one browse button per line. Since the indices don't matter in the backend, there is no difference between "replace an entry inline" and "delete old entry, click add (which opens a Browse window)", except that the first is much more complicated from both a developer standpoint (tracking which index to replace) and a user one ("why are there so many buttons?")

Added the demo above.

Yeah, for designs 2 & 3, we I think we may be able to remove BellSoundViewModel entirely and just search for a matching string.

I'm gonna hold off on making that change for a bit though, because I want consensus on a design first. Adding "Needs-Discussion" so we touch base on the design at the upcoming sync.

@carlos-zamora carlos-zamora added the Needs-Discussion Something that requires a team discussion before we can proceed label Oct 1, 2024
@carlos-zamora
Copy link
Member Author

carlos-zamora commented Oct 10, 2024

Feedback from team sync (10/7):

  • Drag and drop would be cool, but there isn't really a nice spot for it. (maybe drop on the "+ add sound" button)
    • punted
  • (nit) take advantage of more width? (skipped)
  • [test]: sound is playing, but we navigate to another page
    • we stop playing the sound and navigate just fine. Nice!
  • take the users home directory and replace it with ~
    • [idea] display the filename, and display the directory path separately as a subtitle
      • [idea] only display the directory if there's multiple files with the same name
  • [idea] when sound is added, we copy it over to the local folder
    • punted at this point
  • We should validate that the files exist
    • maybe strikethrough the item that didn't load?
    • definitely don't try and play sound!
  • Bell style interaction
    • have a preview
    • add a warning if "style: audible" is off
    • In "Bell sound" help text, say "you will need to enable "Bell notification style, audible"
    • in the future, combine bell style and sound
  • [bug] if you close the file picker, we add an empty entry

@carlos-zamora carlos-zamora removed the Needs-Discussion Something that requires a team discussion before we can proceed label Oct 21, 2024

This comment has been minimized.

This comment has been minimized.

@carlos-zamora
Copy link
Member Author

Demo

photo credit: Dustin

image

image

Copy link
Contributor

@PankajBhojwani PankajBhojwani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of questions

{
newSounds.Append(sound);
}
_profile.BellSound(newSounds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this cause the inherited sounds to be written to the json for this profile even if no edits are made to them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. From testing it just now:

  • clicking save when no changes have been made --> bell sound isn't added
  • clicking save after adding a sound --> sound gets serialized
  • clicking save after adding a sound them deleting the added sound --> bell sound serialized as empty list

NOTE: I did find a bug where adding a sound when none are defined in the inheritance tree would cause a crash! That'll be fixed in the upcoming commit.

src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsEditor/ProfileViewModel.h Outdated Show resolved Hide resolved
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 3, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 11, 2024
@carlos-zamora carlos-zamora merged commit 8ef77fb into main Dec 12, 2024
18 of 20 checks passed
@carlos-zamora carlos-zamora deleted the dev/cazamor/SUI/bell-sound branch December 12, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants