Skip to content

Commit

Permalink
Add tooltips to all settings (#801)
Browse files Browse the repository at this point in the history
* Add tooltips to all settings

This adds tooltips to all settings exposed by `livesplit-core`. Copilot
helped a lot here.

Co-authored-by: wooferzfg <spapushin@gmail.com>
  • Loading branch information
CryZe and wooferzfg committed May 6, 2024
1 parent 47bf322 commit be38e2b
Show file tree
Hide file tree
Showing 20 changed files with 580 additions and 124 deletions.
2 changes: 2 additions & 0 deletions capi/bind_gen/src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ export interface SettingsDescriptionJson {
export interface SettingsDescriptionFieldJson {
/** The name of the setting. */
text: string,
/** The tooltip to show for the setting. */
tooltip: string,
/** The current value of the setting. */
value: SettingsDescriptionValueJson,
}
Expand Down
12 changes: 10 additions & 2 deletions src/component/blank_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,16 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new("Size".into(), u64::from(self.settings.size).into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Size".into(),
"The size of the component.".into(),
u64::from(self.settings.size).into(),
),
])
}

Expand Down
19 changes: 16 additions & 3 deletions src/component/current_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,26 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Display 2 Rows".into(),
"Specifies whether to display the name of the component and the comparison in two separate rows.".into(),
self.settings.display_two_rows.into(),
),
Field::new("Label Color".into(), self.settings.label_color.into()),
Field::new("Value Color".into(), self.settings.value_color.into()),
Field::new(
"Label Color".into(),
"The color of the component's name. If not specified, the color is taken from the layout.".into(),
self.settings.label_color.into(),
),
Field::new(
"Value Color".into(),
"The color of the comparison's name. If not specified, the color is taken from the layout.".into(),
self.settings.value_color.into(),
),
])
}

Expand Down
26 changes: 22 additions & 4 deletions src/component/current_pace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,36 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Comparison".into(),
"The comparison to predict the final time from. If not specified, the current comparison is used.".into(),
self.settings.comparison_override.clone().into(),
),
Field::new(
"Display 2 Rows".into(),
"Specifies whether to display the name of the component and the predicted time in two separate rows.".into(),
self.settings.display_two_rows.into(),
),
Field::new("Label Color".into(), self.settings.label_color.into()),
Field::new("Value Color".into(), self.settings.value_color.into()),
Field::new("Accuracy".into(), self.settings.accuracy.into()),
Field::new(
"Label Color".into(),
"The color of the component's name. If not specified, the color is taken from the layout.".into(),
self.settings.label_color.into(),
),
Field::new(
"Value Color".into(),
"The color of the predicted time. If not specified, the color is taken from the layout.".into(),
self.settings.value_color.into(),
),
Field::new(
"Accuracy".into(),
"The accuracy of the predicted time shown.".into(),
self.settings.accuracy.into(),
),
])
}

Expand Down
26 changes: 22 additions & 4 deletions src/component/delta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,36 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Comparison".into(),
"The comparison to use for calculating how far ahead or behind the current attempt is. If not specified, the current comparison is used.".into(),
self.settings.comparison_override.clone().into(),
),
Field::new(
"Display 2 Rows".into(),
"Specifies whether to display the name of the comparison and the delta in two separate rows.".into(),
self.settings.display_two_rows.into(),
),
Field::new("Label Color".into(), self.settings.label_color.into()),
Field::new("Drop Decimals".into(), self.settings.drop_decimals.into()),
Field::new("Accuracy".into(), self.settings.accuracy.into()),
Field::new(
"Label Color".into(),
"The color of the comparison name. If not specified, the color is taken from the layout.".into(),
self.settings.label_color.into()
),
Field::new(
"Drop Decimals".into(),
"Specifies if the decimals should not be shown anymore when the visualized delta is over a minute.".into(),
self.settings.drop_decimals.into(),
),
Field::new(
"Accuracy".into(),
"The accuracy of the delta shown.".into(),
self.settings.accuracy.into()
),
])
}

