Skip to content

Commit

Permalink
UI cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarr committed Feb 8, 2025
1 parent 8e62c6e commit 1a63445
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 92 deletions.
2 changes: 1 addition & 1 deletion OpenIPC_Config/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private static void RegisterViewModels(IServiceCollection services)
services.AddTransient<MainViewModel>();

// Register tab ViewModels as singletons
services.AddSingleton<GlobalViewModel>();
services.AddSingleton<GlobalSettingsViewModel>();

services.AddSingleton<CameraSettingsTabViewModel>();
services.AddSingleton<ConnectControlsViewModel>();
Expand Down
29 changes: 17 additions & 12 deletions OpenIPC_Config/Styles/Styles.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Design.PreviewWith>
<Border Padding="20">
<Border Padding="10">
<!-- Add Controls for Previewer Here -->
</Border>
</Design.PreviewWith>
Expand Down Expand Up @@ -140,17 +140,7 @@
<Setter Property="Foreground" Value="White" />
</Style>


<!-- <Style Selector="TabItem:pointerover /template/ Border#PART_LayoutRoot"> -->
<!-- <Setter Property="Background" Value="LightGray" /> -->
<!-- </Style> -->
<!-- -->
<!-- <Style Selector="TabItem:pressed /template/ Border#PART_LayoutRoot"> -->
<!-- <Setter Property="Background" Value="#4C61D8" /> -->
<!-- </Style> -->
<!-- <Style Selector="TabItem:pressed /template/ ContentPresenter#PART_ContentPresenter"> -->
<!-- <Setter Property="Foreground" Value="White" /> -->
<!-- </Style> -->


<!-- -->
<Style Selector="TabItem:selected">
Expand Down Expand Up @@ -201,4 +191,19 @@
<Setter Property="BoxShadow" Value="5 5 10 0 DarkGray" />

</Style>

<Style Selector="Button.DrawerButton">
<Setter Property="CornerRadius" Value="10" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0,0" />
<Setter Property="Background" Value="Transparent"></Setter>
</Style>

<Style Selector="StackPanel:pointerover.DrawerStackPanel">
<Setter Property="Background" Value="White"></Setter>
</Style>

