From c8e25b9e67daf7c6902428a442ac19bf4306d5c3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 1 Mar 2015 18:10:34 +0000 Subject: [PATCH] WinGui: Dropping more legacy code and moving some more UI only code up to the UI level. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6960 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrake.ApplicationServices.csproj | 3 -- .../Model/PresetPictureSettingsMode.cs | 26 --------- .../Services/Interfaces/IHbServiceCallback.cs | 46 ---------------- .../Utilities/GeneralUtilities.cs | 33 ------------ .../Commands/CancelScanCommand.cs | 1 - win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 2 + win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs | 2 - .../Helpers/QueueRecoveryHelper.cs | 1 - .../Model/DriveInformation.cs | 2 +- .../Services/NotificationService.cs | 1 - .../HandBrakeWPF/Utilities/DriveUtilities.cs | 53 +++++++++++++++++++ .../ViewModels/AddPresetViewModel.cs | 4 -- .../HandBrakeWPF/ViewModels/MainViewModel.cs | 5 +- .../HandBrakeWPF/ViewModels/ShellViewModel.cs | 2 - .../ViewModels/StaticPreviewViewModel.cs | 1 - 15 files changed, 58 insertions(+), 124 deletions(-) delete mode 100644 win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs delete mode 100644 win/CS/HandBrake.ApplicationServices/Services/Interfaces/IHbServiceCallback.cs rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Model/DriveInformation.cs (94%) create mode 100644 win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index bb00bc266..6f2826306 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -212,7 +212,6 @@ - @@ -221,7 +220,6 @@ - @@ -230,7 +228,6 @@ - diff --git a/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs b/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs deleted file mode 100644 index 030b969e9..000000000 --- a/win/CS/HandBrake.ApplicationServices/Model/PresetPictureSettingsMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// Picture Settings Mode when adding presets -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Model -{ - using System.ComponentModel.DataAnnotations; - - /// - /// Picture Settings Mode when adding presets - /// - public enum PresetPictureSettingsMode - { - [Display(Name = "None")] - None = 0, - [Display(Name = "Custom")] - Custom = 1, - [Display(Name = "Source Max Size")] - SourceMaximum = 2, - } -} \ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IHbServiceCallback.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IHbServiceCallback.cs deleted file mode 100644 index ce95bd8b5..000000000 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IHbServiceCallback.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// HandBrake WCF Service Callbacks -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Services.Interfaces -{ - using System.ServiceModel; - - using HandBrake.ApplicationServices.Services.Encode.EventArgs; - - /// - /// HandBrake WCF Service Callbacks - /// - [ServiceContract] - public interface IHbServiceCallback - { - /// - /// The encode progress callback. - /// - /// - /// The event Args. - /// - [OperationContract(IsOneWay = true)] - void EncodeProgressCallback(EncodeProgressEventArgs eventArgs); - - /// - /// The encode completed callback. - /// - /// - /// The event Args. - /// - [OperationContract(IsOneWay = true)] - void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs); - - /// - /// The encode started callback. - /// - [OperationContract(IsOneWay = true)] - void EncodeStartedCallback(); - } -} diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs index 7a790f7f9..d74a8f72a 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs @@ -17,8 +17,6 @@ namespace HandBrake.ApplicationServices.Utilities using System.Text; using System.Windows.Forms; - using HandBrake.ApplicationServices.Model; - /// /// A Set of Static Utilites /// @@ -143,37 +141,6 @@ namespace HandBrake.ApplicationServices.Utilities return logHeader; } - /// - /// Get a list of available DVD drives which are ready and contain DVD content. - /// - /// A List of Drives with their details - public static List GetDrives() - { - var drives = new List(); - DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives(); - int id = 0; - foreach (DriveInfo curDrive in theCollectionOfDrives) - { - if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady) - { - if (Directory.Exists(curDrive.RootDirectory + "VIDEO_TS") || - Directory.Exists(curDrive.RootDirectory + "BDMV")) - { - drives.Add( - new DriveInformation - { - Id = id, - VolumeLabel = curDrive.VolumeLabel, - RootDirectory = curDrive.RootDirectory.ToString() - }); - id++; - } - } - } - - return drives; - } - /// /// Return the standard log format line of text for a given log message /// diff --git a/win/CS/HandBrakeWPF/Commands/CancelScanCommand.cs b/win/CS/HandBrakeWPF/Commands/CancelScanCommand.cs index 32a53277b..adc18ff2d 100644 --- a/win/CS/HandBrakeWPF/Commands/CancelScanCommand.cs +++ b/win/CS/HandBrakeWPF/Commands/CancelScanCommand.cs @@ -12,7 +12,6 @@ namespace HandBrakeWPF.Commands using System; using System.Windows.Input; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Services.Scan.EventArgs; using HandBrake.ApplicationServices.Services.Scan.Interfaces; diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index e44fd25d7..166d6782a 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -146,6 +146,7 @@ + @@ -164,6 +165,7 @@ + diff --git a/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs index 556cf53b4..ece44cfec 100644 --- a/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs @@ -13,8 +13,6 @@ namespace HandBrakeWPF.Helpers using Caliburn.Micro; - using HandBrake.ApplicationServices.Services.Interfaces; - using HandBrakeWPF.Services.Interfaces; /// diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs index ceb8943b8..e73251b07 100644 --- a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs @@ -19,7 +19,6 @@ namespace HandBrakeWPF.Helpers using System.Xml.Serialization; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Services.Interfaces; diff --git a/win/CS/HandBrake.ApplicationServices/Model/DriveInformation.cs b/win/CS/HandBrakeWPF/Model/DriveInformation.cs similarity index 94% rename from win/CS/HandBrake.ApplicationServices/Model/DriveInformation.cs rename to win/CS/HandBrakeWPF/Model/DriveInformation.cs index 25ff6930b..f7e966b5c 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/DriveInformation.cs +++ b/win/CS/HandBrakeWPF/Model/DriveInformation.cs @@ -7,7 +7,7 @@ // // -------------------------------------------------------------------------------------------------------------------- -namespace HandBrake.ApplicationServices.Model +namespace HandBrakeWPF.Model { /// /// Information about a DVD drive diff --git a/win/CS/HandBrakeWPF/Services/NotificationService.cs b/win/CS/HandBrakeWPF/Services/NotificationService.cs index 0f387fec3..d85a63d42 100644 --- a/win/CS/HandBrakeWPF/Services/NotificationService.cs +++ b/win/CS/HandBrakeWPF/Services/NotificationService.cs @@ -11,7 +11,6 @@ namespace HandBrakeWPF.Services { using HandBrake.ApplicationServices.Services.Encode.EventArgs; using HandBrake.ApplicationServices.Services.Encode.Interfaces; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrakeWPF.Services.Interfaces; diff --git a/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs b/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs new file mode 100644 index 000000000..d07056ef8 --- /dev/null +++ b/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs @@ -0,0 +1,53 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The drive utilities. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Utilities +{ + using System.Collections.Generic; + using System.IO; + + using HandBrakeWPF.Model; + + /// + /// The drive utilities. + /// + public class DriveUtilities + { + /// + /// Get a list of available DVD drives which are ready and contain DVD content. + /// + /// A List of Drives with their details + public static List GetDrives() + { + var drives = new List(); + DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives(); + int id = 0; + foreach (DriveInfo curDrive in theCollectionOfDrives) + { + if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady) + { + if (Directory.Exists(curDrive.RootDirectory + "VIDEO_TS") || + Directory.Exists(curDrive.RootDirectory + "BDMV")) + { + drives.Add( + new DriveInformation + { + Id = id, + VolumeLabel = curDrive.VolumeLabel, + RootDirectory = curDrive.RootDirectory.ToString() + }); + id++; + } + } + } + + return drives; + } + } +} diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 65464f3f9..189472949 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -12,10 +12,7 @@ namespace HandBrakeWPF.ViewModels using System.Collections.Generic; using System.Windows; - using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services; using HandBrake.ApplicationServices.Services.Encode.Model; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Model; using HandBrake.ApplicationServices.Utilities; using HandBrake.ApplicationServices.Interop.Model.Encoding; @@ -23,7 +20,6 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Model.Audio; using HandBrakeWPF.Model.Subtitles; using HandBrakeWPF.Properties; - using HandBrakeWPF.Services; using HandBrakeWPF.Services.Interfaces; using HandBrakeWPF.Services.Presets; using HandBrakeWPF.Services.Presets.Interfaces; diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 08662882c..9c46008f8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -26,7 +26,6 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Interfaces; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Encode.Model.Models; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Services.Scan.EventArgs; using HandBrake.ApplicationServices.Services.Scan.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Model; @@ -499,7 +498,7 @@ namespace HandBrakeWPF.ViewModels // Check if we have a Folder, if so, check if it's a DVD / Bluray drive and get the label. if (ScannedSource.ScanPath.EndsWith("\\")) { - foreach (DriveInformation item in GeneralUtilities.GetDrives()) + foreach (DriveInformation item in DriveUtilities.GetDrives()) { if (item.RootDirectory.Contains(this.ScannedSource.ScanPath.Replace("\\\\", "\\"))) { @@ -1000,7 +999,7 @@ namespace HandBrakeWPF.ViewModels if (this.showSourceSelection) { this.Drives.Clear(); - foreach (SourceMenuItem menuItem in from item in GeneralUtilities.GetDrives() + foreach (SourceMenuItem menuItem in from item in DriveUtilities.GetDrives() let driveInformation = item select new SourceMenuItem { diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index 6d4fcc84a..c85c707bd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -13,8 +13,6 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro; - using HandBrake.ApplicationServices.Services.Interfaces; - using HandBrakeWPF.Model; using HandBrakeWPF.Properties; using HandBrakeWPF.Services.Interfaces; diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index ff1b1a0c9..012a4c15b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -24,7 +24,6 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Interfaces; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Encode.Model.Models; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Model; using HandBrake.ApplicationServices.Interop.Model.Encoding; -- 2.40.0