Expand Down
36 changes: 33 additions & 3 deletions src/component/detailed_timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,46 +354,64 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Timing Method".into(),
"Specifies the timing method to use. If not specified, the current timing method is used.".into(),
self.settings.timer.timing_method.into(),
),
Field::new(
"Comparison 1".into(),
"The first comparison to show the segment time of. If not specified, the current comparison is used.".into(),
self.settings.comparison1.clone().into(),
),
Field::new(
"Comparison 2".into(),
"The second comparison to show the segment time of. If not specified, the current comparison is used, unless the first comparison is also None. This is not shown if the second comparison is hidden.".into(),
self.settings.comparison2.clone().into(),
),
Field::new(
"Hide Second Comparison".into(),
"Specifies whether to only show a single comparison.".into(),
self.settings.hide_second_comparison.into(),
),
Field::new(
"Timer Height".into(),
"The height of the run timer.".into(),
u64::from(self.settings.timer.height).into(),
),
Field::new(
"Segment Timer Height".into(),
"The height of the segment timer.".into(),
u64::from(self.settings.segment_timer.height).into(),
),
Field::new(
"Timer Color".into(),
"Instead of automatically determining the color for the main timer based on a how well the current attempt is doing, a specific color to always be used can be provided instead.".into(),
self.settings.timer.color_override.into(),
),
Field::new(
"Show Timer Gradient".into(),
"The main timer automatically turns its color into a vertical gradient if this setting is activated. Otherwise, the actual color is used instead of a gradient.".into(),
self.settings.timer.show_gradient.into(),
),
Field::new(
"Timer Digits Format".into(),
"Specifies how many digits to show for the main timer. If the duration is lower than the digits to be shown, zeros are shown instead.".into(),
self.settings.timer.digits_format.into(),
),
Field::new("Timer Accuracy".into(), self.settings.timer.accuracy.into()),
Field::new(
"Timer Accuracy".into(),
"The accuracy of the time shown for the main timer.".into(),
self.settings.timer.accuracy.into(),
),
Field::new(
"Segment Timer Color".into(),
"Changes the color of the segment timer to a color different from the default color.".into(),
self.settings
.segment_timer
.color_override
Expand All @@ -402,37 +420,49 @@ impl Component {
),
Field::new(
"Show Segment Timer Gradient".into(),
"The segment timer automatically turns its color into a vertical gradient if this setting is activated. Otherwise, the actual color is used instead of a gradient.".into(),
self.settings.segment_timer.show_gradient.into(),
),
Field::new(
"Segment Timer Digits Format".into(),
"Specifies how many digits to show for the segment timer. If the duration is lower than the digits to be shown, zeros are shown instead.".into(),
self.settings.segment_timer.digits_format.into(),
),
Field::new(
"Segment Timer Accuracy".into(),
"The accuracy of the time shown for the segment timer.".into(),
self.settings.segment_timer.accuracy.into(),
),
Field::new(
"Comparison Names Color".into(),
"The color of the comparison names if they are shown. If no color is specified, the color is taken from the layout.".into(),
self.settings.comparison_names_color.into(),
),
Field::new(
"Comparison Times Color".into(),
"The color of the comparison times if they are shown. If no color is specified, the color is taken from the layout.".into(),
self.settings.comparison_times_color.into(),
),
Field::new(
"Comparison Times Accuracy".into(),
"The accuracy of the comparison times.".into(),
self.settings.comparison_times_accuracy.into(),
),
Field::new(
"Show Segment Name".into(),
"Specifies whether the segment name should be shown.".into(),
self.settings.show_segment_name.into(),
),
Field::new(
"Segment Name Color".into(),
"The color of the segment name if it's shown. If no color is specified, the color is taken from the layout.".into(),
self.settings.segment_name_color.into(),
),
Field::new("Display Icon".into(), self.settings.display_icon.into()),
Field::new(
"Display Icon".into(),
"Specifies whether the segment icon should be shown.".into(),
self.settings.display_icon.into(),
),
])
}

