-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ImageResizer page + sidepanel improvements
- Loading branch information
Showing
16 changed files
with
349 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
|
||
using Microsoft.PowerToys.Settings.UI.Helpers; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.ViewModels | ||
{ | ||
public class ImageResizerViewModel : Observable | ||
{ | ||
public ImageResizerViewModel() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
195 changes: 195 additions & 0 deletions
195
src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
<Page | ||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ImageResizerPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid ColumnSpacing="{StaticResource DefaultColumnSpacing}" RowSpacing="{StaticResource DefaultRowSpacing}"> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="LayoutVisualStates"> | ||
<VisualState x:Name="WideLayout"> | ||
<VisualState.StateTriggers> | ||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Target="SidePanel.(Grid.Column)" Value="1" /> | ||
<Setter Target="SidePanel.(Grid.Row)" Value="0" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState x:Name="SmallLayout"> | ||
<VisualState.StateTriggers> | ||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Target="SidePanel.(Grid.Column)" Value="0" /> | ||
<Setter Target="SidePanel.(Grid.Row)" Value="1" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<StackPanel Orientation="Vertical"> | ||
<TextBlock Text="Lets you resize images by right-clicking." | ||
TextWrapping="Wrap"/> | ||
|
||
<ToggleSwitch Header="Enable Image Resizer" | ||
IsOn="True" | ||
Margin="{StaticResource SmallTopMargin}" /> | ||
|
||
<TextBlock Text="Sizes" | ||
Style="{StaticResource SettingsGroupTitleStyle}"/> | ||
|
||
<!-- TO DO: Don't know if a listview with these items is the best solution here. Maybe a data grid is better? --> | ||
<!--<ListView Margin="{StaticResource SmallTopMargin}" Padding="-12,0,0,0" SelectionMode="None" ItemsSource="{x:Bind Sizes, Mode=OneWay}"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate x:DataType="local:ResizeSize"> | ||
<StackPanel Orientation="Horizontal" Spacing="4"> | ||
<TextBox Text="{x:Bind Title}" Width="68"/> | ||
<ComboBox SelectedIndex="1" Width="88"> | ||
<ComboBoxItem>Fill</ComboBoxItem> | ||
<ComboBoxItem>Fit</ComboBoxItem> | ||
<ComboBoxItem>Stretch</ComboBoxItem> | ||
</ComboBox> | ||
<muxc:NumberBox Value="{x:Bind Width}"/> | ||
<TextBlock Text="x" FontWeight="SemiBold" Margin="0,4,0,0"/> | ||
<muxc:NumberBox Value="{x:Bind Height}"/> | ||
<ComboBox SelectedIndex="3"> | ||
<ComboBoxItem>Centimeters</ComboBoxItem> | ||
<ComboBoxItem>Inches</ComboBoxItem> | ||
<ComboBoxItem>Percent</ComboBoxItem> | ||
<ComboBoxItem>Pixels</ComboBoxItem> | ||
</ComboBox> | ||
<Button x:Name="RemoveButton" Background="Transparent" Click="RemoveButton_Click"> | ||
<Button.Content> | ||
<FontIcon Opacity="0.8" Glyph=""/> | ||
</Button.Content> | ||
</Button> | ||
</StackPanel> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView>--> | ||
|
||
<Button x:Name="AddSizeButton" Content="Add new size" Margin="{StaticResource SmallTopMargin}"/> | ||
|
||
<TextBlock Text="Encoding" | ||
Style="{StaticResource SettingsGroupTitleStyle}"/> | ||
|
||
<ComboBox Header="Fallback encoder" | ||
SelectedIndex="1" | ||
MinWidth="240" | ||
Margin="{StaticResource SmallTopMargin}"> | ||
<ComboBoxItem>BMP Encoder</ComboBoxItem> | ||
<ComboBoxItem>GIF Encoder</ComboBoxItem> | ||
<ComboBoxItem>JPEG Encoder</ComboBoxItem> | ||
<ComboBoxItem>PNG Encoder</ComboBoxItem> | ||
<ComboBoxItem>TIFF Encoder</ComboBoxItem> | ||
<ComboBoxItem>WMPhoto Encoder</ComboBoxItem> | ||
</ComboBox> | ||
|
||
<muxc:NumberBox Header="JPEG Quality level" | ||
Minimum="0" | ||
Maximum="100" | ||
Value="90" | ||
MinWidth="240" | ||
SpinButtonPlacementMode="Inline" | ||
HorizontalAlignment="Left" | ||
Margin="{StaticResource SmallTopMargin}" /> | ||
|
||
<ComboBox Header="PNG interlacing" | ||
SelectedIndex="0" | ||
MinWidth="240" | ||
Margin="{StaticResource SmallTopMargin}"> | ||
<ComboBoxItem>Default</ComboBoxItem> | ||
<ComboBoxItem>On</ComboBoxItem> | ||
<ComboBoxItem>Off</ComboBoxItem> | ||
</ComboBox> | ||
|
||
<ComboBox Header="TIFF Compression" | ||
SelectedIndex="0" | ||
MinWidth="240" | ||
Margin="{StaticResource SmallTopMargin}"> | ||
<ComboBoxItem>Default</ComboBoxItem> | ||
<ComboBoxItem>None</ComboBoxItem> | ||
<ComboBoxItem>CCITT3</ComboBoxItem> | ||
<ComboBoxItem>CCITT4</ComboBoxItem> | ||
<ComboBoxItem>LZW</ComboBoxItem> | ||
<ComboBoxItem>RLE</ComboBoxItem> | ||
<ComboBoxItem>Zip</ComboBoxItem> | ||
</ComboBox> | ||
|
||
<TextBlock Text="File" | ||
Style="{StaticResource SettingsGroupTitleStyle}"/> | ||
|
||
|
||
<TextBox Header="Filename format" | ||
Text="%1 (%2)" | ||
HorizontalAlignment="Left" | ||
MinWidth="240" | ||
Margin="{StaticResource SmallTopMargin}"/> | ||
|
||
<TextBlock Text="The following parameters can be used:" | ||
Margin="{StaticResource SmallTopBottomMargin}"/> | ||
|
||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%1</Run> | ||
<Run> - Original filename</Run> | ||
</TextBlock> | ||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%2</Run> | ||
<Run> - Size name</Run> | ||
</TextBlock> | ||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%3</Run> | ||
<Run> - Selected width</Run> | ||
</TextBlock> | ||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%4</Run> | ||
<Run> - Selected height</Run> | ||
</TextBlock> | ||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%5</Run> | ||
<Run> - Actual height</Run> | ||
</TextBlock> | ||
<TextBlock FontSize="12"> | ||
<Run FontWeight="Bold">%6</Run> | ||
<Run> - Actual width</Run> | ||
</TextBlock> | ||
|
||
<CheckBox Content="Use original date modified" | ||
Margin="{StaticResource SmallTopMargin}"/> | ||
</StackPanel> | ||
|
||
<StackPanel x:Name="SidePanel" | ||
Orientation="Vertical" | ||
HorizontalAlignment="Left" | ||
Width="{StaticResource SidePanelWidth}" | ||
Grid.Column="1"> | ||
|
||
<TextBlock Text="About this feature" | ||
Style="{StaticResource SettingsGroupTitleStyle}" | ||
Margin="{StaticResource XSmallBottomMargin}"/> | ||
|
||
<HyperlinkButton Content="Module overview"/> | ||
<HyperlinkButton Content="Give feedback"/> | ||
|
||
<TextBlock Text="Contributors" | ||
Style="{StaticResource SettingsGroupTitleStyle}"/> | ||
|
||
<HyperlinkButton Content="Contributor name"/> | ||
<HyperlinkButton Content="Contributor name"/> | ||
<HyperlinkButton Content="Contributor name"/> | ||
</StackPanel> | ||
</Grid> | ||
</Page> |
29 changes: 29 additions & 0 deletions
29
src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.PowerToys.Settings.UI.ViewModels; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
namespace Microsoft.PowerToys.Settings.UI.Views | ||
{ | ||
public sealed partial class ImageResizerPage : Page | ||
{ | ||
public ImageResizerViewModel ViewModel { get; } = new ImageResizerViewModel(); | ||
|
||
public ImageResizerPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.