[MWB] add Name2IP field to Settings (#26290)

* [MWB] add Name2IP field to Settings

* f: add explanation

* f: spelling

* f: comment
This commit is contained in:
Andrey Nekrasov 2023-05-25 16:55:11 +02:00 committed by GitHub
parent 0bf4cfd8b5
commit dbc11b8920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 0 deletions

View File

@ -370,6 +370,16 @@
<data name="MouseWithoutBorders_SameSubnetOnly.Description" xml:space="preserve"> <data name="MouseWithoutBorders_SameSubnetOnly.Description" xml:space="preserve">
<value>Only connect to machines in the same intranet NNN.NNN.*.* (only works when both machines have IPv4 enabled)</value> <value>Only connect to machines in the same intranet NNN.NNN.*.* (only works when both machines have IPv4 enabled)</value>
</data> </data>
<data name="MouseWithoutBorders_IPAddressMapping_TextBoxControl.PlaceholderText" xml:space="preserve">
<value>Example: MyLaptop 192.168.0.24</value>
<comment>Don't translate MyLaptop</comment>
</data>
<data name="MouseWithoutBorders_IPAddressMapping.Header" xml:space="preserve">
<value>IP address mapping</value>
</data>
<data name="MouseWithoutBorders_IPAddressMapping.Description" xml:space="preserve">
<value>Resolve machine's IP address using manually entered mappings below.</value>
</data>
<data name="MouseWithoutBorders_BlockScreenSaverOnOtherMachines.Description" xml:space="preserve"> <data name="MouseWithoutBorders_BlockScreenSaverOnOtherMachines.Description" xml:space="preserve">
<value>Prevent screen saver from starting on other machines when user is actively working on this machine.</value> <value>Prevent screen saver from starting on other machines when user is actively working on this machine.</value>
</data> </data>
@ -386,6 +396,9 @@
<value>Keyboard shortcuts</value> <value>Keyboard shortcuts</value>
<comment>keyboard is the hardware peripheral</comment> <comment>keyboard is the hardware peripheral</comment>
</data> </data>
<data name="MouseWithoutBorders_AdvancedSettings_Group.Header" xml:space="preserve">
<value>Advanced Settings</value>
</data>
<data name="MouseWithoutBorders_EasyMouseOption.Header" xml:space="preserve"> <data name="MouseWithoutBorders_EasyMouseOption.Header" xml:space="preserve">
<value>Easy Mouse: move between machines by moving the mouse pointer to the screen edges.</value> <value>Easy Mouse: move between machines by moving the mouse pointer to the screen edges.</value>
</data> </data>

View File

@ -736,6 +736,28 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
} }
public string Name2IP
{
// Due to https://github.com/microsoft/microsoft-ui-xaml/issues/1826, we must
// add back \n chars on set and remove them on get for the widget
// to make its behavior consistent with the old UI and MWB internal code.
get
{
return Settings.Properties.Name2IP.Value.Replace("\r\n", "\r");
}
set
{
var newValue = value.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
if (Settings.Properties.Name2IP.Value != newValue)
{
Settings.Properties.Name2IP.Value = newValue;
NotifyPropertyChanged();
}
}
}
public bool SameSubnetOnly public bool SameSubnetOnly
{ {
get get

View File

@ -386,6 +386,28 @@
</ComboBox> </ComboBox>
</labs:SettingsCard> </labs:SettingsCard>
</controls:SettingsGroup> </controls:SettingsGroup>
<controls:SettingsGroup
x:Uid="MouseWithoutBorders_AdvancedSettings_Group"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<labs:SettingsExpander
x:Uid="MouseWithoutBorders_IPAddressMapping"
IsExpanded="True">
<labs:SettingsExpander.Items>
<labs:SettingsCard ContentAlignment="Vertical"
HorizontalContentAlignment="Stretch">
<TextBox
x:Uid="MouseWithoutBorders_IPAddressMapping_TextBoxControl"
MinWidth="240" MinHeight="160"
AcceptsReturn="True"
ScrollViewer.IsVerticalRailEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollMode="Enabled"
Text="{x:Bind Mode=TwoWay, Path=ViewModel.Name2IP, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="MouseWithoutBorders_TroubleShooting" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"> <controls:SettingsGroup x:Uid="MouseWithoutBorders_TroubleShooting" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<labs:SettingsCard <labs:SettingsCard
x:Uid="MouseWithoutBorders_AddFirewallRuleButtonControl" x:Uid="MouseWithoutBorders_AddFirewallRuleButtonControl"