Skip to content

Commit

Permalink
[Settings] Run Plugin additional options: description (#17108)
Browse files Browse the repository at this point in the history
* last changes

* update ww settings

* feedbvack and TimeDate plugin

* Add property description
  • Loading branch information
htcfreek committed Mar 21, 2022
1 parent 4c067bb commit 380add8
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 22 deletions.
Expand Up @@ -122,9 +122,9 @@ internal static List<PluginAdditionalOption> GetAdditionalOptions()
},
new PluginAdditionalOption
{
// ToDo: When description property is implemented (#15853), move the note in brackets to description and update to: "The information is only shown, if more than one desktop exists."
Key = nameof(SubtitleShowDesktopName),
DisplayLabel = Resources.wox_plugin_windowwalker_SettingSubtitleDesktopName,
DisplayDescription = Resources.wox_plugin_windowwalker_SettingSubtitleDesktopName_Description,
Value = true,
},
new PluginAdditionalOption
Expand All @@ -135,16 +135,16 @@ internal static List<PluginAdditionalOption> GetAdditionalOptions()
},
new PluginAdditionalOption
{
// ToDo: When description property is implemented (#15853), add description: "Be careful when activating this."
Key = nameof(KillProcessTree),
DisplayLabel = Resources.wox_plugin_windowwalker_SettingKillProcessTree,
DisplayDescription = Resources.wox_plugin_windowwalker_SettingKillProcessTree_Description,
Value = false,
},
new PluginAdditionalOption
{
// ToDo: When description property is implemented (#15853), move the note in brackets to description.
Key = nameof(OpenAfterKillAndClose),
DisplayLabel = Resources.wox_plugin_windowwalker_SettingOpenAfterKillAndClose,
DisplayDescription = Resources.wox_plugin_windowwalker_SettingOpenAfterKillAndClose_Description,
Value = false,
},
new PluginAdditionalOption
Expand All @@ -155,9 +155,9 @@ internal static List<PluginAdditionalOption> GetAdditionalOptions()
},
new PluginAdditionalOption
{
// ToDo: When description property is implemented (#15853), add description: "Message is only shown when searching with direct activation command."
Key = nameof(HideExplorerSettingInfo),
DisplayLabel = Resources.wox_plugin_windowwalker_SettingExplorerSettingInfo,
DisplayDescription = Resources.wox_plugin_windowwalker_SettingExplorerSettingInfo_Description,
Value = false,
},
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -140,13 +140,13 @@
<value>Show only results from visible desktop</value>
</data>
<data name="wox_plugin_windowwalker_SettingSubtitleDesktopName" xml:space="preserve">
<value>Show desktop name in the subtitle (If two or more desktops exist)</value>
<value>Show desktop name in the subtitle</value>
</data>
<data name="wox_plugin_windowwalker_SettingSubtitlePid" xml:space="preserve">
<value>Show process id in the subtitle</value>
</data>
<data name="wox_plugin_windowwalker_SettingOpenAfterKillAndClose" xml:space="preserve">
<value>Stay open after closing windows and killing processes (Not working with kill process confirmation)</value>
<value>Stay open after closing windows and killing processes</value>
</data>
<data name="wox_plugin_windowwalker_Desktop" xml:space="preserve">
<value>Desktop</value>
Expand Down Expand Up @@ -190,4 +190,16 @@
<data name="wox_plugin_windowwalker_SettingKillProcessTree" xml:space="preserve">
<value>Kill process and its child processes</value>
</data>
<data name="wox_plugin_windowwalker_SettingExplorerSettingInfo_Description" xml:space="preserve">
<value>This message is only shown when searching with a direct activation command.</value>
</data>
<data name="wox_plugin_windowwalker_SettingKillProcessTree_Description" xml:space="preserve">
<value>Be careful when activating this. Killing the whole process tree can lead to problematic application crashes.</value>
</data>
<data name="wox_plugin_windowwalker_SettingOpenAfterKillAndClose_Description" xml:space="preserve">
<value>This feature won't work if the kill process confirmation is enabled.</value>
</data>
<data name="wox_plugin_windowwalker_SettingSubtitleDesktopName_Description" xml:space="preserve">
<value>This information is only shown in subtitle and tool tip, if you have at least two desktops.</value>
</data>
</root>
Expand Up @@ -89,23 +89,23 @@ internal static List<PluginAdditionalOption> GetAdditionalOptions()
{
new PluginAdditionalOption()
{
// ToDo: When description property is implemented (#15853), move the note in brackets to description.
Key = nameof(OnlyDateTimeNowGlobal),
DisplayLabel = Resources.Microsoft_plugin_timedate_SettingOnlyDateTimeNowGlobal,
DisplayDescription = Resources.Microsoft_plugin_timedate_SettingOnlyDateTimeNowGlobal_Description,
Value = true,
},
new PluginAdditionalOption()
{
// ToDo: When description property is implemented (#15853), move the note in brackets to description.
Key = nameof(TimeWithSeconds),
DisplayLabel = Resources.Microsoft_plugin_timedate_SettingTimeWithSeconds,
DisplayDescription = Resources.Microsoft_plugin_timedate_SettingTimeWithSeconds_Description,
Value = false,
},
new PluginAdditionalOption()
{
// ToDo: When description property is implemented (#15853), move the note in brackets to description.
Key = nameof(DateWithWeekday),
DisplayLabel = Resources.Microsoft_plugin_timedate_SettingDateWithWeekday,
DisplayDescription = Resources.Microsoft_plugin_timedate_SettingDateWithWeekday_Description,
Value = false,
},
new PluginAdditionalOption()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -247,17 +247,25 @@
<value>Second</value>
</data>
<data name="Microsoft_plugin_timedate_SettingDateWithWeekday" xml:space="preserve">
<value>Show date with weekday and name of month (Applies to 'Date' and 'Now' result)</value>
<value>Show date with weekday and name of month</value>
</data>
<data name="Microsoft_plugin_timedate_SettingDateWithWeekday_Description" xml:space="preserve">
<value>This setting applies to the 'Date' and 'Now' result.</value>
</data>
<data name="Microsoft_plugin_timedate_SettingHideNumberMessageOnGlobalQuery" xml:space="preserve">
<value>Hide 'Invalid number input' error message on global queries</value>
</data>
<data name="Microsoft_plugin_timedate_SettingOnlyDateTimeNowGlobal" xml:space="preserve">
<value>Show only 'Time', 'Date' and 'Now' result on global queries
(Regardless of this setting, on global queries the first search word has to be a full match.)</value>
<value>Show only 'Time', 'Date' and 'Now' result on global queries</value>
</data>
<data name="Microsoft_plugin_timedate_SettingOnlyDateTimeNowGlobal_Description" xml:space="preserve">
<value>Regardless of this setting, for global queries the first word of the query has to be a complete match.</value>
</data>
<data name="Microsoft_plugin_timedate_SettingTimeWithSeconds" xml:space="preserve">
<value>Show time with seconds (Applies to 'Time' and 'Now' result)</value>
<value>Show time with seconds</value>
</data>
<data name="Microsoft_plugin_timedate_SettingTimeWithSeconds_Description" xml:space="preserve">
<value>This setting applies to the 'Time' and 'Now' result.</value>
</data>
<data name="Microsoft_plugin_timedate_SubTitleNote" xml:space="preserve">
<value>Select or press Ctrl+C to copy</value>
Expand Down
5 changes: 5 additions & 0 deletions src/settings-ui/Settings.UI.Library/PluginAdditionalOption.cs
Expand Up @@ -10,6 +10,11 @@ public class PluginAdditionalOption

public string DisplayLabel { get; set; }

/// <summary>
/// Gets or sets a value to show a description of this setting in the settings ui. (Optional)
/// </summary>
public string DisplayDescription { get; set; }

public bool Value { get; set; }
}
}
Expand Up @@ -18,6 +18,8 @@ internal PluginAdditionalOptionViewModel(PluginAdditionalOption additionalOption

public string DisplayLabel { get => _additionalOption.DisplayLabel; }

public string DisplayDescription { get => _additionalOption.DisplayDescription; }

public bool Value
{
get => _additionalOption.Value;
Expand Down
Expand Up @@ -38,8 +38,18 @@ private void Update()
private void CheckBoxSubTextControl_Loaded(object sender, RoutedEventArgs e)
{
StackPanel panel = new StackPanel() { Orientation = Orientation.Vertical };
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 10, 0, 0), Text = Header });
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });

// Add text box only if the description is not empty. Required for additional plugin options.
if (!string.IsNullOrWhiteSpace(Description))
{
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 10, 0, 0), Text = Header });
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
}
else
{
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 0, 0, 0), Text = Header });
}

_checkBoxSubTextControl.Content = panel;
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI/Views/PowerLauncherPage.xaml
Expand Up @@ -253,7 +253,7 @@
<DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel">
<StackPanel Orientation="Vertical">
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox Content="{x:Bind Path=DisplayLabel}"
<controls:CheckBoxWithDescriptionControl Header="{x:Bind Path=DisplayLabel}" Description="{x:Bind Path=DisplayDescription}"
IsChecked="{x:Bind Path=Value, Mode=TwoWay}"
Margin="{StaticResource ExpanderSettingMargin}"/>
</StackPanel>
Expand Down

0 comments on commit 380add8

Please sign in to comment.