1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Clean up layout view

This commit is contained in:
Diogo Trindade 2023-06-16 22:52:42 +01:00
parent 49d229cd2b
commit 480e0b9b12
4 changed files with 55 additions and 38 deletions

View File

@ -70,6 +70,6 @@
</Border> </Border>
<StackPanel Grid.Column="0" Grid.ColumnSpan="3" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right" /> <StackPanel Grid.Column="0" Grid.ColumnSpan="3" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Top" HorizontalAlignment="Right" />
</Grid> </Grid>
</windowing:AppWindow> </windowing:AppWindow>

View File

@ -12,71 +12,78 @@
<Border Classes="card" Margin="5"> <Border Classes="card" Margin="5">
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<StackPanel Grid.Row="0"> <StackPanel Grid.Row="0">
<TextBlock <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
TextWrapping="Wrap" <StackPanel Grid.Row="0" Grid.Column="0">
Text="The device layout is used to determine the position of LEDs and to create the visual representation of the device." />
<Grid ColumnDefinitions="*,Auto" RowDefinitions="*,*,*,*,*" Margin="0, 20,0,0">
<StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,10" >
<TextBlock Text="Default layout file path" /> <TextBlock Text="Default layout file path" />
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding DefaultLayoutPath}" /> <TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding DefaultLayoutPath}" />
</StackPanel> </StackPanel>
<Button <StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
Grid.Column="1" <Button
Grid.Row="0" Classes="icon-button"
Classes="icon-button" HorizontalAlignment="Right"
HorizontalAlignment="Right" ToolTip.Tip="Copy layout file path to clipboard"
ToolTip.Tip="Copy layout file path to clipboard" Click="LayoutPathButton_OnClick">
Click="LayoutPathButton_OnClick"> <avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" /> </Button>
</Button> </StackPanel>
</Grid>
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,0,10"> <Border Classes="card-separator" />
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
<StackPanel Grid.Row="1" Grid.Column="0">
<TextBlock Text="Image file path" /> <TextBlock Text="Image file path" />
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding Device.Layout.Image.LocalPath}" /> <TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding Device.Layout.Image.LocalPath}" />
</StackPanel> </StackPanel>
<Button <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
Grid.Column="1" <Button
Grid.Row="1" Classes="icon-button"
Classes="icon-button" HorizontalAlignment="Right"
HorizontalAlignment="Right" ToolTip.Tip="Copy image file path to clipboard"
ToolTip.Tip="Copy image file path to clipboard" Click="ImagePathButton_OnClick">
Click="ImagePathButton_OnClick"> <avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" /> </Button>
</Button> </StackPanel>
</Grid>
<StackPanel Grid.Column="0" Grid.Row="2" Margin="0,0,0,10"> <Border Classes="card-separator" />
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
<StackPanel Grid.Row="1" Grid.Column="0">
<TextBlock Text="Disable default layout" /> <TextBlock Text="Disable default layout" />
<TextBlock Classes="subtitle" FontSize="12" Text="With this checked, Artemis will not load a layout for this device unless you specifically provide one." /> <TextBlock Classes="subtitle" FontSize="12" Text="With this checked, Artemis will not load a layout for this device unless you specifically provide one." />
</StackPanel> </StackPanel>
<CheckBox Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,-10,0" /> <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
<CheckBox HorizontalAlignment="Right" Margin="0,0,-10,0" />
<StackPanel Grid.Column="0" Grid.Row="3" Margin="0,0,0,10"> </StackPanel>
</Grid>
<Border Classes="card-separator" />
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
<StackPanel Grid.Row="1" Grid.Column="0">
<TextBlock Text="Custom layout path" /> <TextBlock Text="Custom layout path" />
<TextBlock Classes="subtitle" FontSize="12" Text="{CompiledBinding CustomLayoutPath}" /> <TextBlock Classes="subtitle" FontSize="12" Text="{CompiledBinding CustomLayoutPath}" />
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
<Button Content="Clear" Command="{CompiledBinding ClearCustomLayout}" IsEnabled="{CompiledBinding HasCustomLayout}" /> <Button Content="Clear" Command="{CompiledBinding ClearCustomLayout}" IsEnabled="{CompiledBinding HasCustomLayout}" />
<!-- 5 pixels of margin between the buttons --> <!-- 5 pixels of margin between the buttons -->
<Button Margin="5,0,0,0" Content="Browse" Command="{CompiledBinding BrowseCustomLayout}" /> <Button Margin="5,0,0,0" Content="Browse" Command="{CompiledBinding BrowseCustomLayout}" />
</StackPanel> </StackPanel>
</Grid>
<StackPanel Grid.Column="0" Grid.Row="4" Margin="0,0,0,10"> <Border Classes="card-separator" />
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
<StackPanel Grid.Row="1" Grid.Column="0">
<TextBlock Text="Export current layout" /> <TextBlock Text="Export current layout" />
<TextBlock Classes="subtitle" FontSize="12" Text="If there is a layout used, export that. Otherwise, export the LEDs present." /> <TextBlock Classes="subtitle" FontSize="12" Text="If there is a layout used, export that. Otherwise, export the LEDs present." />
</StackPanel> </StackPanel>
<Button Grid.Column="1" Grid.Row="4" Margin="0,0,0,0" HorizontalAlignment="Right" Content="Export" Command="{CompiledBinding ExportLayout}" /> <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
<Button HorizontalAlignment="Right" Content="Export" Command="{CompiledBinding ExportLayout}" />
</StackPanel>
</Grid> </Grid>
</StackPanel> </StackPanel>
<controls:HyperlinkButton <controls:HyperlinkButton
Grid.Row="1"
Content="Learn more about layouts on the wiki" Content="Learn more about layouts on the wiki"
NavigateUri="https://wiki.artemis-rgb.com/en/guides/developer/layouts" NavigateUri="https://wiki.artemis-rgb.com/en/guides/developer/layouts"
Grid.Row="1"
Margin="0 20" Margin="0 20"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Bottom" /> VerticalAlignment="Bottom" />
</Grid> </Grid>
</Border> </Border>
</ScrollViewer> </ScrollViewer>
</UserControl> </UserControl>

View File

@ -17,10 +17,12 @@ public partial class DeviceLayoutTabView : ReactiveUserControl<DeviceLayoutTabVi
private void LayoutPathButton_OnClick(object? sender, RoutedEventArgs e) private void LayoutPathButton_OnClick(object? sender, RoutedEventArgs e)
{ {
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.DefaultLayoutPath); TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.DefaultLayoutPath);
ViewModel.ShowCopiedNotification();
} }
private void ImagePathButton_OnClick(object? sender, RoutedEventArgs e) private void ImagePathButton_OnClick(object? sender, RoutedEventArgs e)
{ {
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.Device.Layout.Image.LocalPath); TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.Device.Layout.Image.LocalPath);
ViewModel.ShowCopiedNotification();
} }
} }

View File

@ -140,4 +140,12 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
.WithSeverity(NotificationSeverity.Success) .WithSeverity(NotificationSeverity.Success)
.Show(); .Show();
} }
public void ShowCopiedNotification()
{
_notificationService.CreateNotification()
.WithTitle("Copied!")
.WithSeverity(NotificationSeverity.Informational)
.Show();
}
} }