diff options
author | sr55 <[email protected]> | 2012-03-17 18:36:35 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-03-17 18:36:35 +0000 |
commit | 7686ecbf127a41291a7fe76852f93fe7a6f60fb4 (patch) | |
tree | b77205d3464bc0ae3fb374acbe0acedf72916834 /win/CS | |
parent | f87e4ae9727bbb10040e5dd5cd99a6a7f1f4dd1d (diff) |
WinGui: (WPF) Wired up the Add Preset window and setup the build scripts to create Alpha Builds for this project.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4508 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
17 files changed, 488 insertions, 106 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index ff6f8cd4b..bebc5c331 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -114,6 +114,7 @@ <Compile Include="Model\General\UpdateCheckResult.cs" />
<Compile Include="Model\ModelBase.cs" />
<Compile Include="Model\Preset.cs" />
+ <Compile Include="Model\PresetPictureSettingsMode.cs" />
<Compile Include="Model\QueueItemStatus.cs" />
<Compile Include="Model\QueueTask.cs" />
<Compile Include="Model\Encoding\SubtitleType.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 6e2d59667..e1ed6eb62 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -91,9 +91,6 @@ namespace HandBrake.ApplicationServices.Model this.PixelAspectX = task.PixelAspectX;
this.PixelAspectY = task.PixelAspectY;
this.PointToPointMode = task.PointToPointMode;
- this.PresetBuildNumber = task.PresetBuildNumber;
- this.PresetDescription = task.PresetDescription;
- this.PresetName = task.PresetName;
this.Quality = task.Quality;
this.Source = task.Source;
this.StartPoint = task.StartPoint;
@@ -107,10 +104,6 @@ namespace HandBrake.ApplicationServices.Model this.Title = task.Title;
this.TurboFirstPass = task.TurboFirstPass;
this.TwoPass = task.TwoPass;
- this.Type = task.Type;
- this.UsesMaxPictureSettings = task.UsesMaxPictureSettings;
- this.UsesPictureFilters = task.UsesPictureFilters;
- this.UsesPictureSettings = task.UsesPictureSettings;
this.Verbosity = task.Verbosity;
this.VideoBitrate = task.VideoBitrate;
this.VideoEncoder = task.VideoEncoder;
@@ -437,44 +430,6 @@ namespace HandBrake.ApplicationServices.Model public int? PreviewDuration { get; set; }
#endregion
- #region Preset Information (TODO This should probably be dropped)
-
- /// <summary>
- /// Gets or sets PresetBuildNumber.
- /// </summary>
- public int PresetBuildNumber { get; set; }
-
- /// <summary>
- /// Gets or sets PresetDescription.
- /// </summary>
- public string PresetDescription { get; set; }
-
- /// <summary>
- /// Gets or sets PresetName.
- /// </summary>
- public string PresetName { get; set; }
-
- /// <summary>
- /// Gets or sets Type.
- /// </summary>
- public string Type { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether UsesMaxPictureSettings.
- /// </summary>
- public bool UsesMaxPictureSettings { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether UsesPictureFilters.
- /// </summary>
- public bool UsesPictureFilters { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether UsesPictureSettings.
- /// </summary>
- public bool UsesPictureSettings { get; set; }
- #endregion
-
#region Helpers
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs index 2ec668b56..8770e6d03 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs @@ -5,6 +5,8 @@ namespace HandBrake.ApplicationServices.Model
{
+ using System;
+
using Encoding;
/// <summary>
@@ -30,6 +32,7 @@ namespace HandBrake.ApplicationServices.Model /// <summary>
/// Gets or sets a value indicating whether to use picture Settings in presets.
/// </summary>
+ [Obsolete("Don't use this!")]
public bool CropSettings { get; set; }
/// <summary>
@@ -48,6 +51,12 @@ namespace HandBrake.ApplicationServices.Model public bool UsePictureFilters { get; set; }
/// <summary>
+ /// Gets or sets PictureSettingsMode.
+ /// Source Maximum, Custom or None
+ /// </summary>
+ public PresetPictureSettingsMode PictureSettingsMode { get; set; }
+
+ /// <summary>
/// Gets or sets a value indicating whether this is a built in preset
/// </summary>
public bool IsBuildIn { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs b/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs new file mode 100644 index 000000000..fc2798fd1 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs @@ -0,0 +1,22 @@ +/* PresetPictureSettingsMode.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// Picture Settings Mode when adding presets
+ /// </summary>
+ public enum PresetPictureSettingsMode
+ {
+ [Display(Name = "None")]
+ None,
+ [Display(Name = "Custom")]
+ Custom,
+ [Display(Name = "Source Maximum")]
+ SourceMaximum,
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index 33b872796..63d636f5c 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -42,9 +42,9 @@ namespace HandBrake.ApplicationServices.Services private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Preset>));
/// <summary>
- /// The User Setting Service
+ /// User Preset Default Catgory Name
/// </summary>
- private IUserSettingService userSettingService = ServiceManager.UserSettingService;
+ public static string UserPresetCatgoryName = "User Presets";
/// <summary>
/// The User Preset file
@@ -61,8 +61,14 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
private ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
+ /// <summary>
+ /// The User Setting Service
+ /// </summary>
+ private IUserSettingService userSettingService = ServiceManager.UserSettingService;
+
#endregion
+
/// <summary>
/// Initializes a new instance of the <see cref="PresetService"/> class.
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index a018c9900..ccac82893 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs @@ -16,6 +16,7 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
@@ -31,20 +32,43 @@ namespace HandBrake.ApplicationServices.Utilities #region Import
- public static EncodeTask Import(string filename)
+ public static Preset Import(string filename)
{
+ Preset preset = new Preset();
+
XmlNode root = loadFile(filename);
if (root == null) return null;
// We'll query a query parser object and use it's public var structures to store all the data.
// This will allow the preset loader logic to be used instead of writing custom logic just for this file.
EncodeTask parsed = new EncodeTask();
+ bool useFilters = false;
+ PresetPictureSettingsMode pictureSettingsMode = PresetPictureSettingsMode.None;
string qualityMode = string.Empty;
#region Get a List of Audio Track Objects
- XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[13];
+
+ // This is the main <dict> with all the values
+ XmlNode mainDict = root.ChildNodes[2].ChildNodes[0].FirstChild;
+ XmlNode audioListDict = null;
ObservableCollection<AudioTrack> audioTracks = new ObservableCollection<AudioTrack>();
+ // Look for the AudioList key
+ bool found = false;
+ foreach (XmlNode node in mainDict.ChildNodes)
+ {
+ if (found)
+ {
+ audioListDict = node;
+ break;
+ }
+
+ if (node.InnerText == "AudioList")
+ {
+ found = true; // We want the next node, as it is the value object.
+ }
+ }
+
for (int i = 0; i < audioListDict.ChildNodes.Count; i++)
{
XmlNode audioChannel = audioListDict.ChildNodes[i];
@@ -304,25 +328,25 @@ namespace HandBrake.ApplicationServices.Utilities // Preset Information
case "PresetBuildNumber":
- parsed.PresetBuildNumber = int.Parse(value);
+ preset.Version = value;
break;
case "PresetDescription":
- parsed.PresetDescription = value;
+ preset.Description = value;
break;
case "PresetName":
- parsed.PresetName = value;
+ preset.Name = value;
break;
case "Type":
- parsed.Type = value;
+ //parsed.Type = value; // TODO find out what this is
break;
case "UsesMaxPictureSettings":
- parsed.UsesMaxPictureSettings = value == "1";
+ pictureSettingsMode = PresetPictureSettingsMode.SourceMaximum;
break;
case "UsesPictureFilters":
- parsed.UsesPictureFilters = value == "1";
+ useFilters = value == "1";
break;
case "UsesPictureSettings":
- parsed.UsesPictureSettings = value == "1";
+ pictureSettingsMode = PresetPictureSettingsMode.Custom;
break;
// Allowed Passthru
@@ -357,9 +381,32 @@ namespace HandBrake.ApplicationServices.Utilities parsed.VideoEncodeRateType = VideoEncodeRateType.ConstantQuality;
break;
}
+
+ // Default filters if we have to
+ if (!useFilters)
+ {
+ parsed.Detelecine = Detelecine.Off;
+ parsed.Denoise = Denoise.Off;
+ parsed.Deinterlace = Deinterlace.Off;
+ parsed.Decomb = Decomb.Off;
+ parsed.Deblock = 0;
+ parsed.Grayscale = false;
+ }
+
+ if (pictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)
+ {
+ parsed.MaxWidth = parsed.Height;
+ parsed.MaxHeight = parsed.Width;
+ }
#endregion
- return parsed;
+
+ preset.Task = parsed;
+ preset.PictureSettingsMode = pictureSettingsMode;
+ preset.UsePictureFilters = useFilters;
+ preset.Category = PresetService.UserPresetCatgoryName;
+
+ return preset;
}
private static XmlNode loadFile(string filename)
diff --git a/win/CS/HandBrakeCS.csproj b/win/CS/HandBrakeCS.csproj index 117881d89..fed7072e5 100644 --- a/win/CS/HandBrakeCS.csproj +++ b/win/CS/HandBrakeCS.csproj @@ -88,6 +88,7 @@ <HintPath>libraries\SplitButton\SplitButton.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index b5ee371b6..d5663f2af 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.Converters using System;
using HandBrake.ApplicationServices.Functions;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.Model.Encoding.x264;
@@ -70,7 +71,10 @@ namespace HandBrakeWPF.Converters return EnumHelper<AudioEncoder>.GetEnumDisplayValues(typeof(AudioEncoder));
}
-
+ if (value is IEnumerable<PresetPictureSettingsMode>)
+ {
+ return EnumHelper<PresetPictureSettingsMode>.GetEnumDisplayValues(typeof(PresetPictureSettingsMode));
+ }
// Single Items
if (targetType == typeof(x264Preset) || value.GetType() == typeof(x264Preset))
@@ -97,6 +101,10 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<AudioEncoder>.GetDisplay((AudioEncoder)value);
}
+ if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
+ {
+ return EnumHelper<PresetPictureSettingsMode>.GetDisplay((PresetPictureSettingsMode)value);
+ }
return null;
}
@@ -148,6 +156,10 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<AudioEncoder>.GetValue(value.ToString());
}
+ if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
+ {
+ return EnumHelper<PresetPictureSettingsMode>.GetValue(value.ToString());
+ }
return null;
}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 2b4a5f501..a65f102d8 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -196,6 +196,8 @@ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
+ <None Include="Installer\MakeAlpha.nsi.tmpl" />
+ <None Include="Properties\AssemblyInfo.cs.tmpl" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -321,6 +323,10 @@ <Project>{F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}</Project>
<Name>HandBrakeInterop</Name>
</ProjectReference>
+ <ProjectReference Include="..\HandBrakeCS.csproj">
+ <Project>{A2923D42-C38B-4B12-8CBA-B8D93D6B13A3}</Project>
+ <Name>HandBrakeCS</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
diff --git a/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl new file mode 100644 index 000000000..53ac01d52 --- /dev/null +++ b/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl @@ -0,0 +1,167 @@ +/* Resources.Designer.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "HandBrake WPF (Pre-Alpha)"
+!define PRODUCT_VERSION "$WCREV$"
+!define PRODUCT_VERSION_NUMBER "svn$WCREV$"
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\HandBrakeWPF.exe"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+;Required .NET framework
+!define MIN_FRA_MAJOR "4"
+!define MIN_FRA_MINOR "0"
+!define MIN_FRA_BUILD "*"
+
+SetCompressor lzma
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "handbrakepineapple.ico"
+!define MUI_UNICON "handbrakepineapple.ico"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "doc\COPYING"
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+;!define MUI_FINISHPAGE_RUN "$INSTDIR\HandBrakeWPF.exe"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "HandBrake-${PRODUCT_VERSION_NUMBER}-WPF_PRE_ALPHA.exe"
+
+!include WordFunc.nsh
+!insertmacro VersionCompare
+!include LogicLib.nsh
+
+InstallDir "$PROGRAMFILES\HandbrakeWPF"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+Var InstallDotNET
+
+Function .onInit
+
+ ; Begin Only allow one version
+ System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
+ Pop $R0
+
+ StrCmp $R0 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
+ Abort
+
+ ;Remove previous version
+ ReadRegStr $R0 HKLM \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}\" \
+ "UninstallString"
+ StrCmp $R0 "" done
+
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+ "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
+ previous version or `Cancel` to continue." /SD IDOK \
+ IDOK uninst
+ goto done
+
+ ;Run the uninstaller
+ uninst:
+ IfSilent +3
+ Exec $INSTDIR\uninst.exe
+ goto done
+ Exec '"$INSTDIR\uninst.exe" /S'
+ done:
+FunctionEnd
+
+Section "Handbrake" SEC01
+ SetOutPath "$INSTDIR"
+ SetOverwrite ifnewer
+
+ ; Install Files
+ File "*.exe"
+ CreateDirectory "$SMPROGRAMS\HandBrakeWPF"
+ CreateShortCut "$SMPROGRAMS\Handbrake\HandBrakeWPF.lnk" "$INSTDIR\HandBrakeWPF.exe"
+ CreateShortCut "$DESKTOP\HandBrakeWPF.lnk" "$INSTDIR\HandBrakeWPF.exe"
+ File "*.dll"
+ File "*.config"
+ File "*.xml"
+
+ ; Copy the standard doc set into the doc folder
+ SetOutPath "$INSTDIR\doc"
+ SetOverwrite ifnewer
+ File "doc\*.*"
+
+ ; Copy the standard fonts config set into the fonts folder
+ SetOutPath "$INSTDIR\fonts"
+ SetOverwrite ifnewer
+ File /r "fonts\*.*"
+SectionEnd
+
+Section -AdditionalIcons
+ CreateShortCut "$SMPROGRAMS\Handbrake\Uninstall.lnk" "$INSTDIR\uninst.exe"
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\HandBrakeWPF.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\HandBrakeWPF.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+SectionEnd
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
+FunctionEnd
+
+Function un.onInit
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" /SD IDYES IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ Delete "$INSTDIR\uninst.exe"
+
+ Delete "$INSTDIR\*.*"
+ Delete "$INSTDIR\doc\*.*"
+ Delete "$INSTDIR\fonts\*.*"
+ Delete "$INSTDIR\fonts\conf.d\*.*"
+ Delete "$INSTDIR\fonts\conf.avail\*.*"
+ RMDir "$INSTDIR\doc"
+ RMDIR "$INSTDIR\fonts\conf.d"
+ RMDIR "$INSTDIR\fonts\conf.avail"
+ RMDIR "$INSTDIR\fonts"
+ Delete "$SMPROGRAMS\HandBrakeWPF\Uninstall.lnk"
+ Delete "$DESKTOP\HandBrakeWPF.lnk"
+ Delete "$SMPROGRAMS\HandBrakeWPF\HandBrakeWPF.lnk"
+ RMDir "$SMPROGRAMS\HandBrakeWPF"
+ RMDir "$INSTDIR"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+ SetAutoClose true
+SectionEnd
+
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl new file mode 100644 index 000000000..a55652272 --- /dev/null +++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl @@ -0,0 +1,60 @@ +/* AssemblyInfo.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HandBrake")]
+[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HandBrake Team")]
+[assembly: AssemblyProduct("HandBrake")]
+[assembly: AssemblyCopyright("Copyright © HandBrake Team 2011-2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.9.6.$WCREV$")]
+[assembly: NeutralResourcesLanguage("")]
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index c46792c7c..77210737a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -9,12 +9,15 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -38,6 +41,16 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
/// <summary>
+ /// Backing fields for Selected Picture settings mode.
+ /// </summary>
+ private PresetPictureSettingsMode selectedPictureSettingMode;
+
+ /// <summary>
+ /// Backging field for show custom inputs
+ /// </summary>
+ private bool showCustomInputs;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
/// <param name="windowManager">
@@ -54,15 +67,83 @@ namespace HandBrakeWPF.ViewModels this.presetService = presetService;
this.errorService = errorService;
this.Title = "Add Preset";
- this.Preset = new Preset {IsBuildIn = false, IsDefault = false, Category = "User Presets"};
+ this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName };
+ this.PictureSettingsModes = EnumHelper<PresetPictureSettingsMode>.GetEnumList();
}
/// <summary>
- /// Gets or sets the Preset
+ /// Gets the Preset
/// </summary>
public Preset Preset { get; private set; }
/// <summary>
+ /// Gets or sets PictureSettingsModes.
+ /// </summary>
+ public IEnumerable<PresetPictureSettingsMode> PictureSettingsModes { get; set; }
+
+ /// <summary>
+ /// Gets or sets CustomWidth.
+ /// </summary>
+ public int CustomWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets CustomHeight.
+ /// </summary>
+ public int CustomHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether ShowCustomInputs.
+ /// </summary>
+ public bool ShowCustomInputs
+ {
+ get
+ {
+ return this.showCustomInputs;
+ }
+ set
+ {
+ this.showCustomInputs = value;
+ this.NotifyOfPropertyChange(() => this.ShowCustomInputs);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SelectedPictureSettingMode.
+ /// </summary>
+ public PresetPictureSettingsMode SelectedPictureSettingMode
+ {
+ get
+ {
+ return this.selectedPictureSettingMode;
+ }
+ set
+ {
+ this.selectedPictureSettingMode = value;
+ this.ShowCustomInputs = value == PresetPictureSettingsMode.Custom;
+
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.Custom)
+ {
+ this.Preset.Task.MaxHeight = null;
+ this.Preset.Task.MaxWidth = null;
+ }
+
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.Custom)
+ {
+ this.Preset.Task.Width = this.CustomWidth;
+ this.Preset.Task.Height = this.CustomHeight;
+ this.Preset.Task.MaxHeight = null;
+ this.Preset.Task.MaxWidth = null;
+ }
+
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum)
+ {
+ this.Preset.Task.MaxWidth = this.Preset.Task.Width;
+ this.Preset.Task.MaxHeight = this.Preset.Task.Height;
+ }
+ }
+ }
+
+ /// <summary>
/// Prepare the Preset window to create a Preset Object later.
/// </summary>
/// <param name="task">
@@ -70,11 +151,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void Setup(EncodeTask task)
{
- task.UsesPictureFilters = this.Preset.UsePictureFilters;
- task.UsesMaxPictureSettings = false; // TODO
- task.UsesPictureSettings = false; // TODO
- this.Preset.Task = task;
- this.Preset.Query = QueryGeneratorUtility.GenerateQuery(task);
+ this.Preset.Task = new EncodeTask(task);
}
/// <summary>
@@ -94,6 +171,9 @@ namespace HandBrakeWPF.ViewModels return;
}
+ this.Preset.UsePictureFilters = this.Preset.UsePictureFilters;
+ this.Preset.PictureSettingsMode = this.SelectedPictureSettingMode;
+
bool added = this.presetService.Add(this.Preset);
if (!added)
{
@@ -106,6 +186,9 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Cancel adding a preset
+ /// </summary>
public void Cancel()
{
this.Close();
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 67472bd81..fcaf5aa02 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -937,10 +937,10 @@ namespace HandBrakeWPF.ViewModels if (!string.IsNullOrEmpty(filename))
{
- EncodeTask parsed = PlistPresetHandler.Import(filename);
- if (this.presetService.CheckIfPresetExists(parsed.PresetName))
+ Preset preset = PlistPresetHandler.Import(filename);
+ if (this.presetService.CheckIfPresetExists(preset.Name))
{
- if (!presetService.CanUpdatePreset(parsed.PresetName))
+ if (!presetService.CanUpdatePreset(preset.Name))
{
MessageBox.Show(
"You can not import a preset with the same name as a built-in preset.",
@@ -958,18 +958,15 @@ namespace HandBrakeWPF.ViewModels MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{
- Preset preset = new Preset { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed };
-
presetService.Update(preset);
}
}
else
{
- Preset preset = new Preset { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, };
presetService.Add(preset);
}
- this.NotifyOfPropertyChange("Presets");
+ this.NotifyOfPropertyChange(() => this.Presets);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 444208076..309bc6df3 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -476,7 +476,7 @@ namespace HandBrakeWPF.ViewModels {
// TODO: These all need to be handled correctly.
- if (Task.UsesMaxPictureSettings)
+ if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)
{
this.Task.MaxWidth = preset.Task.MaxWidth;
this.Task.MaxHeight = preset.Task.MaxHeight;
diff --git a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml index 97d3974b7..216ee64e5 100644 --- a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml +++ b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml @@ -3,10 +3,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
- mc:Ignorable="d"
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" mc:Ignorable="d"
Title="{Binding Title}"
Width="350" Height="310">
+ <Window.Resources>
+ <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
+ <Converters:EnumComboConverter x:Key="enumComboConverter" />
+ </Window.Resources>
+
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFF1F0EF">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -48,9 +53,11 @@ <TextBlock Text="Picture Settings:" FontWeight="Bold" Grid.Row="1" Grid.Column="0" Margin="0,20,0,0" />
<TextBlock Text="Use Picture Size:" Grid.Row="2" Grid.Column="0" />
- <ComboBox Width="100" ItemsSource="{Binding PictureSettingModes}" SelectedItem="{Binding SelectedPictureMode}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" />
-
- <StackPanel Orientation="Horizontal" Margin="0,10,0,0" Grid.Row="3" Grid.Column="1">
+ <ComboBox Width="125" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"
+ ItemsSource="{Binding PictureSettingsModes, Converter={StaticResource enumComboConverter}}"
+ SelectedItem="{Binding SelectedPictureSettingMode, Converter={StaticResource enumComboConverter}}"/>
+
+ <StackPanel Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding ShowCustomInputs, Converter={StaticResource boolToVisConverter}}" Grid.Row="3" Grid.Column="1">
<TextBox Width="50" Text="{Binding CustomWidth}" />
<TextBlock Text="X" FontWeight="Bold" Margin="10,0,10,0" />
<TextBox Width="50" Text="{Binding CustomHeight}" />
diff --git a/win/CS/build.xml b/win/CS/build.xml index 19168497c..bd77cb5d9 100644 --- a/win/CS/build.xml +++ b/win/CS/build.xml @@ -5,7 +5,7 @@ It may be used under the terms of the GNU General Public License
HandBrake Build Scipt for usage with Jenkins.
- Usage: msbuild build.xml /p:Platform=x86
+ Usage: msbuild build.xml /p:Platform=x86 /t:ReleaseInstaller
Reuqires: HandBrakeCli.exe to be in the release folder.
-->
<Project DefaultTargets="NightlyBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@@ -18,8 +18,9 @@ <!-- Build all the main cproj files.-->
<ItemGroup>
<ProjectsToBuild Include="HandBrake.Interop\HandBrakeInterop\*proj" Exclude="$(MSBuildProjectFile)"/>
- <ProjectsToBuild Include="HandBrake.ApplicationServices\*proj" Exclude="$(MSBuildProjectFile)"/>
+ <ProjectsToBuild Include="HandBrake.ApplicationServices\*proj" Exclude="$(MSBuildProjectFile)"/>
<ProjectsToBuild Include="HandBrakeCS.*proj" Exclude="$(MSBuildProjectFile)"/>
+ <ProjectsToBuild Include="HandBrakeWPF\HandBrakeWPF.*proj" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup>
<!-- Dependencies -->
@@ -30,12 +31,17 @@ <PropertyGroup>
<InstallDependsOn>BuildRelease;CreateReleasePostBuildEvent</InstallDependsOn>
</PropertyGroup>
+
+ <PropertyGroup>
+ <AlphaDependsOn>AlphaPreBuild;BuildRelease;CreateAlphaPostBuildEvent</AlphaDependsOn>
+ </PropertyGroup>
- <!-- Builds -->
+ <!-- Builds /t: -->
<Target Name="NightlyBuild" DependsOnTargets="$(NightlyDependsOn)"/>
<Target Name="ReleaseInstaller" DependsOnTargets="$(InstallDependsOn)"/>
+ <Target Name="AlphaRelease" DependsOnTargets="$(AlphaDependsOn)"/>
- <!-- Build Components -->
+ <!-- Build All Components (Forms, WPF, ApplicationServices, Interop -->
<Target Name="BuildRelease">
<MSBuild Projects ="@(ProjectsToBuild)"
ContinueOnError ="false"
@@ -43,8 +49,14 @@ <Output ItemName="OutputFiles" TaskParameter="TargetOutputs"/>
</MSBuild>
</Target>
+
+ <!-- Pre Build Events -->
+ <Target Name="AlphaPreBuild">
+ <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs.tmpl $(ProjectDir)HandBrakeWPF\Properties\AssemblyInfo.cs" />
+ <Exec Command="subwcrev.exe $(ProjectDir). $(ProjectDir)HandBrakeWPF\Installer\MakeAlpha.nsi.tmpl $(ProjectDir)HandBrakeWPF\Installer\MakeAlpha.nsi" />
+ </Target>
- <!-- Events -->
+ <!-- Post Build Events -->
<Target Name="NightlyPostBuildEvent">
<Exec Command="copy $(ProjectDir)Installer\MakeNightly.nsi $(ProjectDir)bin\$(Platform)\Release /Y" Condition="$(Platform) == 'x86'" />
<Exec Command="copy $(ProjectDir)Installer\MakeNightly64.nsi $(ProjectDir)bin\$(Platform)\Release /Y" Condition="$(Platform) == 'x64'" />
@@ -67,4 +79,11 @@ <Exec Command="makensis $(ProjectDir)bin\$(Platform)\Release\Installer64.nsi" Condition="$(Platform) == 'x64'" />
</Target>
+ <Target Name="CreateAlphaPostBuildEvent">
+ <Exec Command="copy $(ProjectDir)HandBrakeWPF\Installer\MakeAlpha.nsi $(ProjectDir)HandBrakeWPF\bin\Release /Y" />
+ <Exec Command="copy $(ProjectDir)handbrakepineapple.ico $(ProjectDir)HandBrakeWPF\bin\Release /Y" />
+ <Exec Command="xcopy $(ProjectDir)doc $(ProjectDir)HandBrakeWPF\bin\Release\doc /I /Y" />
+ <Exec Command="makensis $(ProjectDir)HandBrakeWPF\bin\Release\MakeAlpha.nsi"/>
+ </Target>
+
</Project>
\ No newline at end of file diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 8f80de22f..697932940 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -841,11 +841,11 @@ namespace Handbrake {
if (openPreset.ShowDialog() == DialogResult.OK)
{
- EncodeTask parsed = PlistPresetHandler.Import(openPreset.FileName);
+ Preset parsed = PlistPresetHandler.Import(openPreset.FileName);
- if (presetHandler.CheckIfPresetExists(parsed.PresetName))
+ if (presetHandler.CheckIfPresetExists(parsed.Name))
{
- if (!presetHandler.CanUpdatePreset(parsed.PresetName))
+ if (!presetHandler.CanUpdatePreset(parsed.Name))
{
MessageBox.Show(
"You can not import a preset with the same name as a built-in preset.",
@@ -861,35 +861,25 @@ namespace Handbrake MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
- Preset preset = new Preset
- {
- Name = parsed.PresetName,
- Query = QueryGeneratorUtility.GenerateQuery(parsed),
- CropSettings = parsed.UsesPictureSettings,
- Description = string.Empty,
- AudioPassthruSettings = parsed.AllowedPassthruOptions
- };
+ parsed.Query = QueryGeneratorUtility.GenerateQuery(parsed.Task);
+ parsed.AudioPassthruSettings = parsed.Task.AllowedPassthruOptions;
+ parsed.CropSettings = false;
- presetHandler.Update(preset);
+ presetHandler.Update(parsed);
}
}
else
{
- Preset preset = new Preset
- {
- Name = parsed.PresetName,
- Query = QueryGeneratorUtility.GenerateQuery(parsed),
- CropSettings = parsed.UsesPictureSettings,
- Description = string.Empty,
- AudioPassthruSettings = parsed.AllowedPassthruOptions
- };
-
- if (presetHandler.Add(preset))
+ parsed.Query = QueryGeneratorUtility.GenerateQuery(parsed.Task);
+ parsed.AudioPassthruSettings = parsed.Task.AllowedPassthruOptions;
+ parsed.CropSettings = false;
+
+ if (presetHandler.Add(parsed))
{
- TreeNode preset_treeview = new TreeNode(parsed.PresetName)
+ TreeNode preset_treeview = new TreeNode(parsed.Name)
{
ForeColor = Color.Black,
- Tag = preset,
+ Tag = parsed,
};
treeView_presets.Nodes.Add(preset_treeview);
}
|