<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent" /> <!-- General hover style -->
</Style>
</Styles>
2 changes: 1 addition & 1 deletion OpenIPC_Config/ViewModels/ConnectControlsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial class ConnectControlsViewModel : ViewModelBase
public ConnectControlsViewModel(ILogger logger,
ISshClientService sshClientService,
IEventSubscriptionService eventSubscriptionService,
GlobalViewModel globalSettingsViewModel)
GlobalSettingsViewModel globalSettingsSettingsViewModel)
: base(logger, sshClientService, eventSubscriptionService)
{
SetDefaults();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace OpenIPC_Config.ViewModels;

public partial class GlobalViewModel : ViewModelBase
public partial class GlobalSettingsViewModel : ViewModelBase
{
[ObservableProperty]
private bool _isWfbYamlEnabled = false;


public GlobalViewModel(ILogger logger,
public GlobalSettingsViewModel(ILogger logger,
ISshClientService sshClientService,
IEventSubscriptionService eventSubscriptionService)
: base(logger, sshClientService, eventSubscriptionService)
Expand Down
12 changes: 6 additions & 6 deletions OpenIPC_Config/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ public partial class MainViewModel : ViewModelBase
private DeviceType _selectedDeviceType;

private readonly IServiceProvider _serviceProvider;
private readonly GlobalViewModel _globalSettingsViewModel;
private readonly GlobalSettingsViewModel _globalSettingsSettingsViewModel;


public MainViewModel(ILogger logger,
ISshClientService sshClientService,
IEventSubscriptionService eventSubscriptionService,
IServiceProvider serviceProvider,
GlobalViewModel globalSettingsViewModel)
GlobalSettingsViewModel globalSettingsSettingsViewModel)
: base(logger, sshClientService, eventSubscriptionService)
{
IsMobile = false;
_serviceProvider = serviceProvider;
_appVersionText = GetFormattedAppVersion();
CanConnect = false;

_globalSettingsViewModel = globalSettingsViewModel;
_globalSettingsSettingsViewModel = globalSettingsSettingsViewModel;

Tabs = new ObservableCollection<TabItemViewModel> { };
// Subscribe to device type change events
Expand Down Expand Up @@ -326,11 +326,11 @@ await SshClientService.ExecuteCommandWithResponseAsync(deviceConfig, DeviceComma
private async void processCameraFiles()
{
// read device to determine configurations
_globalSettingsViewModel.ReadDevice();
_globalSettingsSettingsViewModel.ReadDevice();


Logger.Debug($"IsWfbYamlEnabled = {_globalSettingsViewModel.IsWfbYamlEnabled}");
if (_globalSettingsViewModel.IsWfbYamlEnabled)
Logger.Debug($"IsWfbYamlEnabled = {_globalSettingsSettingsViewModel.IsWfbYamlEnabled}");
if (_globalSettingsSettingsViewModel.IsWfbYamlEnabled)
{
Logger.Debug($"Reading wfb.yaml");
}
Expand Down
144 changes: 77 additions & 67 deletions OpenIPC_Config/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,79 +17,89 @@
<converters:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
</UserControl.Resources>

<!-- Main Layout -->
<Grid>
<!-- Define Rows -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <!-- Header -->
<RowDefinition Height="*" /> <!-- Tab Content -->
<RowDefinition Height="Auto" /> <!-- Log Viewer -->
</Grid.RowDefinitions>


<DockPanel Background="Gray" >
<!-- Header -->
<!-- <Border BorderThickness="1" BorderBrush="Red" Height="83"> -->
<views:HeaderView DockPanel.Dock="Top" Height="83" />
<!-- </Border> -->
<views:HeaderView Grid.Row="0" Height="83" />

<!-- Tab Content -->
<Grid Grid.Row="1"
ColumnDefinitions="Auto,Auto,*" Margin="0" ShowGridLines="False">
<!-- Collapsible TabControl -->
<TabControl x:Name="MainTabControl"
Grid.Column="0"
ItemsSource="{Binding Tabs}"
SelectedIndex="{Binding SelectedTabIndex}"
SelectedItem="{Binding SelectedTab}"
Width="{Binding IsTabsCollapsed,
Converter={StaticResource BooleanToWidthConverter},
ConverterParameter='80,180'}"
Padding="0,0,10,0">

<TabControl.ItemTemplate>
<DataTemplate>
<Grid Height="40" VerticalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>


<!-- </TabControl> -->
<TabControl x:Name="MainTabControl"
DockPanel.Dock="Left"
ItemsSource="{Binding Tabs}"
SelectedIndex="{Binding SelectedTabIndex}"
SelectedItem="{Binding SelectedTab}"
Width="{Binding IsTabsCollapsed,
Converter={StaticResource BooleanToWidthConverter},
ConverterParameter='80,180'}">

<TabControl.ItemTemplate>
<DataTemplate>
<Grid Height="40" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Icon -->
<Svg Grid.Column="0" Path="{Binding Icon}" Margin="0" />

<!-- Icon aligned to the far left -->
<Svg Grid.Column="0" Path="{Binding Icon}" />
<!-- Tab Name -->
<TextBlock Text="{Binding TabName}" Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="18" Margin="10,0,10,0"
IsVisible="{Binding IsTabsCollapsed,
Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>

<TextBlock Text="{Binding TabName}" Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="18" Margin="10,0,10,0"
IsVisible="{Binding IsTabsCollapsed,
Converter={StaticResource BooleanToVisibilityConverter}}"
/>
</Grid>
</DataTemplate>
</TabControl.ItemTemplate>
<!-- Toggle Tabs Button -->
<Button Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center"
VerticalAlignment="Top"
Classes="DrawerButton"
Command="{Binding ToggleTabsCommand}"
BorderThickness="0"
Background="Transparent">

</TabControl>
<StackPanel Orientation="Horizontal"
Background="Transparent"
Classes="DrawerStackPanel" Spacing="0">
<!-- <TextBlock Text="{Binding IsTabsCollapsed, -->
<!-- Converter={StaticResource InvertedBooleanConverter}, -->
<!-- ConverterParameter='Show Tabs, Hide Tabs'}" /> -->
<Svg Path="/Assets/Icons/drawer-handle.svg"
Margin="0,0,0,0" />
<Svg Path="{Binding SvgPath}"
Width="10"
Margin="0,0,0,0"
HorizontalAlignment="Left"
/>
</StackPanel>
</Button>

<!-- Tab Content -->
<ContentControl Grid.Column="2"
Content="{Binding SelectedTab.Content}"
Padding="0"
Margin="0"/>
</Grid>

<Panel Background="Transparent" Margin="0" DockPanel.Dock="Left">
<StackPanel Orientation="Horizontal">
<Button Background="Transparent" BorderThickness="0"
Padding="0"
Command="{Binding ToggleTabsCommand}">

<Svg VerticalAlignment="Center" Path="/Assets/Icons/drawer-handle.svg" />

</Button>

<Button Width="10" Background="Transparent" BorderThickness="0" Margin="0" Padding="0"
Command="{Binding ToggleTabsCommand}">
<Svg Width="10" VerticalAlignment="Stretch" Path="{Binding SvgPath}" />
</Button>
</StackPanel>
</Panel>

<!-- Main Content -->
<StackPanel DockPanel.Dock="Top" Orientation="Vertical">
<ContentControl Content="{Binding SelectedTab.Content}"
Margin="0"
Padding="0" Background="Transparent" />

<!-- <views:LogViewer VerticalAlignment="Bottom" /> -->
</StackPanel>
<Panel DockPanel.Dock="Bottom" Margin="5,0,0,5">
<views:LogViewer VerticalAlignment="Bottom" />
</Panel>


</DockPanel>
<!-- </ScrollViewer> -->
<!-- </Border> -->
</UserControl>
<!-- Log Viewer -->
<views:LogViewer Grid.Row="2" Margin="3,3,3,3" />
</Grid>
</UserControl>
8 changes: 5 additions & 3 deletions OpenIPC_Config/Views/PresetsTabView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
x:DataType="vm:PresetsTabViewModel">


<Grid RowDefinitions="Auto, Auto, Auto, *" ColumnDefinitions="*" Margin="10">
<Grid RowDefinitions="Auto, Auto, Auto, *"
ColumnDefinitions="*" Margin="10">
<!-- Header with Information -->
<Border Background="#B0B0B0" CornerRadius="10" Padding="10" Margin="10">
<Grid>
Expand Down Expand Up @@ -93,9 +94,9 @@
SelectedItem="{Binding SelectedStatus}"
PlaceholderText="Select Status" />
</StackPanel>

<!-- Presets List -->
<ScrollViewer Grid.Row="3">
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel Spacing="10">
<ItemsControl ItemsSource="{Binding Presets}">
<ItemsControl.ItemTemplate>
Expand All @@ -118,6 +119,7 @@
</ItemsControl>
</StackPanel>
</ScrollViewer>

</Grid>
</UserControl>

Expand Down

0 comments on commit 1a63445

Please sign in to comment.