summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-01-31 14:28:23 +0000
committersr55 <[email protected]>2010-01-31 14:28:23 +0000
commit138ea1180443c3b73b81e47da016a54bf133f133 (patch)
treec1ef697788b661d597a8e696af73e150361b6b71 /win/C#
parentcc9508040bff9c2277be1255c4d91ea19f13e665 (diff)
WinGui:
- Refacotring Code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3091 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Changelog.html107
-rw-r--r--win/C#/Controls/AudioPanel.cs143
-rw-r--r--win/C#/Functions/Main.cs23
-rw-r--r--win/C#/Functions/PresetLoader.cs17
-rw-r--r--win/C#/HandBrakeCS.csproj5
-rw-r--r--win/C#/Model/DriveInformation.cs21
-rw-r--r--win/C#/Model/SourceType.cs31
-rw-r--r--win/C#/frmMain.cs104
8 files changed, 222 insertions, 229 deletions
diff --git a/win/C#/Changelog.html b/win/C#/Changelog.html
deleted file mode 100644
index 000b94598..000000000
--- a/win/C#/Changelog.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>ChangeLog</title>
-</head>
-
-<body>
-Windows Platform Specific Changlog.<br />
-
- <h2>Changes Since Snapshot 2 - SVN2773</h2> <!-- Snapshot 3 (upcoming) -->
-
- <h4>New Features</h4>
- None <br />
-
- <h4>Minor Improvements / Changes</h4>
- - Updated Growl to 2.0.0.20 from 2.0.0.19<br />
- - Added 2 new options. "Growl when queue completes" and "Growl when encode completes"<br />
- - Added 1 new option. "Disable Resolution Calculation for "None" and "Custom" modes."<br />
- - Removed "Enable DVD drive detection..." and "Load my default preset" preferences<br />
- - Set m4v as default enabled.<br />
-
- <h4>Fixed</h4>
- - Several issues with Picture Settings panel related to aspect ration and resolution calculation. <br />
- - Issue where file extension could be mp4 when chapters is enabled. Problem in the autoname function.<br />
- - A regex error in the appcast reader and make it more robust to errors.<br />
- - Issue with the destination File box double appending the file extension<br />
- - Issue changing file format causing the audio encoder dropdown to be set to ""<br />
- - An issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />
- - A culture issue with the Video Quality slider. Should now work correctly for systems which represent floats as 1,25 instead of 1.25<br />
- - Issue with SRT filepaths not being quoted.<br />
- - An issue with 8x8dct not saving correctly in presets<br />
- - Activity log window would sometimes not display the CLI query used <br />
- - Couple issues in the Picutre Settings code <br />
-
-
- <h4>Backend / Not important changes</h4>
- - Filters dropdowns re-arranged and updated for consistancy (Off, Custom ...)
-
- <h2>Changes since Snapshot 1 - SVN2592</h2> <!-- Snapshot 2 -->
-
- <h4>New Features</h4>
- - Added support for Growl for Windows.<br />
- - Import MacGUI presets.<br />
- - External SRT supported added.<br />
- - Added new options: preferred language, "Dub Foreign language audio" and "Use Foreign language audio and Subtitles"<br />
- - Import Chapter Markers from csv file <br />
-
- <h4>Minor Improvements / Changes</h4>
- - Some UI layout changes / improvements<br />
- - Remove M4v from format dropdown and add new option "Use iPod/iTunes friendly (.m4v) file extension for MP4<br />
-
- <h4>Fixed</h4>
- - Picture Settings now works correctly (including Custom Anamorphic).<br />
- - Error message when cancelling an encode within 2 seconds of it starting.<br />
- - Quality slider resetting to 0 and other settings lost when a title change occurs.<br />
- - Fixes some scaling / quality issues with QuickTime preview.
- - Possible fix for QT not working on 64bit systems.<br />
- - Chaning the x264 Quality granularity no longer requires a restart to work correctly <br />
- - Chapter Markers tab now resets far less often. It should retain chapter names after being disabled / re-enabled <br />
-
- <h2>Changes since 0.9.3</h2> <!-- Snapshot 1 -->
-
- <h4>Major Changes</h4>
-
- - Video Preview window using QuickTime or VLC. (5 to 60 second preview clips) <br />
- - Re-designed audio tab. Now uses a List and allows for >4 audio channels.<br />
- - Improved Picture Settings tab (Uses Numeric Controls and includes Modulus based increments and resolution calculation)<br />
- - Minimise to system tray is now optional with the ability to turn off balloon tip notifications.<br />
- - Picture settings can now be stored in presets. (Optional setting)<br />
- - Built-in Presets now automatically update when a change is detected.<br />
- - Preset XML data files are now stored in the users application data folder which allows for each system account user can have their own presets.<br />
- - Users can "update" their own presets. (Rather than delete & re-create)<br />
- - Improved control over how logs are stored. Logs are now kept in the Application data folder for each user. <br />
- - The Main window and the Queue "Start/Stop" buttons are now linked. Start on the main window starts the Queue. They are no longer separate.<br />
-
- <h4>Minor Improvements / Changes</h4>
- - Resizable queue Window<br />
- - Scanning a source no longer uses a separate popup window. Scanning simply disables the main window, and displays the status much like the MacGUI<br />
- - Queue recovery now uses an XML file.<br />
- - Improvements in the Main Window.<br />
- <p style="padding-left:20px; margin:0px;">
- * Source text box no longer editable. Prevents users changing the source without a rescan.<br />
- * Minor changes in the Destination Browse dialog to improve usability.<br />
- * Design improvements. Removed smaller fonts where possible. Fixed a few design inconsistencies.<br />
- * Warn before stopping a job. Cleanly exits the CLI.<br />
- * Selecting a preset which is already selected, will reset all settings to that preset.<br />
- * Option to hide query editor tab.<br />
- * File overwrite alert for destination files<br />
- </p>
- - "Open Individual log file directory" option added to right click menu for Activity log window.<br />
- - Faster reloading of the activity log window log files.<br />
- - Ability to "Re-Add" the currently encoding job back onto the end of the queue (Allows cancellation of job for future encoding)<br />
- - Removed RAM limitation on start-up. Seems next to no-one is trying to run this on Windows 95 anymore.<br />
- - CLI status can now be displayed in-GUI instead of the CLI readout. (Experimental)<br />
- - Misc Typo's<br />
-
- <h4>Fixed</h4>
- - Source and Destination fields unpopulated on queue in certain conditions.<br />
- - Several bugs in the way x264 widgets are handled with custom x264 strings.<br />
- - Fixed a null pointer exception after scan if all presets had been deleted.<br />
- - Fixed a few issues with the Chapter Markers tab<br />
- - Fixed HandBrake GUI would Hang if the CLI stopped responding during start-up. Automatically recovers after 10 second time limit.<br />
- - Universal input. (AAC Decoding in Mp4 files, Some WMV files)<br />
- - Many other fixes<br />
-</body>
-</html>
diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs
index 73b28f3ab..a56daa3be 100644
--- a/win/C#/Controls/AudioPanel.cs
+++ b/win/C#/Controls/AudioPanel.cs
@@ -5,15 +5,23 @@
It may be used under the terms of the GNU General Public License. */
using System;
+using System.Collections;
using System.Linq;
using System.Windows.Forms;
+using Handbrake.Model;
namespace Handbrake.Controls
{
public partial class AudioPanel : UserControl
{
+ /// <summary>
+ /// The audio list has changed
+ /// </summary>
public event EventHandler AudioListChanged;
+ /// <summary>
+ /// Create a new instance of the Audio Panel
+ /// </summary>
public AudioPanel()
{
InitializeComponent();
@@ -21,6 +29,89 @@ namespace Handbrake.Controls
drp_audioSample.SelectedIndex = 1;
}
+ /// <summary>
+ /// Get the audio panel
+ /// </summary>
+ /// <returns>A listview containing the audio tracks</returns>
+ public ListView GetAudioPanel()
+ {
+ return lv_audioList;
+ }
+
+ /// <summary>
+ /// Set the File Container. This funciton is used to limit the available options for each file container.
+ /// </summary>
+ /// <param name="path"></param>
+ public void SetContainer(String path)
+ {
+ string oldval = drp_audioEncoder.Text;
+ if ((path.Contains("MP4")) || (path.Contains("M4V")))
+ {
+ drp_audioEncoder.Items.Clear();
+ drp_audioEncoder.Items.Add("AAC (faac)");
+ drp_audioEncoder.Items.Add("AC3 Passthru");
+ if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru"))
+ drp_audioEncoder.SelectedIndex = 0;
+ else
+ drp_audioEncoder.SelectedItem = oldval;
+
+ }
+ else if (path.Contains("MKV"))
+ {
+ drp_audioEncoder.Items.Clear();
+ drp_audioEncoder.Items.Add("AAC (faac)");
+ drp_audioEncoder.Items.Add("MP3 (lame)");
+ drp_audioEncoder.Items.Add("AC3 Passthru");
+ drp_audioEncoder.Items.Add("DTS Passthru");
+ drp_audioEncoder.Items.Add("Vorbis (vorbis)");
+ drp_audioEncoder.SelectedItem = oldval;
+
+ if (drp_audioEncoder.Text == string.Empty)
+ drp_audioEncoder.SelectedIndex = 0;
+ }
+
+ // Make sure the table is updated with new audio codecs
+ foreach (ListViewItem row in lv_audioList.Items)
+ {
+ if (!drp_audioEncoder.Items.Contains(row.SubItems[2].Text))
+ row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString();
+ }
+ }
+
+ /// <summary>
+ /// Checks if the settings used required the .m4v (rather than .mp4) extension
+ /// </summary>
+ /// <returns></returns>
+ public Boolean RequiresM4V()
+ {
+ return lv_audioList.Items.Cast<ListViewItem>().Any(item => item.SubItems[2].Text.Contains("AC3"));
+ }
+
+ /// <summary>
+ /// Load an arraylist of AudioTrack items into the list.
+ /// </summary>
+ /// <param name="audioTracks"></param>
+ public void LoadTracks(ArrayList audioTracks)
+ {
+ ClearAudioList();
+
+ if (audioTracks == null)
+ return;
+
+ foreach (AudioTrack track in audioTracks)
+ {
+ ListViewItem newTrack = new ListViewItem(GetNewID().ToString());
+
+ newTrack.SubItems.Add("Automatic");
+ newTrack.SubItems.Add(track.Encoder);
+ newTrack.SubItems.Add(track.MixDown);
+ newTrack.SubItems.Add(track.SampleRate);
+ newTrack.SubItems.Add(track.Encoder.Contains("AC3") ? "Auto" : track.Bitrate);
+ newTrack.SubItems.Add(track.DRC);
+ AddTrackForPreset(newTrack);
+ }
+ }
+
// Control and ListView
private void controlChanged(object sender, EventArgs e)
{
@@ -197,67 +288,22 @@ namespace Handbrake.Controls
}
drp_audioMix.SelectedIndex = 0;
}
- public ListView GetAudioPanel()
- {
- return lv_audioList;
- }
- public void SetContainer(String path)
- {
- string oldval = drp_audioEncoder.Text;
- if ((path.Contains("MP4")) || (path.Contains("M4V")))
- {
- drp_audioEncoder.Items.Clear();
- drp_audioEncoder.Items.Add("AAC (faac)");
- drp_audioEncoder.Items.Add("AC3 Passthru");
- if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru"))
- drp_audioEncoder.SelectedIndex = 0;
- else
- drp_audioEncoder.SelectedItem = oldval;
-
- }
- else if (path.Contains("MKV"))
- {
- drp_audioEncoder.Items.Clear();
- drp_audioEncoder.Items.Add("AAC (faac)");
- drp_audioEncoder.Items.Add("MP3 (lame)");
- drp_audioEncoder.Items.Add("AC3 Passthru");
- drp_audioEncoder.Items.Add("DTS Passthru");
- drp_audioEncoder.Items.Add("Vorbis (vorbis)");
- drp_audioEncoder.SelectedItem = oldval;
-
- if (drp_audioEncoder.Text == string.Empty)
- drp_audioEncoder.SelectedIndex = 0;
- }
-
- // Make sure the table is updated with new audio codecs
- foreach (ListViewItem row in lv_audioList.Items)
- {
- if (!drp_audioEncoder.Items.Contains(row.SubItems[2].Text))
- row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString();
- }
- }
- public void AddTrackForPreset(ListViewItem item)
+ private void AddTrackForPreset(ListViewItem item)
{
lv_audioList.Items.Add(item);
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
}
- public void ClearAudioList()
+ private void ClearAudioList()
{
lv_audioList.Items.Clear();
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
}
- public int GetNewID()
+ private int GetNewID()
{
return lv_audioList.Items.Count + 1;
}
- public Boolean RequiresM4V()
- {
- return lv_audioList.Items.Cast<ListViewItem>().Any(item => item.SubItems[2].Text.Contains("AC3"));
- }
-
- // Helper Functions
private void RemoveTrack()
{
// Remove the Item and reselect the control if the following conditions are met.
@@ -303,7 +349,6 @@ namespace Handbrake.Controls
lv_audioList.Focus();
}
}
-
private void ReGenerateListIDs()
{
int i = 1;
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs
index 6e66f49a2..3071cf5d0 100644
--- a/win/C#/Functions/Main.cs
+++ b/win/C#/Functions/Main.cs
@@ -14,6 +14,7 @@ using System.Xml.Serialization;
using System.Threading;
using Handbrake.EncodeQueue;
using System.Net;
+using Handbrake.Model;
namespace Handbrake.Functions
{
@@ -633,5 +634,27 @@ namespace Handbrake.Functions
};
return languageMap;
}
+
+ /// <summary>
+ /// Get a list of available DVD drives which are ready and contain DVD content.
+ /// </summary>
+ /// <returns></returns>
+ public static List<DriveInformation> GetDrives()
+ {
+ List<DriveInformation> drives = new List<DriveInformation>();
+ DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();
+ foreach (DriveInfo curDrive in theCollectionOfDrives)
+ {
+ if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady && File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
+ {
+ drives.Add(new DriveInformation
+ {
+ VolumeLabel = curDrive.VolumeLabel,
+ RootDirectory = curDrive.RootDirectory + "VIDEO_TS"
+ });
+ }
+ }
+ return drives;
+ }
}
} \ No newline at end of file
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index f42e734eb..a653f9669 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -213,22 +213,7 @@ namespace Handbrake.Functions
#endregion
#region Audio
- // Clear the audio listing
- mainWindow.AudioSettings.ClearAudioList();
-
- if (presetQuery.AudioInformation != null)
- foreach (AudioTrack track in presetQuery.AudioInformation)
- {
- ListViewItem newTrack = new ListViewItem(mainWindow.AudioSettings.GetNewID().ToString());
-
- newTrack.SubItems.Add("Automatic");
- newTrack.SubItems.Add(track.Encoder);
- newTrack.SubItems.Add(track.MixDown);
- newTrack.SubItems.Add(track.SampleRate);
- newTrack.SubItems.Add(track.Encoder.Contains("AC3") ? "Auto" : track.Bitrate);
- newTrack.SubItems.Add(track.DRC);
- mainWindow.AudioSettings.AddTrackForPreset(newTrack);
- }
+ mainWindow.AudioSettings.LoadTracks(presetQuery.AudioInformation);
#endregion
#region Other
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index f32223683..70aaa8164 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -223,9 +223,9 @@
<DependentUpon>frmActivityWindow.cs</DependentUpon>
</Compile>
<Compile Include="Model\AudioTrack.cs" />
- <Compile Include="Presets\Export.cs" />
+ <Compile Include="Model\DriveInformation.cs" />
<Compile Include="Presets\PlistPresetHandler.cs" />
- <Compile Include="Presets\preset.cs" />
+ <Compile Include="Presets\Preset.cs" />
<Compile Include="Presets\PresetsHandler.cs" />
<Compile Include="EncodeQueue\Queue.cs" />
<Compile Include="Functions\AppcastReader.cs" />
@@ -327,7 +327,6 @@
<Compile Include="EncodeQueue\Job.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="Changelog.html" />
<Content Include="handbrakepineapple.ico" />
<None Include="Resources\logo64.png" />
<None Include="Resources\logo128.png" />
diff --git a/win/C#/Model/DriveInformation.cs b/win/C#/Model/DriveInformation.cs
new file mode 100644
index 000000000..9367e7e50
--- /dev/null
+++ b/win/C#/Model/DriveInformation.cs
@@ -0,0 +1,21 @@
+/* DriveInformation.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.Model
+{
+ public class DriveInformation
+ {
+ /// <summary>
+ /// The Drive Volume Name
+ /// </summary>
+ public string VolumeLabel { get; set; }
+
+ /// <summary>
+ /// The Root Directory
+ /// </summary>
+ public string RootDirectory { get; set; }
+ }
+}
diff --git a/win/C#/Model/SourceType.cs b/win/C#/Model/SourceType.cs
new file mode 100644
index 000000000..c5a1bf417
--- /dev/null
+++ b/win/C#/Model/SourceType.cs
@@ -0,0 +1,31 @@
+/* SourceType.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.Model
+{
+ public enum SourceType
+ {
+ /// <summary>
+ /// No Source Selected
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The soruce selected is a folder
+ /// </summary>
+ Folder,
+
+ /// <summary>
+ /// The source selected is a DVD drive
+ /// </summary>
+ DvdDrive,
+
+ /// <summary>
+ /// The source selected is a Video File
+ /// </summary>
+ VideoFile
+ }
+}
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 103c28edb..4b2ddb7b7 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -14,6 +14,7 @@ using System.Diagnostics;
using System.Threading;
using Handbrake.EncodeQueue;
using Handbrake.Functions;
+using Handbrake.Model;
using Handbrake.Presets;
using Handbrake.Parsing;
@@ -92,7 +93,7 @@ namespace Handbrake
// Setup the GUI components
lblStatus.Text = "Setting up the GUI ...";
Application.DoEvents();
- loadPresetPanel(); // Load the Preset Panel
+ LoadPresetPanel(); // Load the Preset Panel
treeView_presets.ExpandAll();
lbl_encode.Text = "";
drop_mode.SelectedIndex = 0;
@@ -221,7 +222,7 @@ namespace Handbrake
this.Resize += new EventHandler(frmMain_Resize);
// Handle Encode Start / Finish / Pause
-
+
encodeQueue.QueuePauseRequested += new EventHandler(encodePaused);
encodeQueue.EncodeStarted += new EventHandler(encodeStarted);
encodeQueue.EncodeEnded += new EventHandler(encodeEnded);
@@ -320,22 +321,22 @@ namespace Handbrake
private void encodeStarted(object sender, EventArgs e)
{
lastAction = "encode";
- setEncodeStarted();
+ SetEncodeStarted();
// Experimental HBProc Process Monitoring.
if (Properties.Settings.Default.enocdeStatusInGui)
{
- Thread encodeMon = new Thread(encodeMonitorThread);
+ Thread encodeMon = new Thread(EncodeMonitorThread);
encodeMon.Start();
}
}
private void encodeEnded(object sender, EventArgs e)
{
- setEncodeFinished();
+ SetEncodeFinished();
}
private void encodePaused(object sender, EventArgs e)
{
- setEncodeFinished();
+ SetEncodeFinished();
}
#endregion
@@ -373,7 +374,7 @@ namespace Handbrake
private void mnu_presetReset_Click(object sender, EventArgs e)
{
presetHandler.UpdateBuiltInPresets();
- loadPresetPanel();
+ LoadPresetPanel();
if (treeView_presets.Nodes.Count == 0)
MessageBox.Show("Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu. \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
@@ -384,7 +385,7 @@ namespace Handbrake
private void mnu_delete_preset_Click(object sender, EventArgs e)
{
presetHandler.RemoveBuiltInPresets();
- loadPresetPanel(); // Reload the preset panel
+ LoadPresetPanel(); // Reload the preset panel
}
private void mnu_SelectDefault_Click(object sender, EventArgs e)
{
@@ -567,7 +568,7 @@ namespace Handbrake
nodeStatus.Add(node.IsExpanded);
// Now reload the preset panel
- loadPresetPanel();
+ LoadPresetPanel();
// And finally, re-expand any of the nodes if required
int i = 0;
@@ -661,7 +662,7 @@ namespace Handbrake
private void btn_source_Click(object sender, EventArgs e)
{
mnu_dvd_drive.Visible = true;
- Thread driveInfoThread = new Thread(getDriveInfoThread);
+ Thread driveInfoThread = new Thread(SetDriveSelectionMenuItem);
driveInfoThread.Start();
}
private void btn_start_Click(object sender, EventArgs e)
@@ -698,7 +699,7 @@ namespace Handbrake
}
// Update the GUI
- setEncodeFinished();
+ SetEncodeFinished();
}
}
else
@@ -756,7 +757,7 @@ namespace Handbrake
if (encodeQueue.Count > 1)
queueWindow.Show(false);
- setEncodeStarted(); // Encode is running, so setup the GUI appropriately
+ SetEncodeStarted(); // Encode is running, so setup the GUI appropriately
encodeQueue.Start(); // Start The Queue Encoding Process
lastAction = "encode"; // Set the last action to encode - Used for activity window.
}
@@ -1698,17 +1699,17 @@ namespace Handbrake
}
#endregion
- #region GUI
+ #region GUI Functions and Actions
/// <summary>
/// Set the GUI to it's finished encoding state.
/// </summary>
- private void setEncodeFinished()
+ private void SetEncodeFinished()
{
try
{
if (InvokeRequired)
{
- BeginInvoke(new UpdateWindowHandler(setEncodeFinished));
+ BeginInvoke(new UpdateWindowHandler(SetEncodeFinished));
return;
}
@@ -1734,13 +1735,13 @@ namespace Handbrake
/// <summary>
/// Set the GUI to it's started encoding state.
/// </summary>
- private void setEncodeStarted()
+ private void SetEncodeStarted()
{
try
{
if (InvokeRequired)
{
- BeginInvoke(new UpdateWindowHandler(setEncodeStarted));
+ BeginInvoke(new UpdateWindowHandler(SetEncodeStarted));
return;
}
@@ -1755,51 +1756,42 @@ namespace Handbrake
MessageBox.Show(exc.ToString());
}
}
- #endregion
- #region DVD Drive Detection
- private void getDriveInfoThread()
+ /// <summary>
+ /// Set the DVD Drive selection in the "Source" Menu
+ /// </summary>
+ private void SetDriveSelectionMenuItem()
{
try
{
if (InvokeRequired)
{
- BeginInvoke(new UpdateWindowHandler(getDriveInfoThread));
+ BeginInvoke(new UpdateWindowHandler(SetDriveSelectionMenuItem));
return;
}
- Boolean foundDrive = false;
- DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();
- foreach (DriveInfo curDrive in theCollectionOfDrives)
+ List<DriveInformation> drives = Main.GetDrives();
+
+ if (drives.Count == 0)
{
- if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady)
- {
- if (File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
- {
- this.dvdDrivePath = curDrive.RootDirectory + "VIDEO_TS";
- this.dvdDriveLabel = curDrive.VolumeLabel;
- mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";
- foundDrive = true;
- break;
- }
- }
+ mnu_dvd_drive.Text = "[No DVD Drive Ready]";
+ return;
}
- if (foundDrive == false)
- mnu_dvd_drive.Text = "[No DVD Drive Ready]";
+ this.dvdDrivePath = drives[0].RootDirectory + "VIDEO_TS";
+ this.dvdDriveLabel = drives[0].VolumeLabel;
+ mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";
}
catch (Exception)
{
mnu_dvd_drive.Text = "[No DVD Drive Ready / Found]";
}
}
- #endregion
- #region Public Methods
/// <summary>
/// Access the preset Handler and setup the preset panel.
/// </summary>
- public void loadPresetPanel()
+ private void LoadPresetPanel()
{
if (presetHandler.CheckIfPresetsAreOutOfDate())
if (!Properties.Settings.Default.presetNotification)
@@ -1855,12 +1847,15 @@ namespace Handbrake
#endregion
#region In-GUI Encode Status (Experimental)
- private void encodeMonitorThread()
+ /// <summary>
+ /// Starts a new thread to monitor and process the CLI encode status
+ /// </summary>
+ private void EncodeMonitorThread()
{
try
{
Parser encode = new Parser(encodeQueue.HbProcess.StandardOutput.BaseStream);
- encode.OnEncodeProgress += encodeOnEncodeProgress;
+ encode.OnEncodeProgress += EncodeOnEncodeProgress;
while (!encode.EndOfStream)
encode.readEncodeStatus();
}
@@ -1869,11 +1864,22 @@ namespace Handbrake
MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
- private void encodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
+
+ /// <summary>
+ /// Displays the Encode status in the GUI
+ /// </summary>
+ /// <param name="Sender"></param>
+ /// <param name="CurrentTask"></param>
+ /// <param name="TaskCount"></param>
+ /// <param name="PercentComplete"></param>
+ /// <param name="CurrentFps"></param>
+ /// <param name="AverageFps"></param>
+ /// <param name="TimeRemaining"></param>
+ private void EncodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new EncodeProgressEventHandler(encodeOnEncodeProgress),
+ this.BeginInvoke(new EncodeProgressEventHandler(EncodeOnEncodeProgress),
new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
return;
}
@@ -1881,16 +1887,6 @@ namespace Handbrake
}
#endregion
- #region enum
- private enum SourceType
- {
- None = 0,
- Folder,
- DvdDrive,
- VideoFile
- }
- #endregion
-
// This is the END of the road ****************************************
}
} \ No newline at end of file