Expand Down
26 changes: 23 additions & 3 deletions src/component/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,37 +279,57 @@ impl Component {
SettingsDescription::with_fields(vec![
Field::new(
"Comparison".into(),
"The comparison to use for the graph. If not specified, the current comparison is used.".into(),
self.settings.comparison_override.clone().into(),
),
Field::new("Height".into(), u64::from(self.settings.height).into()),
Field::new(
"Height".into(),
"The height of the chart.".into(),
u64::from(self.settings.height).into(),
),
Field::new(
"Show Best Segments".into(),
"Specifies whether to color the best segments with the layout's best segment color.".into(),
self.settings.show_best_segments.into(),
),
Field::new("Live Graph".into(), self.settings.live_graph.into()),
Field::new("Flip Graph".into(), self.settings.flip_graph.into()),
Field::new(
"Live Graph".into(),
"Specifies whether the graph should automatically refresh all the time. If this is deactivated, changes to the graph only happen whenever the current segment changes.".into(),
self.settings.live_graph.into(),
),
Field::new(
"Flip Graph".into(),
"Specifies whether the chart should be flipped vertically. If not enabled, split times which are ahead of the comparison are displayed below the x-axis and times which are behind are above it. Enabling this settings flips it.".into(),
self.settings.flip_graph.into(),
),
Field::new(
"Behind Background Color".into(),
"The background color for the chart region containing the times that are behind the comparison.".into(),
self.settings.behind_background_color.into(),
),
Field::new(
"Ahead Background Color".into(),
"The background color for the chart region containing the times that are ahead of the comparison.".into(),
self.settings.ahead_background_color.into(),
),
Field::new(
"Grid Lines Color".into(),
"The color of the chart's grid lines.".into(),
self.settings.grid_lines_color.into(),
),
Field::new(
"Graph Lines Color".into(),
"The color of the lines connecting the graph's points.".into(),
self.settings.graph_lines_color.into(),
),
Field::new(
"Partial Fill Color".into(),
"The color of the region enclosed by the x-axis and the graph. The partial fill color is only used for live changes. More specifically, this color is used in the interval from the last split time to the current time.".into(),
self.settings.partial_fill_color.into(),
),
Field::new(
"Complete Fill Color".into(),
"The color of the region enclosed by the x-axis and the graph, excluding the graph segment with live changes.".into(),
self.settings.complete_fill_color.into(),
),
])
Expand Down
22 changes: 19 additions & 3 deletions src/component/pb_chance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,29 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Display 2 Rows".into(),
"Specifies whether to display the name of the component and the PB chance in two separate rows."
.into(),
self.settings.display_two_rows.into(),
),
Field::new("Label Color".into(), self.settings.label_color.into()),
Field::new("Value Color".into(), self.settings.value_color.into()),
Field::new(
"Label Color".into(),
"The color of the component's name. If not specified, the color is taken from the layout."
.into(),
self.settings.label_color.into(),
),
Field::new(
"Value Color".into(),
"The color of the PB chance. If not specified, the color is taken from the layout."
.into(),
self.settings.value_color.into(),
),
])
}

Expand Down
27 changes: 23 additions & 4 deletions src/component/possible_time_save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,41 @@ impl Component {
/// component and their current values.
pub fn settings_description(&self) -> SettingsDescription {
SettingsDescription::with_fields(vec![
Field::new("Background".into(), self.settings.background.into()),
Field::new(
"Background".into(),
"The background shown behind the component.".into(),
self.settings.background.into(),
),
Field::new(
"Comparison".into(),
"The comparison to calculate the possible time save for. If not specified, the current comparison is used.".into(),
self.settings.comparison_override.clone().into(),
),
Field::new(
"Display 2 Rows".into(),
"Specifies whether to display the name of the component and the possible time save in two separate rows.".into(),
self.settings.display_two_rows.into(),
),
Field::new(
"Show Total Possible Time Save".into(),
"Specifies whether to show the total possible time save for the remainder of the current attempt, instead of the possible time save for the current segment.".into(),
self.settings.total_possible_time_save.into(),
),
Field::new("Label Color".into(), self.settings.label_color.into()),
Field::new("Value Color".into(), self.settings.value_color.into()),
Field::new("Accuracy".into(), self.settings.accuracy.into()),
Field::new(
"Label Color".into(),
"The color of the component's name. If not specified, the color is taken from the layout.".into(),
self.settings.label_color.into(),
),
Field::new(
"Value Color".into(),
"The color of the possible time save. If not specified, the color is taken from the layout.".into(),
self.settings.value_color.into(),
),
Field::new(
"Accuracy".into(),
"The accuracy of the possible time save shown.".into(),
self.settings.accuracy.into(),
),
])
}

Expand Down

0 comments on commit be38e2b

Please sign in to comment.