UI improvements

This commit is contained in:
2022-02-15 20:13:54 +01:00
parent 45defb4021
commit 20d26340b0
6 changed files with 28 additions and 13 deletions

View File

@@ -22,7 +22,8 @@
<Color x:Key="MarkedSelectedItemBackgroundColor">#b58900</Color> <Color x:Key="MarkedSelectedItemBackgroundColor">#b58900</Color>
<Color x:Key="ForegroundColor">#93a1a1</Color> <Color x:Key="ForegroundColor">#93a1a1</Color>
<Color x:Key="AccentForegroundColor">#268bd2</Color> <Color x:Key="AccentColor">#268bd2</Color>
<Color x:Key="AccentComplementColor">#fdf6e3</Color>
<Color x:Key="LightForegroundColor">#7793a1a1</Color> <Color x:Key="LightForegroundColor">#7793a1a1</Color>
<Color x:Key="AlternativeItemForegroundColor">#93a1a1</Color> <Color x:Key="AlternativeItemForegroundColor">#93a1a1</Color>
<Color x:Key="SelectedItemForegroundColor">#073642</Color> <Color x:Key="SelectedItemForegroundColor">#073642</Color>
@@ -38,6 +39,13 @@
<GradientStop Offset="1" Color="#0093a1a1" /> <GradientStop Offset="1" Color="#0093a1a1" />
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="ContainerGradientBackgroundBrush">
<GradientStop Offset="0" Color="#00b58900" />
<GradientStop Offset="0.4" Color="#CCb58900" />
<GradientStop Offset="0.6" Color="#CCb58900" />
<GradientStop Offset="1" Color="#00b58900" />
</LinearGradientBrush>
<SolidColorBrush <SolidColorBrush
@@ -73,8 +81,11 @@
x:Key="ForegroundBrush" x:Key="ForegroundBrush"
Color="{DynamicResource ForegroundColor}" /> Color="{DynamicResource ForegroundColor}" />
<SolidColorBrush <SolidColorBrush
x:Key="AccentForegroundBrush" x:Key="AccentBrush"
Color="{DynamicResource AccentForegroundColor}" /> Color="{DynamicResource AccentColor}" />
<SolidColorBrush
x:Key="AccentComplementBrush"
Color="{DynamicResource AccentComplementColor}" />
<SolidColorBrush <SolidColorBrush
x:Key="LightForegroundBrush" x:Key="LightForegroundBrush"
Color="{DynamicResource LightForegroundColor}" /> Color="{DynamicResource LightForegroundColor}" />

View File

@@ -103,7 +103,7 @@ namespace FileTime.Avalonia.Configuration
{ {
var editorPrograms = new List<ProgramConfiguration>() var editorPrograms = new List<ProgramConfiguration>()
{ {
new ProgramConfiguration(@"c:\Program Files\Notepad++\notepad++1.exe"), new ProgramConfiguration(@"c:\Program Files\Notepad++\notepad++.exe"),
new ProgramConfiguration("notepad.exe"), new ProgramConfiguration("notepad.exe"),
}; };

View File

@@ -6,7 +6,6 @@ using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
using FileTime.Avalonia.Models; using FileTime.Avalonia.Models;
using FileTime.Avalonia.ViewModels; using FileTime.Avalonia.ViewModels;
using FileTime.Avalonia.Views;
namespace FileTime.Avalonia.Converters namespace FileTime.Avalonia.Converters
{ {
@@ -17,11 +16,11 @@ namespace FileTime.Avalonia.Converters
{ {
if (values.Count > 0 && values[0] is IList<ItemNamePart> nameParts) if (values.Count > 0 && values[0] is IList<ItemNamePart> nameParts)
{ {
var attributeWidth = values[2] is bool b && b ? 340 : 0;
var newNameParts = nameParts; var newNameParts = nameParts;
//if (values.Count > 1 && values[1] is ItemView itemView && itemView.ShowAttributes && itemView.Bounds.Width > 0)
if (values.Count > 1 && values[1] is double width && width > 0) if (values.Count > 1 && values[1] is double width && width > 0)
{ {
newNameParts = GetNamePartsForWidth(nameParts, width - 340); newNameParts = GetNamePartsForWidth(nameParts, width - attributeWidth);
} }
return newNameParts.Select(p => new ItemNamePartViewModel(p.Text, p.IsSpecial ? TextDecorations.Underline : null)).ToList(); return newNameParts.Select(p => new ItemNamePartViewModel(p.Text, p.IsSpecial ? TextDecorations.Underline : null)).ToList();

View File

@@ -783,6 +783,7 @@ namespace FileTime.Avalonia.Services
var getNext = false; var getNext = false;
while (true) while (true)
{ {
string? execPath = null;
try try
{ {
var editorProgram = _programsService.GetEditorProgram(getNext); var editorProgram = _programsService.GetEditorProgram(getNext);
@@ -792,6 +793,7 @@ namespace FileTime.Avalonia.Services
} }
else if (editorProgram.Path is string executablePath) else if (editorProgram.Path is string executablePath)
{ {
execPath = executablePath;
if (string.IsNullOrWhiteSpace(editorProgram.Arguments)) if (string.IsNullOrWhiteSpace(editorProgram.Arguments))
{ {
Process.Start(executablePath, "\"" + filePath + "\""); Process.Start(executablePath, "\"" + filePath + "\"");
@@ -808,7 +810,7 @@ namespace FileTime.Avalonia.Services
} }
catch (System.ComponentModel.Win32Exception e) catch (System.ComponentModel.Win32Exception e)
{ {
_logger.LogError(e, "Error while running editor program, possible the executable path does not exists."); _logger.LogError(e, "Error while running editor program, possible the executable path does not exists. {0}", execPath);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -9,7 +9,7 @@
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Background="{Binding ViewMode,Converter={StaticResource ItemViewModeToBackgroundConverter}}"> Background="{Binding ViewMode,Converter={StaticResource ItemViewModeToBackgroundConverter}}">
<Grid ColumnDefinitions="20,*,300" Margin="3" x:Name="RootGrid"> <Grid ColumnDefinitions="20,*,Auto" Margin="3" x:Name="RootGrid">
<Grid.Styles> <Grid.Styles>
<Style Selector="TextBlock"> <Style Selector="TextBlock">
<Setter Property="Foreground" Value="{Binding DataContext.ViewMode,Converter={StaticResource ItemViewModeToForegroundConverter},ElementName=ItemRoot}"/> <Setter Property="Foreground" Value="{Binding DataContext.ViewMode,Converter={StaticResource ItemViewModeToForegroundConverter},ElementName=ItemRoot}"/>
@@ -32,6 +32,7 @@
<MultiBinding.Bindings> <MultiBinding.Bindings>
<Binding Path="DisplayName"/> <Binding Path="DisplayName"/>
<Binding ElementName="RootGrid" Path="Bounds.Width"/> <Binding ElementName="RootGrid" Path="Bounds.Width"/>
<Binding ElementName="ItemRoot" Path="ShowAttributes"/>
</MultiBinding.Bindings> </MultiBinding.Bindings>
</MultiBinding> </MultiBinding>
</ItemsControl.Items> </ItemsControl.Items>

View File

@@ -36,7 +36,7 @@
<StackPanel Margin="20,10" Orientation="Horizontal"> <StackPanel Margin="20,10" Orientation="Horizontal">
<local:PathPresenter DataContext="{Binding AppState.SelectedTab.CurrentLocation.Container.FullName}"/> <local:PathPresenter DataContext="{Binding AppState.SelectedTab.CurrentLocation.Container.FullName}"/>
<TextBlock <TextBlock
Text="{Binding AppState.SelectedTab.SelectedItem.Item.Name}" Foreground="{StaticResource AccentForegroundBrush}" /> Text="{Binding AppState.SelectedTab.SelectedItem.Item.Name}" Foreground="{StaticResource AccentBrush}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -296,7 +296,7 @@
</ListBox> </ListBox>
<Grid <Grid
x:CompileBindings="False" x:CompileBindings="False"
IsVisible="{Binding AppState.SelectedTab.ChildContainer.Items^.Count, Converter={StaticResource EqualityConverter}, ConverterParameter=0}"> IsVisible="{Binding AppState.SelectedTab.ChildContainer.Items^.Count, Converter={StaticResource EqualityConverter}, ConverterParameter=0}">
<TextBlock <TextBlock
@@ -343,7 +343,7 @@
</Grid> </Grid>
</Grid> </Grid>
<ItemsRepeater Items="{Binding AppState.PopupTexts}" Margin="0,0,0,20" HorizontalAlignment="Center" VerticalAlignment="Bottom" IsVisible="{Binding AppState.PopupTexts.Count,Converter={StaticResource NotEqualsConverter}, ConverterParameter=0}"> <ItemsRepeater Items="{Binding AppState.PopupTexts}" Margin="0,0,0,20" HorizontalAlignment="Center" VerticalAlignment="Top" IsVisible="{Binding AppState.PopupTexts.Count,Converter={StaticResource NotEqualsConverter}, ConverterParameter=0}">
<ItemsRepeater.Styles> <ItemsRepeater.Styles>
<Style Selector="TextBlock"> <Style Selector="TextBlock">
<Style.Animations> <Style.Animations>
@@ -360,7 +360,9 @@
</ItemsRepeater.Styles> </ItemsRepeater.Styles>
<ItemsRepeater.ItemTemplate> <ItemsRepeater.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding}" HorizontalAlignment="Center"/> <Border Background="{DynamicResource ContainerGradientBackgroundBrush}" Margin="5" Padding="5">
<TextBlock Text="{Binding}" Foreground="{DynamicResource AccentComplementBrush}" HorizontalAlignment="Center"/>
</Border>
</DataTemplate> </DataTemplate>
</ItemsRepeater.ItemTemplate> </ItemsRepeater.ItemTemplate>
</ItemsRepeater> </ItemsRepeater>