From: sr55 Date: Sat, 29 Jun 2013 15:36:48 +0000 (+0000) Subject: WinGui: Just some prototype code for safe keeping. Some ideas around an Instant HandB... X-Git-Tag: 0.10.0~846 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75e97b7e676869c9ea83200b2f882ba4e0435f23;p=handbrake WinGui: Just some prototype code for safe keeping. Some ideas around an Instant HandBrake window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5617 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/CS/HandBrake10.sln.DotSettings b/win/CS/HandBrake10.sln.DotSettings index 66ba7643d..d55f220ff 100644 --- a/win/CS/HandBrake10.sln.DotSettings +++ b/win/CS/HandBrake10.sln.DotSettings @@ -1013,4 +1013,5 @@ NotOverridden NotOverridden NotOverridden - NotOverridden \ No newline at end of file + NotOverridden + 8 \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs index b674aa7b6..1d4434677 100644 --- a/win/CS/HandBrakeWPF/App.xaml.cs +++ b/win/CS/HandBrakeWPF/App.xaml.cs @@ -44,14 +44,20 @@ namespace HandBrakeWPF /// protected override void OnStartup(StartupEventArgs e) { + if (e.Args.Any(f => f.Equals("--instant"))) + { + AppArguments.IsInstantHandBrake = true; + MessageBox.Show("Instant HandBrake is just a prototype for toying with ideas. It may or may not work, or even be included in future builds.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); + } + base.OnStartup(e); // If we have a file dropped on the icon, try scanning it. - string[] fileNames = e.Args; - if (fileNames.Any() && (File.Exists(fileNames[0]) || Directory.Exists(fileNames[0]))) + string[] args = e.Args; + if (args.Any() && (File.Exists(args[0]) || Directory.Exists(args[0]))) { IMainViewModel mvm = IoC.Get(); - mvm.StartScan(fileNames[0], 0); + mvm.StartScan(args[0], 0); } } diff --git a/win/CS/HandBrakeWPF/AppArguments.cs b/win/CS/HandBrakeWPF/AppArguments.cs new file mode 100644 index 000000000..970ba9957 --- /dev/null +++ b/win/CS/HandBrakeWPF/AppArguments.cs @@ -0,0 +1,22 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Defines the AppArguments type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF +{ + /// + /// The app arguments. + /// + public class AppArguments + { + /// + /// Gets or sets a value indicating whether is instant hand brake. + /// + public static bool IsInstantHandBrake { get; set; } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 83535814b..ce90d914a 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -123,6 +123,7 @@ MSBuild:Compile Designer + @@ -184,6 +185,9 @@ EncoderOptionsView.xaml + + InstantMainView.xaml + QueueSelectionView.xaml @@ -353,6 +357,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/win/CS/HandBrakeWPF/Model/ShellWindow.cs b/win/CS/HandBrakeWPF/Model/ShellWindow.cs index 05ca1995e..bbb71625e 100644 --- a/win/CS/HandBrakeWPF/Model/ShellWindow.cs +++ b/win/CS/HandBrakeWPF/Model/ShellWindow.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.Model public enum ShellWindow { MainWindow, - OptionsWindow + OptionsWindow, + InstantMainWindow } } diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs index 67dcf4c09..6ccc50777 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs @@ -21,6 +21,11 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// Preset SelectedPreset { set; } + /// + /// Gets or Sets IsInstandHandBrake. + /// + bool IsInstandHandBrake { get; set; } + /// /// Shutdown the Application /// diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 81ac6a688..1e3754de7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -922,8 +922,16 @@ namespace HandBrakeWPF.ViewModels } } + /// + /// Gets or sets a value indicating progress percentage. + /// public int ProgressPercentage { get; set; } + /// + /// Gets or sets a value indicating whether the app is in "instant" mode + /// + public bool IsInstandHandBrake { get; set; } + #endregion #region Load and Shutdown Handling @@ -950,12 +958,18 @@ namespace HandBrakeWPF.ViewModels "Preset Update", MessageBoxButton.OK, MessageBoxImage.Information); // Queue Recovery - QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService); + if (!AppArguments.IsInstantHandBrake) + { + QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService); + } this.SelectedPreset = this.presetService.DefaultPreset; // Populate the Source menu with drives. - this.SourceMenu = new BindingList(this.GenerateSourceMenu()); + if (!AppArguments.IsInstantHandBrake) + { + this.SourceMenu = new BindingList(this.GenerateSourceMenu()); + } // Log Cleaning if (userSettingService.GetUserSetting(UserSettingConstants.ClearOldLogs)) @@ -1897,9 +1911,15 @@ namespace HandBrakeWPF.ViewModels { if (this.queueProcessor.EncodeService.IsEncoding) { + string josPending = string.Empty; + if (this.IsInstandHandBrake) + { + josPending = ", Pending Jobs {5}"; + } + this.ProgramStatusLabel = string.Format( - "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}, Pending Jobs {5}", + "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}" + josPending, e.PercentComplete, e.CurrentFrameRate, e.AverageFrameRate, diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index 39fee77fd..4a4aebf43 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -13,6 +13,8 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro; + using Castle.Facilities.FactorySupport; + using HandBrake.ApplicationServices.Services.Interfaces; using HandBrakeWPF.Helpers; @@ -42,6 +44,11 @@ namespace HandBrakeWPF.ViewModels /// private bool showOptions; + /// + /// The show instant. + /// + private bool showInstant; + #endregion /// @@ -53,8 +60,19 @@ namespace HandBrakeWPF.ViewModels public ShellViewModel(IErrorService errorService) { this.errorService = errorService; - this.showMainWindow = true; - this.showOptions = false; + + if (!AppArguments.IsInstantHandBrake) + { + this.showMainWindow = true; + this.showOptions = false; + this.showInstant = false; + } + else + { + this.showMainWindow = false; + this.showOptions = false; + this.showInstant = true; + } } /// @@ -69,16 +87,29 @@ namespace HandBrakeWPF.ViewModels { this.ShowMainWindow = true; this.ShowOptions = false; + this.ShowInstant = false; + this.MainViewModel.IsInstandHandBrake = false; } else if (window == ShellWindow.OptionsWindow) { this.ShowOptions = true; this.ShowMainWindow = false; + this.ShowInstant = false; + this.MainViewModel.IsInstandHandBrake = false; + } + else if (window == ShellWindow.InstantMainWindow) + { + this.ShowInstant = true; + this.ShowOptions = false; + this.ShowMainWindow = false; + this.MainViewModel.IsInstandHandBrake = true; } else { this.ShowMainWindow = true; this.ShowOptions = false; + this.ShowInstant = false; + this.MainViewModel.IsInstandHandBrake = false; } } @@ -126,6 +157,22 @@ namespace HandBrakeWPF.ViewModels } } + /// + /// Gets or sets a value indicating whether ShowInstant. + /// + public bool ShowInstant + { + get + { + return this.showInstant; + } + set + { + this.showInstant = value; + this.NotifyOfPropertyChange(() => this.ShowInstant); + } + } + /// /// Gets WindowTitle. /// @@ -133,7 +180,7 @@ namespace HandBrakeWPF.ViewModels { get { - return "HandBrake"; + return AppArguments.IsInstantHandBrake ? "Instant HandBrake" : "HandBrake"; } } diff --git a/win/CS/HandBrakeWPF/Views/InstantMainView.xaml b/win/CS/HandBrakeWPF/Views/InstantMainView.xaml new file mode 100644 index 000000000..29d8f1b4e --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/InstantMainView.xaml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +