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 a progress ring indicator to the tab header #8133

Merged
28 commits merged into from
Dec 16, 2020
Merged

Conversation

PankajBhojwani
Copy link
Contributor

@PankajBhojwani PankajBhojwani commented Nov 2, 2020

This commit adds a progress ring to the tab header when we receive an
OSC 9 sequence.

Adds an event handler in Tab.cpp for the event we raise when we get a
request to set the taskbar state/progress. This event handler updates
the tab header with the active control's state/progress.

When we want to show the progress ring, we hide the tab icon and place
the progress ring over it.

References #6700

@PankajBhojwani PankajBhojwani changed the title Progress ring indicator in tab header [DRAFT] Progress ring indicator in tab header Nov 2, 2020
@skyline75489
Copy link
Collaborator

Maybe we should extract some common pattern in this PR to support features like #8106 in the future.

@zadjii-msft
Copy link
Member

Maybe we should extract some common pattern in this PR to support features like #8106 in the future.

Yea, i think we've put that off for far too long. I've filed #8201 to track that work ☺️

Base automatically changed from dev/pabhoj/taskbar_progress to main November 18, 2020 22:24
@PankajBhojwani PankajBhojwani changed the title [DRAFT] Progress ring indicator in tab header Progress ring indicator in tab header Dec 4, 2020
@PankajBhojwani PankajBhojwani marked this pull request as ready for review December 4, 2020 19:13
@@ -85,6 +85,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
GETSET_SETTING(bool, AlwaysOnTop, false);
GETSET_SETTING(Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::InOrder);
GETSET_SETTING(bool, DisableAnimations, false);
GETSET_SETTING(bool, DisableProgressRing, false);
Copy link
Member

Choose a reason for hiding this comment

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

quick check on: why is this a setting? is it too specific? should we have an enum for progressIndicatorStyle? tab|taskbar|all|none? I don't know!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's... a fair point. Given that browsers/Visual Studio/other things that have progress indicators do not offer a way to disable them (as far as I know), I'm thinking we remove the setting.

Thoughts?

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Notes inline

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 9, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 10, 2020
@PankajBhojwani
Copy link
Contributor Author

disableProgressRing setting has been removed!

@DHowett
Copy link
Member

DHowett commented Dec 16, 2020

Moved from body:

Determinate: (30 -> 80 -> inactive)
determinate

Indeterminate:
indeterminate

@DHowett DHowett changed the title Progress ring indicator in tab header Add a progress ring indicator to the tab header Dec 16, 2020
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Dec 16, 2020
@ghost
Copy link

ghost commented Dec 16, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 551cc9a into main Dec 16, 2020
@ghost ghost deleted the dev/pabhoj/ring_in_tab branch December 16, 2020 02:45
Copy link
Collaborator

@skyline75489 skyline75489 left a comment

Choose a reason for hiding this comment

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

Confession: I never really get it why this :shipit: means "shipit".

@ghost ghost removed the Needs-Second It's a PR that needs another sign-off label Dec 16, 2020
@DHowett
Copy link
Member

DHowett commented Dec 16, 2020

excellent question!

@zadjii-msft
Copy link
Member

@skyline75489
https://www.quora.com/On-GitHub-what-is-the-significance-of-the-Ship-It-squirrel

@skyline75489
Copy link
Collaborator

@zadjii-msft Thanks! Such a straightforward answer, which takes only ~4000 words if you include the background story.

Originally when I saw :shipit: in some of PRs in the repo, I imagine the meaning of it is "huh you know what, the PR is good, but not that good, so I need to take a look, but from a distance, in a sneaky way, like a squirrel/mouse, for some reason". Yeah, my mind is weird, I know.

mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
This commit adds a [progress ring] to the tab header when we receive an
OSC 9 sequence. 

Adds an event handler in `Tab.cpp` for the event we raise when we get a
request to set the taskbar state/progress. This event handler updates
the tab header with the active control's state/progress. 

When we want to show the progress ring, we hide the tab icon and place
the progress ring over it. 

[progress ring]: https://docs.microsoft.com/en-us/uwp/api/Microsoft.UI.Xaml.Controls.ProgressRing?view=winui-2.4

References microsoft#6700
ghost pushed a commit that referenced this pull request Oct 10, 2022
It turns out that the negative margin for the progress ring is causing
the clipping in case the tab title gets too long:

https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalApp/TabHeaderControl.xaml#L18-L27

The negative margin was introduced in #8113 because the progress ring is
supposed to replace the tab icon but the `TabView` still reserves space
even if no icon is set (see
#8133 (comment)).
However, it is not actually the `TabView` reserving space even when
there is no icon, but a workaround for a crash in the
`IconPathConverter` that returns a `BitmapIconSource` with a `nullptr`
source instead of a `nullptr` `IconSource`:

https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalSettingsModel/IconPathConverter.cpp#L143-L154

The workaround in `IconPathConverter` could probably be removed as I did
not find any instance where it is still used in a way that could trigger
the mentioned crash, but I did not dare to just remove it as I do not
know enough about the code by far. Hence, I opted to just locally
instantiate the `IconSource` with a `nullptr` directly in `TerminalTab`.

Fixes #8910
DHowett pushed a commit that referenced this pull request Oct 13, 2022
It turns out that the negative margin for the progress ring is causing
the clipping in case the tab title gets too long:

https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalApp/TabHeaderControl.xaml#L18-L27

The negative margin was introduced in #8113 because the progress ring is
supposed to replace the tab icon but the `TabView` still reserves space
even if no icon is set (see
#8133 (comment)).
However, it is not actually the `TabView` reserving space even when
there is no icon, but a workaround for a crash in the
`IconPathConverter` that returns a `BitmapIconSource` with a `nullptr`
source instead of a `nullptr` `IconSource`:

https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalSettingsModel/IconPathConverter.cpp#L143-L154

The workaround in `IconPathConverter` could probably be removed as I did
not find any instance where it is still used in a way that could trigger
the mentioned crash, but I did not dare to just remove it as I do not
know enough about the code by far. Hence, I opted to just locally
instantiate the `IconSource` with a `nullptr` directly in `TerminalTab`.

Fixes #8910

(cherry picked from commit 21a9c55)
Service-Card-Id: 86209056
Service-Version: 1.16
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants