Skip to content

Commit

Permalink
Batch resize - Thumbnails processing #165
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Dec 7, 2024
1 parent 6aec6d9 commit 69616c1
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 88 deletions.
54 changes: 27 additions & 27 deletions src/PicView.Avalonia/Converters/IndexToStringSizeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,65 @@ public object Convert(object? value, Type targetType, object? parameter, Culture
return TranslationHelper.Translation.Thumbnail ?? "Thumb";

case 2 when parameterIndex is 1:
return "/medium";
return "medium";
case 2:
return "/small";
return "small";

case 3 when parameterIndex is 1:
return "/large";
return "large";
case 3 when parameterIndex is 2:
return "/medium";
return "medium";
case 3:
return "/small";
return "small";

case 4 when parameterIndex is 1:
return "/large";
return "large";
case 4 when parameterIndex is 2:
return "/medium";
return "medium";
case 4 when parameterIndex is 3:
return "/small";
return "small";
case 4:
return "/xs";
return "xs";

case 5 when parameterIndex is 1:
return "/xl";
return "xl";
case 5 when parameterIndex is 2:
return "/large";
return "large";
case 5 when parameterIndex is 3:
return "/medium";
return "medium";
case 5when parameterIndex is 4:
return "/small";
return "small";
case 5:
return "/xs";
return "xs";


case 6 when parameterIndex is 1:
return "/xl";
return "xl";
case 6 when parameterIndex is 2:
return "/large";
return "large";
case 6 when parameterIndex is 3:
return "/medium";
return "medium";
case 6 when parameterIndex is 4:
return "/small";
return "small";
case 6 when parameterIndex is 5:
return "/xs";
return "xs";
case 6:
return "/xxs";
return "xxs";

case 7 when parameterIndex is 1:
return "/xxl";
return "xxl";
case 7 when parameterIndex is 2:
return "/xl";
return "xl";
case 7 when parameterIndex is 3:
return "/large";
return "large";
case 7 when parameterIndex is 4:
return "/medium";
return "medium";
case 7 when parameterIndex is 5:
return "/small";
return "small";
case 7 when parameterIndex is 6:
return "/xs";
return "xs";
case 7:
return "/xxs";
return "xxs";
default:
return BindingOperations.DoNothing;
}
Expand Down
84 changes: 56 additions & 28 deletions src/PicView.Avalonia/Views/BatchResizeView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=1, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb1OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -465,8 +466,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb1TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -478,9 +478,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb1PercentageItem"
Width="195"
x:Name="Thumb1ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb1PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb1PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb1WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb1HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -518,7 +522,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=2, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb2OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -530,8 +535,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb2TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -543,9 +547,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb2PercentageItem"
Width="195"
x:Name="Thumb2ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb2PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb2PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb2WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb2HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -583,7 +591,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=3, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb3OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -595,8 +604,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb3TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -608,9 +616,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb3PercentageItem"
Width="195"
x:Name="Thumb3ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb3PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb3PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb3WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb3HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -648,7 +660,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=4, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb4OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -660,8 +673,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb4TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -673,9 +685,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb4PercentageItem"
Width="195"
x:Name="Thumb4ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb4PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb4PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb4WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb4HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -712,7 +728,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=5, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb5OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -724,8 +741,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb5TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -737,9 +753,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb5PercentageItem"
Width="195"
x:Name="Thumb5ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb5PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb5PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb5WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb5HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -776,7 +796,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=6, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb6OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -788,8 +809,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb6TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -801,9 +821,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb6PercentageItem"
Width="195"
x:Name="Thumb6ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb6PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb6PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb61WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb6HeightItem" />
</ComboBox>
Expand Down Expand Up @@ -841,7 +865,8 @@
Classes="hover TStyle"
Margin="4,0,10,0"
Text="{Binding SelectedIndex, ElementName=ThumbnailsComboBox, ConverterParameter=7, Converter={StaticResource IndexToStringSizeConverter}}"
Width="410" />
Width="410"
x:Name="Thumb7OutputBox" />
</StackPanel>

<StackPanel
Expand All @@ -853,8 +878,7 @@
Classes="txt"
Margin="8,0,0,0"
Text="{CompiledBinding Resize}"
Width="125"
x:Name="PercentageThumb7TextBlock" />
Width="125" />

<ComboBox
Background="{DynamicResource SecondaryBackgroundColor}"
Expand All @@ -866,9 +890,13 @@
Margin="6,0,10,0"
Padding="5,7,0,7"
SelectedIndex="0"
SelectedItem="Thumb7PercentageItem"
Width="195"
x:Name="Thumb7ComboBox">
<ComboBoxItem Content="{CompiledBinding Percentage}" x:Name="Thumb7PercentageItem" />
<ComboBoxItem
Content="{CompiledBinding Percentage}"
IsSelected="True"
x:Name="Thumb7PercentageItem" />
<ComboBoxItem Content="{CompiledBinding Width}" x:Name="Thumb7WidthItem" />
<ComboBoxItem Content="{CompiledBinding Height}" x:Name="Thumb7HeightItem" />
</ComboBox>
Expand Down
Loading

0 comments on commit 69616c1

Please sign in to comment.