diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/app.config | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/SourceSelection.xaml | 93 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs | 27 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 38 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Model/ScanMode.cs | 21 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 112 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/CountdownAlertView.xaml | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/File32.png | bin | 0 -> 328 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/folder32.png | bin | 0 -> 314 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 26 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/app.config | 2 |
11 files changed, 311 insertions, 14 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/app.config b/win/CS/HandBrake.ApplicationServices/app.config index 1747ee2d8..084adc9e4 100644 --- a/win/CS/HandBrake.ApplicationServices/app.config +++ b/win/CS/HandBrake.ApplicationServices/app.config @@ -1,9 +1,8 @@ -<?xml version="1.0"?>
+<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<startup>
-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
- </startup>
+ </startup>
</configuration>
diff --git a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml new file mode 100644 index 000000000..b44785324 --- /dev/null +++ b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml @@ -0,0 +1,93 @@ +<UserControl x:Class="HandBrakeWPF.Controls.SourceSelection"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:cal="http://www.caliburnproject.org"
+ xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
+ Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
+
+ <Grid VerticalAlignment="Top" HorizontalAlignment="Center">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+
+ <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="15,30,0,0">
+ <TextBlock Text="Source Selection" FontSize="14" FontWeight="Bold" />
+ </StackPanel>
+
+ <!-- Title Specific Scan -->
+ <StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Left" Margin="15,10,0,0">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Optionally choose a specific title: " />
+
+ <controls:NumberBox Width="60" Height="24" Margin="10,0,0,0"
+ Minimum="0" Maximum="1000" Number="{Binding SelectedTitle, Mode=TwoWay}" />
+ </StackPanel>
+
+ <TextBlock Text="Then choose your source: " Margin="0,20,0,0" />
+ </StackPanel>
+
+ <!-- Source Type -->
+ <StackPanel Grid.Row="2" Orientation="Vertical" HorizontalAlignment="Center" Margin="15,10,0,0">
+
+ <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FolderScan]"
+ Margin="0,0,0,10" Padding="8" HorizontalAlignment="Left">
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/folder32.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="Folder" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="Open a Video_TS folder or batch scan a number of files" VerticalAlignment="Center" Margin="5,0,0,0" />
+ </StackPanel>
+ </StackPanel>
+ </Button>
+
+ <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FileScan]"
+ Margin="0,0,0,7" Padding="8" HorizontalAlignment="Left">
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/File32.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="File" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="Open a single file." VerticalAlignment="Center" Margin="5,0,0,0" />
+ </StackPanel>
+ </StackPanel>
+ </Button>
+
+ <ListBox ItemsSource="{Binding Drives}" Background="Transparent" BorderThickness="0">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
+ cal:Message.Attach="[Event Click] = [Action ProcessDrive($this.Tag)]"
+ Margin="0,0,0,10" Padding="8" HorizontalAlignment="Left"
+ Tag="{Binding}">
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/Disc.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{Binding Text}" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="Open this DVD or Bluray Drive" VerticalAlignment="Center" Margin="5,0,0,0" />
+ </StackPanel>
+ </StackPanel>
+ </Button>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+
+ </ListBox>
+ </StackPanel>
+
+ <!-- Cancel Window -->
+ <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,10,10">
+ <Button cal:Message.Attach="[Event Click] = [Action CloseSourceSelection]" Content="Cancel" Padding="8,2" />
+ </StackPanel>
+
+ <StackPanel Grid.Row="4" />
+
+ <StackPanel Grid.Row="5" VerticalAlignment="Bottom" Orientation="Vertical">
+ <TextBlock Text="This is an experimental replacement for the source selection menu. Feedback welcome on the forum." Margin="10,0,10,0" TextWrapping="Wrap" />
+ </StackPanel>
+
+ </Grid>
+</UserControl>
diff --git a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs new file mode 100644 index 000000000..5d04af6f8 --- /dev/null +++ b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceSelection.xaml.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Interaction logic for SourceSelection.xaml
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Controls
+{
+ using System.Windows.Controls;
+
+ /// <summary>
+ /// Interaction logic for SourceSelection.xaml
+ /// </summary>
+ public partial class SourceSelection : UserControl
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SourceSelection"/> class.
+ /// </summary>
+ public SourceSelection()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index f7b44df16..106921783 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -15,6 +15,7 @@ <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -27,7 +28,6 @@ <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@@ -140,11 +140,15 @@ <Compile Include="Constants.cs" />
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
+ <Compile Include="Model\ScanMode.cs" />
<Compile Include="Factories\HBConfigurationFactory.cs" />
<Compile Include="Services\Interfaces\IUserSettingService.cs" />
<Compile Include="Services\UserSettingService.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />
+ <Compile Include="Controls\SourceSelection.xaml.cs">
+ <DependentUpon>SourceSelection.xaml</DependentUpon>
+ </Compile>
<Compile Include="ViewModels\Interfaces\IStaticPreviewViewModel.cs" />
<Compile Include="ViewModels\StaticPreviewViewModel.cs" />
<Compile Include="Views\CountdownAlertView.xaml.cs">
@@ -360,6 +364,10 @@ <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Controls\SourceSelection.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\CountdownAlertView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -539,6 +547,34 @@ <Resource Include="Views\Images\Disc.png" />
<Resource Include="Views\Images\file.png" />
</ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Views\Images\folder32.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Views\Images\File32.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/win/CS/HandBrakeWPF/Model/ScanMode.cs b/win/CS/HandBrakeWPF/Model/ScanMode.cs new file mode 100644 index 000000000..3b7f5573d --- /dev/null +++ b/win/CS/HandBrakeWPF/Model/ScanMode.cs @@ -0,0 +1,21 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScanMode.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Scan Mode
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Model
+{
+ /// <summary>
+ /// ScanModeEnum
+ /// </summary>
+ public enum ScanMode
+ {
+ File,
+ Folder,
+ Disc
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index dc87292d9..632de39ba 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -18,11 +18,9 @@ namespace HandBrakeWPF.ViewModels using System.Linq;
using System.Threading;
using System.Windows;
- using System.Windows.Media.Imaging;
using Caliburn.Micro;
- using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Factories;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
@@ -43,8 +41,6 @@ namespace HandBrakeWPF.ViewModels using Ookii.Dialogs.Wpf;
- using Image = System.Windows.Controls.Image;
-
/// <summary>
/// HandBrakes Main Window
/// </summary>
@@ -177,6 +173,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private bool isPresetPanelShowing;
+ /// <summary>
+ /// The show source selection.
+ /// </summary>
+ private bool showSourceSelection;
+
+ /// <summary>
+ /// The drives.
+ /// </summary>
+ private BindingList<SourceMenuItem> drives;
+
#endregion
/// <summary>
@@ -243,6 +249,7 @@ namespace HandBrakeWPF.ViewModels this.Presets = this.presetService.Presets;
this.CancelScanCommand = new CancelScanCommand(this.scanService);
+ this.Drives = new BindingList<SourceMenuItem>();
}
#region View Model Properties
@@ -859,6 +866,7 @@ namespace HandBrakeWPF.ViewModels {
return this.selectedOutputFormat;
}
+
set
{
this.selectedOutputFormat = value;
@@ -914,6 +922,65 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public int ProgressPercentage { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether show source selection.
+ /// </summary>
+ public bool ShowSourceSelection
+ {
+ get
+ {
+ return this.showSourceSelection;
+ }
+ set
+ {
+ if (value.Equals(this.showSourceSelection))
+ {
+ return;
+ }
+ this.showSourceSelection = value;
+ this.NotifyOfPropertyChange(() => this.ShowSourceSelection);
+
+ // Refresh the drives.
+ if (this.showSourceSelection)
+ {
+ this.Drives.Clear();
+ foreach (SourceMenuItem menuItem in from item in GeneralUtilities.GetDrives()
+ let driveInformation = item
+ select new SourceMenuItem
+ {
+ Text = string.Format("{0} ({1})", item.RootDirectory, item.VolumeLabel),
+ Command = new SourceMenuCommand(() => this.ProcessDrive(driveInformation)),
+ Tag = item,
+ IsDrive = true
+ })
+ {
+ this.Drives.Add(menuItem);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the drives.
+ /// </summary>
+ public BindingList<SourceMenuItem> Drives
+ {
+ get
+ {
+ return this.drives;
+ }
+ set
+ {
+ if (Equals(value, this.drives))
+ {
+ return;
+ }
+
+ this.drives = value;
+ this.NotifyOfPropertyChange(() => this.Drives);
+ }
+ }
+
#endregion
#region Load and Shutdown Handling
@@ -1179,6 +1246,9 @@ namespace HandBrakeWPF.ViewModels {
VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true };
dialog.ShowDialog();
+
+ ShowSourceSelection = false;
+
this.StartScan(dialog.SelectedPath, 0);
}
@@ -1189,6 +1259,9 @@ namespace HandBrakeWPF.ViewModels {
OpenFileDialog dialog = new OpenFileDialog { Filter = "All files (*.*)|*.*" };
dialog.ShowDialog();
+
+ ShowSourceSelection = false;
+
this.StartScan(dialog.FileName, 0);
}
@@ -1341,6 +1414,22 @@ namespace HandBrakeWPF.ViewModels MessageBoxImage.Information);
}
+ /// <summary>
+ /// The select source window.
+ /// </summary>
+ public void SelectSourceWindow()
+ {
+ ShowSourceSelection = !ShowSourceSelection;
+ }
+
+ /// <summary>
+ /// The close source selection.
+ /// </summary>
+ public void CloseSourceSelection()
+ {
+ this.ShowSourceSelection = false;
+ }
+
#endregion
#region Main Window Public Methods
@@ -1996,7 +2085,20 @@ namespace HandBrakeWPF.ViewModels {
if (item != null)
{
- this.StartScan(((DriveInformation)item).RootDirectory, 0);
+ if (item.GetType() == typeof(DriveInformation))
+ {
+ this.StartScan(((DriveInformation)item).RootDirectory, 0);
+ }
+ else if (item.GetType() == typeof(SourceMenuItem))
+ {
+ DriveInformation driveInfo = ((SourceMenuItem)item).Tag as DriveInformation;
+ if (driveInfo != null)
+ {
+ this.StartScan(driveInfo.RootDirectory, 0);
+ }
+
+ this.ShowSourceSelection = false;
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Views/CountdownAlertView.xaml b/win/CS/HandBrakeWPF/Views/CountdownAlertView.xaml index 121f43595..b013096e4 100644 --- a/win/CS/HandBrakeWPF/Views/CountdownAlertView.xaml +++ b/win/CS/HandBrakeWPF/Views/CountdownAlertView.xaml @@ -13,7 +13,6 @@ <StackPanel Grid.Row="0"
Height="30"
Margin="0,0,0,10"
- Background="White"
Orientation="Horizontal">
<Image Width="24"
Height="24"
diff --git a/win/CS/HandBrakeWPF/Views/Images/File32.png b/win/CS/HandBrakeWPF/Views/Images/File32.png Binary files differnew file mode 100644 index 000000000..2b2ecba65 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/File32.png diff --git a/win/CS/HandBrakeWPF/Views/Images/folder32.png b/win/CS/HandBrakeWPF/Views/Images/folder32.png Binary files differnew file mode 100644 index 000000000..6a5b8e19f --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/folder32.png diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index d1add8edf..46fc614f0 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -6,7 +6,6 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
xmlns:attachedProperties="clr-namespace:HandBrakeWPF.AttachedProperties"
- xmlns:handBrakeWpf="clr-namespace:HandBrakeWPF"
AllowDrop="True"
FontSize="11"
Micro:Message.Attach="[Event Loaded] = [Action Load]"
@@ -187,7 +186,23 @@ ToolBar.OverflowMode="Never"
ToolBarTray.IsLocked="True"
>
- <Menu Background="Transparent">
+
+ <Button Name="SelectSource"
+ Micro:Message.Attach="[Event Click] = [Action SelectSourceWindow]">
+ <StackPanel Orientation="Horizontal">
+ <Image Width="32"
+ Height="32"
+ Source="Images/Movies.png"
+ />
+ <Label Margin="8,0,0,0"
+ VerticalAlignment="Center"
+ Content="Source"
+ />
+ </StackPanel>
+ </Button>
+
+
+ <Menu Background="Transparent" Visibility="Collapsed">
<MenuItem ItemsSource="{Binding SourceMenu}" attachedProperties:DriveMenu.ShowAvailableDrives="true">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
@@ -201,6 +216,7 @@ />
</StackPanel>
</MenuItem.Header>
+
<MenuItem.Resources>
<Image x:Key="Movie" x:Shared="False" MaxWidth="16" SnapsToDevicePixels="True" Source="Images/file.png" />
<Image x:Key="Folder" x:Shared="False" MaxWidth="16" SnapsToDevicePixels="True" Source="Images/folder.png" />
@@ -667,7 +683,11 @@ </Grid>
</GroupBox>
</Grid>
-
+
+ <!-- Source Selection-->
+ <Controls:SourceSelection Grid.Row="1" Width="400" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="DarkGray"
+ Visibility="{Binding ShowSourceSelection, Converter={StaticResource boolToVisConverter}}" />
+
<!-- StatusPanel -->
<Controls:StatusPanel x:Name="loadingPanel"
Grid.Row="1"
diff --git a/win/CS/HandBrakeWPF/app.config b/win/CS/HandBrakeWPF/app.config index 31b594129..fc4f3393f 100644 --- a/win/CS/HandBrakeWPF/app.config +++ b/win/CS/HandBrakeWPF/app.config @@ -1,4 +1,4 @@ -<?xml version="1.0"?>
+<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
|