mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
Stylecop compliance
This commit is contained in:
committed by
Tomas Agustin Raies
parent
443b3c8b82
commit
a85b84fd56
@@ -1,25 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Text;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class HotkeySettingsControl : UserControl
|
||||
@@ -28,30 +17,35 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
|
||||
public static readonly DependencyProperty HotkeySettingsProperty =
|
||||
DependencyProperty.Register(
|
||||
"HotkeySettings",
|
||||
"HotkeySettings",
|
||||
typeof(HotkeySettings),
|
||||
typeof(HotkeySettingsControl),
|
||||
null);
|
||||
|
||||
private HotkeySettings _hotkeySettings;
|
||||
public HotkeySettings HotkeySettings
|
||||
{
|
||||
get { return _hotkeySettings; }
|
||||
set
|
||||
private HotkeySettings hotkeySettings;
|
||||
|
||||
public HotkeySettings HotkeySettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hotkeySettings != value)
|
||||
return this.hotkeySettings;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.hotkeySettings != value)
|
||||
{
|
||||
_hotkeySettings = value;
|
||||
SetValue(HotkeySettingsProperty, value);
|
||||
HotkeyTextBox.Text = HotkeySettings.ToString();
|
||||
this.hotkeySettings = value;
|
||||
this.SetValue(HotkeySettingsProperty, value);
|
||||
this.HotkeyTextBox.Text = this.HotkeySettings.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettingsControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
HotkeyTextBox.PreviewKeyDown += HotkeyTextBox_KeyDown;
|
||||
this.HotkeyTextBox.PreviewKeyDown += this.HotkeyTextBox_KeyDown;
|
||||
}
|
||||
|
||||
private static bool IsDown(Windows.System.VirtualKey key)
|
||||
@@ -67,27 +61,30 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
e.Key == Windows.System.VirtualKey.RightWindows ||
|
||||
e.Key == Windows.System.VirtualKey.Control ||
|
||||
e.Key == Windows.System.VirtualKey.Menu ||
|
||||
e.Key == Windows.System.VirtualKey.Shift
|
||||
)
|
||||
e.Key == Windows.System.VirtualKey.Shift)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = new HotkeySettings();
|
||||
|
||||
// Display HotKey value
|
||||
if (IsDown(Windows.System.VirtualKey.LeftWindows) ||
|
||||
if (IsDown(Windows.System.VirtualKey.LeftWindows) ||
|
||||
IsDown(Windows.System.VirtualKey.RightWindows))
|
||||
{
|
||||
settings.win = true;
|
||||
}
|
||||
|
||||
if (IsDown(Windows.System.VirtualKey.Control))
|
||||
{
|
||||
settings.ctrl = true;
|
||||
}
|
||||
|
||||
if (IsDown(Windows.System.VirtualKey.Menu))
|
||||
{
|
||||
settings.alt = true;
|
||||
}
|
||||
|
||||
if (IsDown(Windows.System.VirtualKey.Shift))
|
||||
{
|
||||
settings.shift = true;
|
||||
@@ -96,8 +93,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
settings.key = e.Key.ToString();
|
||||
|
||||
// TODO: Check that e.OriginalKey is the ScanCode. It is not clear from docs.
|
||||
settings.code = (int) e.OriginalKey;
|
||||
HotkeySettings = settings;
|
||||
settings.code = (int)e.OriginalKey;
|
||||
this.HotkeySettings = settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,9 @@
|
||||
</Compile>
|
||||
<Compile Include="Behaviors\NavigationViewHeaderBehavior.cs" />
|
||||
<Compile Include="Behaviors\NavigationViewHeaderMode.cs" />
|
||||
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
|
||||
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Helpers\NavHelper.cs" />
|
||||
<Compile Include="Helpers\Observable.cs" />
|
||||
@@ -205,6 +208,10 @@
|
||||
<PRIResource Include="Strings\en-us\Resources.resw" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Controls\HotkeySettingsControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\Page.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -1,181 +1,218 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerLauncherViewModel : Observable
|
||||
{
|
||||
public PowerLauncherSettings settings;
|
||||
private const string POWERTOY_NAME = "PowerLauncher";
|
||||
|
||||
private const string POWERTOYNAME = "PowerLauncher";
|
||||
private PowerLauncherSettings settings;
|
||||
|
||||
public PowerLauncherViewModel()
|
||||
{
|
||||
if (SettingsUtils.SettingsExists(POWERTOY_NAME))
|
||||
if (SettingsUtils.SettingsExists(POWERTOYNAME))
|
||||
{
|
||||
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(POWERTOY_NAME);
|
||||
} else
|
||||
this.settings = SettingsUtils.GetSettings<PowerLauncherSettings>(POWERTOYNAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = new PowerLauncherSettings();
|
||||
this.settings = new PowerLauncherSettings();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSettings([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
OnPropertyChanged(propertyName);
|
||||
this.OnPropertyChanged(propertyName);
|
||||
|
||||
// Save settings to file
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
WriteIndented = true,
|
||||
};
|
||||
SettingsUtils.SaveSettings(JsonSerializer.Serialize(settings, options), POWERTOY_NAME);
|
||||
SettingsUtils.SaveSettings(JsonSerializer.Serialize(this.settings, options), POWERTOYNAME);
|
||||
|
||||
// Propagate changes to Power Launcher through IPC
|
||||
var propertiesJson = JsonSerializer.Serialize(settings.properties);
|
||||
ShellPage.Default_SndMSG_Callback(
|
||||
string.Format("{{ \"{0}\": {1} }}", POWERTOY_NAME, JsonSerializer.Serialize(settings.properties)));
|
||||
var propertiesJson = JsonSerializer.Serialize(this.settings.properties);
|
||||
ShellPage.DefaultSndMSGCallback(
|
||||
string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(this.settings.properties)));
|
||||
}
|
||||
|
||||
public bool EnablePowerLauncher
|
||||
{
|
||||
get { return settings.properties.enable_powerlauncher; }
|
||||
set
|
||||
get
|
||||
{
|
||||
if (settings.properties.enable_powerlauncher != value)
|
||||
return this.settings.properties.enable_powerlauncher;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.settings.properties.enable_powerlauncher != value)
|
||||
{
|
||||
settings.properties.enable_powerlauncher = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.enable_powerlauncher = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchResultPreference
|
||||
{
|
||||
get { return settings.properties.search_result_preference; }
|
||||
set
|
||||
get
|
||||
{
|
||||
if (settings.properties.search_result_preference != value)
|
||||
return this.settings.properties.search_result_preference;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.settings.properties.search_result_preference != value)
|
||||
{
|
||||
settings.properties.search_result_preference = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.search_result_preference = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchTypePreference
|
||||
{
|
||||
get { return settings.properties.search_type_preference; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.search_type_preference;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.search_type_preference != value)
|
||||
if (this.settings.properties.search_type_preference != value)
|
||||
{
|
||||
settings.properties.search_type_preference = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.search_type_preference = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MaximumNumberOfResults
|
||||
{
|
||||
get { return settings.properties.maximum_number_of_results; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.maximum_number_of_results;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.maximum_number_of_results != value)
|
||||
if (this.settings.properties.maximum_number_of_results != value)
|
||||
{
|
||||
settings.properties.maximum_number_of_results = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.maximum_number_of_results = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenPowerLauncher
|
||||
{
|
||||
get { return settings.properties.open_powerlauncher; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.open_powerlauncher;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.open_powerlauncher != value)
|
||||
if (this.settings.properties.open_powerlauncher != value)
|
||||
{
|
||||
settings.properties.open_powerlauncher = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
this.settings.properties.open_powerlauncher = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenFileLocation
|
||||
{
|
||||
get { return settings.properties.open_file_location; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.open_file_location;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.open_file_location != value)
|
||||
if (this.settings.properties.open_file_location != value)
|
||||
{
|
||||
settings.properties.open_file_location = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.open_file_location = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings CopyPathLocation
|
||||
{
|
||||
get { return settings.properties.copy_path_location; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.copy_path_location;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.copy_path_location != value)
|
||||
if (this.settings.properties.copy_path_location != value)
|
||||
{
|
||||
settings.properties.copy_path_location = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.copy_path_location = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenConsole
|
||||
{
|
||||
get { return settings.properties.open_console; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.open_console;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.open_console != value)
|
||||
if (this.settings.properties.open_console != value)
|
||||
{
|
||||
settings.properties.open_console = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.open_console = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool OverrideWinRKey
|
||||
{
|
||||
get { return settings.properties.override_win_r_key; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.override_win_r_key;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.override_win_r_key != value)
|
||||
if (this.settings.properties.override_win_r_key != value)
|
||||
{
|
||||
settings.properties.override_win_r_key = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.override_win_r_key = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool OverrideWinSKey
|
||||
{
|
||||
get { return settings.properties.override_win_s_key; }
|
||||
get
|
||||
{
|
||||
return this.settings.properties.override_win_s_key;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.properties.override_win_s_key != value)
|
||||
if (this.settings.properties.override_win_s_key != value)
|
||||
{
|
||||
settings.properties.override_win_s_key = value;
|
||||
UpdateSettings();
|
||||
this.settings.properties.override_win_s_key = value;
|
||||
this.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{x:Bind SearchResultPreferencesOptions}"
|
||||
ItemsSource="{x:Bind searchResultPreferencesOptions}"
|
||||
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchResultPreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
@@ -65,7 +65,7 @@
|
||||
<ComboBox x:Uid="PowerLauncher_SearchTypePreference"
|
||||
MinWidth="320"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ItemsSource="{x:Bind SearchTypePreferencesOptions}"
|
||||
ItemsSource="{x:Bind searchTypePreferencesOptions}"
|
||||
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchTypePreference}"
|
||||
SelectedValuePath="Item2"
|
||||
DisplayMemberPath="Item1"
|
||||
|
||||
@@ -1,63 +1,50 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Text;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Microsoft.PowerToys.Settings.UI.Controls;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class PowerLauncherPage : Page
|
||||
{
|
||||
public PowerLauncherViewModel ViewModel { get; } = new PowerLauncherViewModel();
|
||||
ObservableCollection<Tuple<string, string>> SearchResultPreferencesOptions;
|
||||
ObservableCollection<Tuple<string, string>> SearchTypePreferencesOptions;
|
||||
|
||||
private readonly ObservableCollection<Tuple<string, string>> searchResultPreferencesOptions;
|
||||
private readonly ObservableCollection<Tuple<string, string>> searchTypePreferencesOptions;
|
||||
|
||||
public PowerLauncherPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||
|
||||
SearchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
SearchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
||||
SearchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
|
||||
SearchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
|
||||
|
||||
SearchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
SearchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
||||
SearchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
|
||||
SearchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
|
||||
this.searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
||||
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
|
||||
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
|
||||
|
||||
this.searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
||||
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
|
||||
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
|
||||
}
|
||||
|
||||
public Tuple<string, string> SelectedSearchResultPreference
|
||||
{
|
||||
get
|
||||
{
|
||||
return SearchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference);
|
||||
return this.searchResultPreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchResultPreference);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ViewModel.SearchResultPreference != value.Item2)
|
||||
if (this.ViewModel.SearchResultPreference != value.Item2)
|
||||
{
|
||||
ViewModel.SearchResultPreference = value.Item2;
|
||||
this.ViewModel.SearchResultPreference = value.Item2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,13 +53,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
get
|
||||
{
|
||||
return SearchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference);
|
||||
return this.searchTypePreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchTypePreference);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ViewModel.SearchTypePreference != value.Item2)
|
||||
if (this.ViewModel.SearchTypePreference != value.Item2)
|
||||
{
|
||||
ViewModel.SearchTypePreference = value.Item2;
|
||||
this.ViewModel.SearchTypePreference = value.Item2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
Reference in New Issue
Block a user