mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-08-21 04:31:20 +08:00
settings_re11
This commit is contained in:
@@ -31,13 +31,224 @@
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="{Binding ThemeColorLabel}">
|
||||
<ui:SettingsExpander Header="{Binding ThemeColorModeLabel}"
|
||||
Description="{Binding ThemeColorSourceDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="PaintBrush" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="240"
|
||||
ItemsSource="{Binding ThemeColorModes}"
|
||||
SelectedItem="{Binding SelectedThemeColorMode}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="{Binding SystemMaterialLabel}"
|
||||
Description="{Binding SystemMaterialDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="WindowDevTools" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="220"
|
||||
ItemsSource="{Binding SystemMaterialModes}"
|
||||
SelectedItem="{Binding SelectedSystemMaterialMode}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="{Binding ThemeColorLabel}"
|
||||
Description="{Binding ThemeColorSourceDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Color" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ColorPicker Color="{Binding ThemeColorPickerValue}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
<ui:SettingsExpanderItem>
|
||||
<StackPanel Spacing="12">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="12"
|
||||
IsVisible="{Binding ShowNeutralPreview}">
|
||||
<StackPanel Width="96"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding NeutralLightPreviewBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewNeutralLightLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
<StackPanel Width="96"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding NeutralDarkPreviewBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewNeutralDarkLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="12"
|
||||
IsVisible="{Binding ShowMonetPreview}">
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding PrimarySwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewPrimaryLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding SecondarySwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewSecondaryLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding TertiarySwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewTertiaryLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding NeutralSwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewNeutralLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<Button x:Name="CustomSeedButton"
|
||||
Width="92"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Left"
|
||||
IsVisible="{Binding IsThemeColorEditable}">
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="BottomEdgeAlignedLeft"
|
||||
Closed="OnCustomSeedFlyoutClosed">
|
||||
<StackPanel Width="300"
|
||||
Spacing="12">
|
||||
<ColorPicker Color="{Binding CustomSeedPickerValue}" />
|
||||
<Button Content="{Binding SeedApplyButtonText}"
|
||||
HorizontalAlignment="Right"
|
||||
Click="OnApplyCustomSeedClick" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding SeedSwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewSeedLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="WallpaperSeedButton"
|
||||
Width="92"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Left"
|
||||
IsVisible="{Binding IsWallpaperMode}"
|
||||
IsEnabled="{Binding IsWallpaperSeedSelectable}">
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="BottomEdgeAlignedLeft">
|
||||
<StackPanel Width="280"
|
||||
Spacing="12">
|
||||
<TextBlock Text="{Binding WallpaperSeedFlyoutTitle}"
|
||||
FontWeight="SemiBold" />
|
||||
<ItemsControl ItemsSource="{Binding WallpaperSeedCandidates}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:ThemeSeedCandidateOption">
|
||||
<Button Padding="0"
|
||||
Margin="0,0,8,8"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="OnWallpaperSeedCandidateClick">
|
||||
<StackPanel Width="76"
|
||||
Spacing="6">
|
||||
<Border Height="44"
|
||||
Background="{Binding Brush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12" />
|
||||
<TextBlock Text="{Binding Label}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Text="{Binding $parent[vm:AppearanceSettingsPageViewModel].WallpaperSeedCurrentText}"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="10"
|
||||
IsVisible="{Binding IsSelected}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
<StackPanel Width="92"
|
||||
Spacing="6">
|
||||
<Border Height="54"
|
||||
Background="{Binding SeedSwatchBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveGlassPanelBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="14" />
|
||||
<TextBlock Text="{Binding PreviewSeedLabel}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using System;
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
@@ -15,16 +19,51 @@ namespace LanMountainDesktop.Views.SettingsPages;
|
||||
public partial class AppearanceSettingsPage : SettingsPageBase
|
||||
{
|
||||
public AppearanceSettingsPage()
|
||||
: this(new AppearanceSettingsPageViewModel(HostSettingsFacadeProvider.GetOrCreate()))
|
||||
: this(new AppearanceSettingsPageViewModel(
|
||||
HostSettingsFacadeProvider.GetOrCreate(),
|
||||
HostAppearanceThemeProvider.GetOrCreate()))
|
||||
{
|
||||
}
|
||||
|
||||
public AppearanceSettingsPage(AppearanceSettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
ViewModel.RestartRequested += OnRestartRequested;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public AppearanceSettingsPageViewModel ViewModel { get; }
|
||||
|
||||
private void OnRestartRequested(string reason)
|
||||
{
|
||||
RequestRestart(reason);
|
||||
}
|
||||
|
||||
private void OnApplyCustomSeedClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = sender;
|
||||
_ = e;
|
||||
ViewModel.ApplyCustomSeedCommand.Execute(null);
|
||||
CustomSeedButton?.Flyout?.Hide();
|
||||
}
|
||||
|
||||
private void OnCustomSeedFlyoutClosed(object? sender, EventArgs e)
|
||||
{
|
||||
_ = sender;
|
||||
_ = e;
|
||||
ViewModel.CancelCustomSeedPreview();
|
||||
}
|
||||
|
||||
private void OnWallpaperSeedCandidateClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = e;
|
||||
|
||||
if (sender is Button { DataContext: ThemeSeedCandidateOption option })
|
||||
{
|
||||
ViewModel.SelectWallpaperSeed(option.Value);
|
||||
}
|
||||
|
||||
WallpaperSeedButton?.Flyout?.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LanMountainDesktop.ViewModels"
|
||||
xmlns:controls="using:LanMountainDesktop.Controls"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:fi="using:FluentIcons.Avalonia.Fluent"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.PrivacySettingsPage"
|
||||
x:DataType="vm:PrivacySettingsPageViewModel">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="settings-page-container">
|
||||
<controls:IconText Icon="Info"
|
||||
Text="{Binding PrivacyHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
|
||||
<ui:SettingsExpander Header="{Binding CrashUploadHeader}"
|
||||
Description="{Binding CrashUploadDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="ShieldDismiss" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ToggleSwitch IsChecked="{Binding UploadAnonymousCrashData}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="{Binding UsageUploadHeader}"
|
||||
Description="{Binding UsageUploadDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Info" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ToggleSwitch IsChecked="{Binding UploadAnonymousUsageData}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,30 @@
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
[SettingsPageInfo(
|
||||
"privacy",
|
||||
"Privacy",
|
||||
SettingsPageCategory.About,
|
||||
IconKey = "Shield",
|
||||
SortOrder = 34,
|
||||
TitleLocalizationKey = "settings.privacy.title",
|
||||
DescriptionLocalizationKey = "settings.privacy.description")]
|
||||
public partial class PrivacySettingsPage : SettingsPageBase
|
||||
{
|
||||
public PrivacySettingsPage()
|
||||
: this(new PrivacySettingsPageViewModel(HostSettingsFacadeProvider.GetOrCreate()))
|
||||
{
|
||||
}
|
||||
|
||||
public PrivacySettingsPage(PrivacySettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public PrivacySettingsPageViewModel ViewModel { get; }
|
||||
}
|
||||
@@ -7,9 +7,9 @@ namespace LanMountainDesktop.Views.SettingsPages;
|
||||
[SettingsPageInfo(
|
||||
"status-bar",
|
||||
"Status Bar",
|
||||
SettingsPageCategory.Appearance,
|
||||
SettingsPageCategory.Components,
|
||||
IconKey = "Apps",
|
||||
SortOrder = 17,
|
||||
SortOrder = 15,
|
||||
TitleLocalizationKey = "settings.status_bar.title",
|
||||
DescriptionLocalizationKey = "settings.status_bar.description")]
|
||||
public partial class StatusBarSettingsPage : SettingsPageBase
|
||||
|
||||
Reference in New Issue
Block a user