diff options
-rw-r--r-- | win/C#/Functions/Common.cs | 539 | ||||
-rw-r--r-- | win/C#/Functions/Presets.cs | 12 | ||||
-rw-r--r-- | win/C#/Functions/SystemInfo.cs | 12 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 28 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 95 | ||||
-rw-r--r-- | win/C#/frmMain.resx | 6 |
6 files changed, 220 insertions, 472 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs index 19029fdb1..bead1bad0 100644 --- a/win/C#/Functions/Common.cs +++ b/win/C#/Functions/Common.cs @@ -553,79 +553,31 @@ namespace Handbrake.Functions {
// Source tab
#region source
- string source = mainWindow.text_source.Text;
- string dvdTitle = mainWindow.drp_dvdtitle.Text;
- string chapterStart = mainWindow.drop_chapterStart.Text;
- string chapterFinish = mainWindow.drop_chapterFinish.Text;
- int totalChapters = mainWindow.drop_chapterFinish.Items.Count - 1;
- string dvdChapter = "";
-
- if ((source != "") && (source.Trim() != "Click 'Browse' to continue"))
- source = " -i " + '"' + source + '"';
- else
- source = "";
+ string query = "";
- if (dvdTitle == "Automatic")
- dvdTitle = "";
- else
+ if ((mainWindow.text_source.Text != "") && (mainWindow.text_source.Text.Trim() != "Click 'Source' to continue"))
+ query = " -i " + '"' + mainWindow.text_source.Text + '"';
+
+ if (mainWindow.drp_dvdtitle.Text != "Automatic")
{
- string[] titleInfo = dvdTitle.Split(' ');
- dvdTitle = " -t " + titleInfo[0];
+ string[] titleInfo = mainWindow.drp_dvdtitle.Text.Split(' ');
+ query += " -t " + titleInfo[0];
}
- if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))
- dvdChapter = "";
- else if (chapterFinish == chapterStart)
- dvdChapter = " -c " + chapterStart;
+ if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text)
+ query += " -c " + mainWindow.drop_chapterStart.Text;
else
- dvdChapter = " -c " + chapterStart + "-" + chapterFinish;
+ query += " -c " + mainWindow.drop_chapterStart.Text + "-" + mainWindow.drop_chapterFinish.Text;
- string querySource = source + dvdTitle + dvdChapter;
#endregion
// Destination tab
#region Destination
-
- string destination = mainWindow.text_destination.Text;
- string videoEncoder = mainWindow.drp_videoEncoder.Text;
- string width = mainWindow.text_width.Text;
- string height = mainWindow.text_height.Text;
-
- if (destination != "")
- destination = " -o " + '"' + destination + '"';
-
- switch (videoEncoder)
- {
- case "MPEG-4 (FFmpeg)":
- videoEncoder = " -e ffmpeg";
- break;
- case "MPEG-4 (XviD)":
- videoEncoder = " -e xvid";
- break;
- case "H.264 (x264)":
- videoEncoder = " -e x264";
- break;
- case "VP3 (Theora)":
- videoEncoder = " -e theora";
- break;
- default:
- videoEncoder = " -e x264";
- break;
- }
-
- if (width != "")
- width = " -w " + width;
-
- if (height == "Auto")
- height = "";
- else if (height != "")
- height = " -l " + height;
-
- string queryDestination = destination + videoEncoder + width + height;
+ if (mainWindow.text_destination.Text != "")
+ query += " -o " + '"' + mainWindow.text_destination.Text + '"';
#endregion
- string query = querySource + queryDestination;
- query = query + generateTabbedComponentsQuery(mainWindow, source);
+ query += generateTabbedComponentsQuery(mainWindow, mainWindow.text_source.Text);
return query;
}
@@ -635,79 +587,32 @@ namespace Handbrake.Functions /// </summary>
/// <param name="mainWindow"></param>
/// <returns>Returns a CLI query String.</returns>
- public string GeneratePreview(frmMain mainWindow)
+ public string GeneratePreviewQuery(frmMain mainWindow)
{
// Source tab
#region source
- string source = mainWindow.text_source.Text;
- string dvdTitle = mainWindow.drp_dvdtitle.Text;
- string chapterStart = mainWindow.drop_chapterStart.Text;
- string chapterFinish = mainWindow.drop_chapterFinish.Text;
- int totalChapters = mainWindow.drop_chapterFinish.Items.Count - 1;
- string dvdChapter = "";
-
- if ((source != "") && (source.Trim() != "Click 'Browse' to continue"))
- source = " -i " + '"' + source + '"';
- else
- source = "";
+ string query = "";
- if (dvdTitle == "Automatic")
- dvdTitle = "";
- else
+ if ((mainWindow.text_source.Text != "") && (mainWindow.text_source.Text.Trim() != "Click 'Source' to continue"))
+ query = " -i " + '"' + mainWindow.text_source.Text + '"';
+
+ if (mainWindow.drp_dvdtitle.Text != "Automatic")
{
- string[] titleInfo = dvdTitle.Split(' ');
- dvdTitle = " -t " + titleInfo[0];
+ string[] titleInfo = mainWindow.drp_dvdtitle.Text.Split(' ');
+ query += " -t " + titleInfo[0];
}
- dvdChapter = " -c 2 ";
-
- string querySource = source + dvdTitle + dvdChapter;
+ query += " -c 2";
#endregion
// Destination tab
#region Destination
+ if (mainWindow.text_destination.Text != "")
+ query += " -o " + '"' + mainWindow.text_destination.Text.Replace(".m", "_sample.m").Replace(".avi", "_sample.avi").Replace(".ogm", "_sample.ogm") + '"';
- string destination = mainWindow.text_destination.Text;
- string videoEncoder = mainWindow.drp_videoEncoder.Text;
- string width = mainWindow.text_width.Text;
- string height = mainWindow.text_height.Text;
-
- if (destination != "")
- destination = " -o " + '"' + destination.Replace(".m", "_sample.m").Replace(".avi", "_sample.avi").Replace(".ogm", "_sample.ogm") + '"';
-
-
- switch (videoEncoder)
- {
- case "MPEG-4 (FFmpeg)":
- videoEncoder = " -e ffmpeg";
- break;
- case "MPEG-4 (XviD)":
- videoEncoder = " -e xvid";
- break;
- case "H.264 (x264)":
- videoEncoder = " -e x264";
- break;
- case "VP3 (Theora)":
- videoEncoder = " -e theora";
- break;
- default:
- videoEncoder = " -e x264";
- break;
- }
-
- if (width != "")
- width = " -w " + width;
-
- if (height == "Auto")
- height = "";
- else if (height != "")
- height = " -l " + height;
-
- string queryDestination = destination + videoEncoder + width + height;
#endregion
- string query = querySource + queryDestination;
- query = query + generateTabbedComponentsQuery(mainWindow, source);
+ query += generateTabbedComponentsQuery(mainWindow, mainWindow.text_source.Text);
return query;
}
@@ -803,36 +708,45 @@ namespace Handbrake.Functions // Generates part of the CLI query, for the tabbed components only.
private string generateTabbedComponentsQuery(frmMain mainWindow, string source)
{
+ string query = "";
+
// Picture Settings Tab
#region Picture Settings Tab
- string cropSetting = mainWindow.drp_crop.Text;
- string cropTop = mainWindow.text_top.Text;
- string cropBottom = mainWindow.text_bottom.Text;
- string cropLeft = mainWindow.text_left.Text;
- string cropRight = mainWindow.text_right.Text;
- string cropOut = "";
- string deInterlace_Option = mainWindow.drp_deInterlace_option.Text;
- string deinterlace = "";
- string grayscale = "";
- string pixelRatio = "";
- string vfr = "";
- string deblock = "";
- string detelecine = "";
- string lanamorphic = "";
-
-
-
- if (cropSetting == "Automatic")
- cropOut = "";
- else if (cropSetting == "No Crop")
- cropOut = " --crop 0:0:0:0 ";
- else
+ switch (mainWindow.drp_videoEncoder.Text)
+ {
+ case "MPEG-4 (FFmpeg)":
+ query += " -e ffmpeg";
+ break;
+ case "MPEG-4 (XviD)":
+ query += " -e xvid";
+ break;
+ case "H.264 (x264)":
+ query += " -e x264";
+ break;
+ case "VP3 (Theora)":
+ query += " -e theora";
+ break;
+ default:
+ query += " -e x264";
+ break;
+ }
+
+ if (mainWindow.text_width.Text != "")
+ query += " -w " + mainWindow.text_width.Text;
+
+ if (mainWindow.text_height.Text != "")
+ query += " -l " + mainWindow.text_height.Text;
+
+ string cropTop = "";
+ string cropBottom = "";
+ string cropLeft = "";
+ string cropRight = "";
+
+ if (mainWindow.drp_crop.Text == "No Crop")
+ query += " --crop 0:0:0:0 ";
+ else if (mainWindow.drp_crop.Text == "Custom")
{
- if ((mainWindow.text_top.Text == "") && (mainWindow.text_bottom.Text == "") && (mainWindow.text_left.Text == "") && (mainWindow.text_right.Text == ""))
- cropOut = "";
- else
- {
if (mainWindow.text_top.Text == "")
cropTop = "0";
if (mainWindow.text_bottom.Text == "")
@@ -842,153 +756,112 @@ namespace Handbrake.Functions if (mainWindow.text_right.Text == "")
cropRight = "0";
- cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
- }
+ query += " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
}
- switch (deInterlace_Option)
+ switch (mainWindow.drp_deInterlace_option.Text)
{
case "None":
- deinterlace = "";
+ query += "";
break;
case "Fast":
- deinterlace = " --deinterlace=\"fast\"";
+ query += " --deinterlace=\"fast\"";
break;
case "Slow":
- deinterlace = " --deinterlace=\"slow\"";
+ query += " --deinterlace=\"slow\"";
break;
case "Slower":
- deinterlace = " --deinterlace=\"slower\"";
+ query += " --deinterlace=\"slower\"";
break;
case "Slowest":
- deinterlace = " --deinterlace=\"slowest\"";
+ query += " --deinterlace=\"slowest\"";
break;
default:
- deinterlace = "";
+ query += "";
break;
}
if (mainWindow.check_grayscale.Checked)
- grayscale = " -g ";
+ query += " -g ";
if (mainWindow.drp_anamorphic.SelectedIndex == 1)
- pixelRatio = " -p ";
+ query += " -p ";
else if (mainWindow.drp_anamorphic.SelectedIndex == 2)
- pixelRatio = " -P ";
- else
- pixelRatio = " ";
-
+ query += " -P ";
if (mainWindow.check_deblock.Checked)
- deblock = " --deblock";
+ query += " --deblock";
if (mainWindow.check_detelecine.Checked)
- detelecine = " --detelecine";
+ query += " --detelecine";
if (mainWindow.check_vfr.Checked)
- vfr = " -V ";
-
-
-
- string queryPictureSettings = cropOut + deinterlace + deblock + detelecine + vfr + grayscale + pixelRatio + lanamorphic;
+ query += " -V ";
#endregion
// Video Settings Tab
#region Video Settings Tab
+ // These are output settings features
+ if (mainWindow.check_largeFile.Checked)
+ query += " -4 ";
- string videoBitrate = mainWindow.text_bitrate.Text;
- string videoFilesize = mainWindow.text_filesize.Text;
- double videoQuality = mainWindow.slider_videoQuality.Value;
- string vidQSetting = "";
- string twoPassEncoding = "";
- string videoFramerate = mainWindow.drp_videoFramerate.Text;
- string vid_frame_rate = "";
- string turboH264 = "";
- string largeFile = "";
- string denoise = "";
- string ipodAtom = "";
- string optimizeMP4 = "";
-
- if (videoBitrate != "")
- videoBitrate = " -b " + videoBitrate;
-
- if (videoFilesize != "")
- videoFilesize = " -S " + videoFilesize;
+ if (mainWindow.check_iPodAtom.Checked)
+ query += " -I ";
- // Video Quality Setting
+ if (mainWindow.check_optimiseMP4.Checked)
+ query += " -O ";
- if ((videoQuality == 0))
- vidQSetting = "";
- else
+ // Video Settings
+ if (mainWindow.text_bitrate.Text != "")
+ query += " -b " + mainWindow.text_bitrate.Text;
+
+ if (mainWindow.text_filesize.Text != "")
+ query += " -S " + mainWindow.text_filesize.Text;
+
+ // Video Quality Setting
+ double videoQuality = mainWindow.slider_videoQuality.Value;
+ if (videoQuality != 0)
{
videoQuality = videoQuality / 100;
- if (videoQuality == 1)
- {
- vidQSetting = "1.0";
- }
- vidQSetting = " -q " + videoQuality.ToString(new CultureInfo("en-US"));
+ query += " -q " + videoQuality.ToString(new CultureInfo("en-US"));
}
if (mainWindow.check_2PassEncode.Checked)
- twoPassEncoding = " -2 ";
+ query += " -2 ";
- if (videoFramerate == "Same as source")
- vid_frame_rate = "";
- else
+ if (mainWindow.drp_videoFramerate.Text != "Same as source")
{
if (!mainWindow.check_vfr.Checked)
- vid_frame_rate = " -r " + videoFramerate;
+ query += " -r " + mainWindow.drp_videoFramerate.Text;
}
if (mainWindow.check_turbo.Checked)
- turboH264 = " -T ";
+ query += " -T ";
- if (mainWindow.check_largeFile.Checked)
- largeFile = " -4 ";
switch (mainWindow.drp_deNoise.Text)
{
case "None":
- denoise = "";
+ query += "";
break;
case "Weak":
- denoise = " --denoise=\"weak\"";
+ query += " --denoise=\"weak\"";
break;
case "Medium":
- denoise = " --denoise=\"medium\"";
+ query += " --denoise=\"medium\"";
break;
case "Strong":
- denoise = " --denoise=\"strong\"";
+ query += " --denoise=\"strong\"";
break;
default:
- denoise = "";
+ query += "";
break;
}
-
- if (mainWindow.check_iPodAtom.Checked)
- ipodAtom = " -I ";
-
- if (mainWindow.check_optimiseMP4.Checked)
- optimizeMP4 = " -O ";
-
-
- string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + twoPassEncoding + vid_frame_rate + turboH264 + ipodAtom + optimizeMP4 + largeFile + denoise;
#endregion
// Audio Settings Tab
#region Audio Settings Tab
-
- // Query
- string tracks = "";
- string aencoder = "";
- string audioBitrate = "";
- string audioSampleRate = "";
- string Mixdown = "";
- string drc = "";
- string subScan = "";
- string forced = "";
-
// Track 1
string track1 = mainWindow.drp_track1Audio.Text;
string aencoder1 = mainWindow.drp_audenc_1.Text;
@@ -1026,100 +899,89 @@ namespace Handbrake.Functions // Audio Track Selections
//
if (track1 == "Automatic")
- tracks = " -a 1";
- else if (track1 == "")
- tracks = "";
- else if (track1 == "None")
- tracks = "";
- else
+ query += " -a 1";
+ else if (track1 != "None")
{
string[] tempSub = track1.Split(' ');
- tracks = " -a " + tempSub[0];
+ query += " -a " + tempSub[0];
}
if (track2 != "None")
{
string[] tempSub;
tempSub = track2.Split(' ');
- if (tracks == "")
- tracks = " -a none," + tempSub[0];
+
+ if (track1 == "None")
+ query += " -a none," + tempSub[0];
else
- tracks = tracks + "," + tempSub[0];
+ query += "," + tempSub[0];
}
if (track3 != "None")
{
string[] tempSub;
tempSub = track3.Split(' ');
- tracks = tracks + "," + tempSub[0];
+ query += "," + tempSub[0];
}
if (track4 != "None")
{
string[] tempSub;
tempSub = track4.Split(' ');
- tracks = tracks + "," + tempSub[0];
+ query += "," + tempSub[0];
}
//
// Audio Encoder
//
if (aencoder1 != "")
- aencoder = " -E " + getAudioEncoder(aencoder1);
+ query += " -E " + getAudioEncoder(aencoder1);
if (aencoder2 != "")
{
- if (aencoder == "")
- aencoder = " -E faac," + getAudioEncoder(aencoder2);
+ if (aencoder1 == "")
+ query += " -E faac," + getAudioEncoder(aencoder2);
else
- aencoder = aencoder + "," + getAudioEncoder(aencoder2);
+ query += "," + getAudioEncoder(aencoder2);
}
if (aencoder3 != "")
- {
- aencoder = aencoder + "," + getAudioEncoder(aencoder3);
- }
+ query += "," + getAudioEncoder(aencoder3);
if (aencoder4 != "")
- {
- aencoder = aencoder + "," + getAudioEncoder(aencoder4);
- }
+ query += "," + getAudioEncoder(aencoder4);
//
// Audio Bitrate Selections
//
if (audioBitrate1 != "")
- audioBitrate = " -B " + audioBitrate1;
+ query += " -B " + audioBitrate1;
if (audioBitrate2 != "")
{
- if (audioBitrate == "")
- audioBitrate = " -B 160," + audioBitrate2;
+ if (audioBitrate1 == "")
+ query += " -B 160," + audioBitrate2;
else
- audioBitrate = audioBitrate + "," + audioBitrate2;
+ query += "," + audioBitrate2;
}
if (audioBitrate3 != "")
- {
- audioBitrate = audioBitrate + "," + audioBitrate3;
- }
+ query += "," + audioBitrate3;
if (audioBitrate4 != "")
- {
- audioBitrate = audioBitrate + "," + audioBitrate4;
- }
+ query += "," + audioBitrate4;
- //Audio Sample Rate - audioSampleRate
+ //Audio Sample Rate - audioSampleRate
if (audioSampleRate1 != "")
- audioSampleRate = " -R " + audioSampleRate1.Replace("Auto", "0");
+ query += " -R " + audioSampleRate1.Replace("Auto", "0");
if (audioSampleRate2 != "")
{
- if (audioSampleRate == "")
- audioSampleRate = " -R 0," + audioSampleRate2.Replace("Auto", "0");
+ if (audioSampleRate1 == "")
+ query += " -R 0," + audioSampleRate2.Replace("Auto", "0");
else
- audioSampleRate = audioSampleRate + "," + audioSampleRate2.Replace("Auto", "0");
+ query += "," + audioSampleRate2.Replace("Auto", "0");
}
else
{
@@ -1128,48 +990,36 @@ namespace Handbrake.Functions if ((track2 != "") && (track2 != "None"))
{
- if (audioSampleRate == "")
- audioSampleRate = " -R 0,0";
+ if (audioSampleRate1 == "")
+ query += " -R 0,0";
else
- audioSampleRate = audioSampleRate + ",0";
+ query += ",0";
}
-
}
if (audioSampleRate3 != "")
- {
- audioSampleRate = audioSampleRate + "," + audioSampleRate3.Replace("Auto", "0");
- }
+ query += "," + audioSampleRate3.Replace("Auto", "0");
if (audioSampleRate4 != "")
- {
- audioSampleRate = audioSampleRate + "," + audioSampleRate4.Replace("Auto", "0");
- }
+ query += "," + audioSampleRate4.Replace("Auto", "0");
//
// Audio Mixdown Selections
//
- if ((Mixdown1 != "") && (Mixdown1 != "Automatic"))
- Mixdown = " -6 " + getMixDown(Mixdown1);
+ if (Mixdown1 != "")
+ query += " -6 " + getMixDown(Mixdown1);
+ else
+ query += " -6 dpl2";
- if ((Mixdown2 != "") && (Mixdown2 != "Automatic"))
- {
- if (Mixdown != "")
- Mixdown = Mixdown + "," + getMixDown(Mixdown2);
- }
+ if (Mixdown2 != "" && track2 != "None")
+ query += "," + getMixDown(Mixdown2);
- if ((Mixdown3 != "") && (Mixdown3 != "Automatic"))
- {
- if (Mixdown != "")
- Mixdown = Mixdown + "," + getMixDown(Mixdown3);
- }
+ if (Mixdown3 != "" && track3 != "None" && track2 != "None")
+ query += "," + getMixDown(Mixdown3);
- if ((Mixdown4 != "") && (Mixdown4 != "Automatic"))
- {
- if (Mixdown != "")
- Mixdown = Mixdown + "," + getMixDown(Mixdown4);
- }
+ if (Mixdown4 != "" && track4 != "None" && track3 != "None")
+ query += "," + getMixDown(Mixdown4);
//
@@ -1181,64 +1031,50 @@ namespace Handbrake.Functions value++;
if (value > 1.0)
- drc = " -D " + value;
+ query += " -D " + value;
+ else
+ query += " -D 1";
value = mainWindow.trackBar2.Value / 10.0;
value++;
- if (drc2 != "0")
- {
- if (drc == "")
- drc = " -D 1," + value;
- else
- drc = drc + "," + value;
- }
+ if (track2 != "None" && drc2 != "0")
+ query += "," + value;
+ else if (track2 != "None" && drc2 == "0")
+ query += ",1";
value = mainWindow.trackBar3.Value / 10.0;
value++;
- if (drc3 != "0")
- {
- drc = drc + "," + value;
- }
+ if (track3 != "None" && drc3 != "0")
+ query += "," + value;
+ else if (track3 != "None" && drc3 == "0")
+ query += ",1";
value = mainWindow.trackBar4.Value / 10.0;
value++;
- if (drc4 != "0")
- {
- drc = drc + "," + value;
- }
-
+ if (track4 != "None" && drc4 != "0")
+ query += "," + value;
+ else if (track4 != "None" && drc4 == "0")
+ query += ",1";
// Subtitles
string subtitles = mainWindow.drp_subtitle.Text;
- if (subtitles == "None")
- subtitles = "";
- else if (subtitles == "")
- subtitles = "";
- else if (subtitles == "Autoselect")
- {
- subScan = " -U ";
- subtitles = "";
- }
- else
+ if (subtitles == "Autoselect")
+ query += " -U ";
+ else if (subtitles != "" && subtitles != "None")
{
string[] tempSub;
tempSub = subtitles.Split(' ');
- subtitles = " -s " + tempSub[0];
+ query += " -s " + tempSub[0];
}
if (mainWindow.check_forced.Checked)
- forced = " -F ";
-
-
- string queryAudioSettings = tracks + aencoder + audioBitrate + audioSampleRate + Mixdown + drc + subScan + subtitles + forced;
+ query += " -F ";
#endregion
// Chapter Markers Tab
#region Chapter Markers
- string ChapterMarkers = "";
-
// Attach Source name and dvd title to the start of the chapters.csv filename.
// This is for the queue. It allows different chapter name files for each title.
string source_name = mainWindow.text_source.Text;
@@ -1252,7 +1088,6 @@ namespace Handbrake.Functions if (mainWindow.Check_ChapterMarkers.Checked)
{
-
if ((source_name.Trim().Replace("-i ", "") != "Click 'Browse' to continue") && (source_name.Trim().Replace("-i ", "") != ""))
{
if (source_title != "Automatic")
@@ -1262,11 +1097,9 @@ namespace Handbrake.Functions Boolean saveCSV = chapterCSVSave(mainWindow, path);
if (saveCSV == false)
- ChapterMarkers = " -m ";
+ query += " -m ";
else
- {
- ChapterMarkers = " --markers=" + "\"" + path + "\"";
- }
+ query += " --markers=" + "\"" + path + "\"";
}
else
{
@@ -1275,55 +1108,35 @@ namespace Handbrake.Functions Boolean saveCSV = chapterCSVSave(mainWindow, path);
if (saveCSV == false)
- ChapterMarkers = " -m ";
+ query += " -m ";
else
- {
- ChapterMarkers = " --markers=" + "\"" + path + "\"";
- }
+ query += " --markers=" + "\"" + path + "\"";
}
}
else
{
string path = Path.Combine(Path.GetTempPath(), "chapters.csv");
- ChapterMarkers = " --markers=" + "\"" + path + "\"";
+ query += " --markers=" + "\"" + path + "\"";
}
}
-
- string chapter_markers = ChapterMarkers;
#endregion
// H264 Tab
#region H264 Tab
-
- string h264Advanced = mainWindow.rtf_x264Query.Text;
-
- if ((h264Advanced == ""))
- h264Advanced = "";
- else
- h264Advanced = " -x " + h264Advanced;
-
-
- string h264Settings = h264Advanced;
+ if (mainWindow.rtf_x264Query.Text != "")
+ query += " -x " + mainWindow.rtf_x264Query.Text;
#endregion
// Other
#region Processors / Other
-
string processors = Properties.Settings.Default.Processors;
- // Number of Processors Handler
+ if (processors != "Automatic")
+ query += " -C " + processors + " ";
- if (processors == "Automatic")
- processors = "";
- else
- processors = " -C " + processors + " ";
-
-
- string queryAdvancedSettings = processors;
-
- string verbose = " -v ";
+ query += " -v ";
#endregion
- return queryPictureSettings + queryVideoSettings + h264Settings + queryAudioSettings + ChapterMarkers + queryAdvancedSettings + verbose;
+ return query;
}
// This function saves the data in the chapters tab, dataGridView into a CSV file called chapters.csv
@@ -1361,7 +1174,7 @@ namespace Handbrake.Functions switch (selectedAudio)
{
case "Automatic":
- return "";
+ return "dpl2";
case "Mono":
return "mono";
case "Stereo":
@@ -1373,7 +1186,7 @@ namespace Handbrake.Functions case "6 Channel Discrete":
return "6ch";
default:
- return "";
+ return "dpl2";
}
}
@@ -1396,4 +1209,4 @@ namespace Handbrake.Functions }
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Functions/Presets.cs b/win/C#/Functions/Presets.cs index dda7f12b4..2e725c52d 100644 --- a/win/C#/Functions/Presets.cs +++ b/win/C#/Functions/Presets.cs @@ -87,18 +87,6 @@ namespace Handbrake.Functions }
/// <summary>
- /// Count the number of presets there are.
- /// </summary>
- /// <returns>Integer</returns>
- public int count()
- {
- int c = presets.Count;
- int d = user_presets.Count;
-
- return c + d;
- }
-
- /// <summary>
/// Get an Arraylist of all the preset names.
/// Includes both built in and user presets.
/// </summary>
diff --git a/win/C#/Functions/SystemInfo.cs b/win/C#/Functions/SystemInfo.cs index 0b7457324..c081e4f81 100644 --- a/win/C#/Functions/SystemInfo.cs +++ b/win/C#/Functions/SystemInfo.cs @@ -1,17 +1,5 @@ using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using System.Net;
-using System.IO;
-using System.Diagnostics;
-using System.Threading;
using System.Runtime.InteropServices;
-using System.Globalization;
namespace Handbrake.Functions
{
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index bea92357d..5994cc929 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -38,7 +38,7 @@ namespace Handbrake System.Windows.Forms.Label Label38;
System.Windows.Forms.ContextMenuStrip notifyIconMenu;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();
this.File_Save = new System.Windows.Forms.SaveFileDialog();
@@ -579,7 +579,7 @@ namespace Handbrake this.drp_audmix_1.TabIndex = 7;
this.drp_audmix_1.Text = "Automatic";
this.ToolTip.SetToolTip(this.drp_audmix_1, "Please note: Some options require a 5.1 audio channel to be selected");
- this.drp_audmix_1.SelectedIndexChanged += new System.EventHandler(this.drp_audioMixDown_SelectedIndexChanged);
+ this.drp_audmix_1.SelectedIndexChanged += new System.EventHandler(this.drp_audmix_1_SelectedIndexChanged);
//
// text_height
//
@@ -649,9 +649,9 @@ namespace Handbrake //
// number
//
- dataGridViewCellStyle1.Format = "N0";
- dataGridViewCellStyle1.NullValue = null;
- this.number.DefaultCellStyle = dataGridViewCellStyle1;
+ dataGridViewCellStyle2.Format = "N0";
+ dataGridViewCellStyle2.NullValue = null;
+ this.number.DefaultCellStyle = dataGridViewCellStyle2;
this.number.HeaderText = "Chapter Number";
this.number.MaxInputLength = 3;
this.number.Name = "number";
@@ -1184,7 +1184,7 @@ namespace Handbrake this.mnu_user_guide.Name = "mnu_user_guide";
this.mnu_user_guide.Size = new System.Drawing.Size(215, 22);
this.mnu_user_guide.Text = "HandBrake User Guide";
- this.mnu_user_guide.Click += new System.EventHandler(this.mnu_user_guide_Click_1);
+ this.mnu_user_guide.Click += new System.EventHandler(this.mnu_user_guide_Click);
//
// mnu_handbrake_home
//
@@ -1258,7 +1258,7 @@ namespace Handbrake this.GroupBox1.Location = new System.Drawing.Point(10, 10);
this.GroupBox1.Name = "GroupBox1";
this.GroupBox1.Size = new System.Drawing.Size(705, 87);
- this.GroupBox1.TabIndex = 1;
+ this.GroupBox1.TabIndex = 0;
this.GroupBox1.TabStop = false;
this.GroupBox1.Text = "Source";
//
@@ -2241,7 +2241,7 @@ namespace Handbrake this.advancedOptions.Name = "advancedOptions";
this.advancedOptions.SelectedIndex = 0;
this.advancedOptions.Size = new System.Drawing.Size(705, 328);
- this.advancedOptions.TabIndex = 5;
+ this.advancedOptions.TabIndex = 1;
this.advancedOptions.TabStop = false;
//
// tab_chapters
@@ -2325,7 +2325,7 @@ namespace Handbrake //
// btn_reset
//
- this.btn_reset.Location = new System.Drawing.Point(277, 224);
+ this.btn_reset.Location = new System.Drawing.Point(13, 224);
this.btn_reset.Name = "btn_reset";
this.btn_reset.Size = new System.Drawing.Size(75, 23);
this.btn_reset.TabIndex = 41;
@@ -2694,7 +2694,7 @@ namespace Handbrake this.check_pyrmidalBFrames.AutoSize = true;
this.check_pyrmidalBFrames.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.check_pyrmidalBFrames.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.check_pyrmidalBFrames.Location = new System.Drawing.Point(47, 210);
+ this.check_pyrmidalBFrames.Location = new System.Drawing.Point(47, 198);
this.check_pyrmidalBFrames.Name = "check_pyrmidalBFrames";
this.check_pyrmidalBFrames.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.check_pyrmidalBFrames.Size = new System.Drawing.Size(121, 16);
@@ -2709,7 +2709,7 @@ namespace Handbrake this.check_BidirectionalRefinement.AutoSize = true;
this.check_BidirectionalRefinement.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.check_BidirectionalRefinement.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.check_BidirectionalRefinement.Location = new System.Drawing.Point(21, 188);
+ this.check_BidirectionalRefinement.Location = new System.Drawing.Point(21, 180);
this.check_BidirectionalRefinement.Name = "check_BidirectionalRefinement";
this.check_BidirectionalRefinement.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.check_BidirectionalRefinement.Size = new System.Drawing.Size(147, 16);
@@ -2724,7 +2724,7 @@ namespace Handbrake this.check_bFrameRateDistortion.AutoSize = true;
this.check_bFrameRateDistortion.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.check_bFrameRateDistortion.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.check_bFrameRateDistortion.Location = new System.Drawing.Point(20, 166);
+ this.check_bFrameRateDistortion.Location = new System.Drawing.Point(20, 162);
this.check_bFrameRateDistortion.Name = "check_bFrameRateDistortion";
this.check_bFrameRateDistortion.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.check_bFrameRateDistortion.Size = new System.Drawing.Size(147, 16);
@@ -3009,7 +3009,7 @@ namespace Handbrake this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.toolStrip1.Size = new System.Drawing.Size(938, 39);
- this.toolStrip1.TabIndex = 0;
+ this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
//
// btn_source
@@ -3183,7 +3183,7 @@ namespace Handbrake this.splitContainer1.Panel2.Controls.Add(this.groupBox2);
this.splitContainer1.Size = new System.Drawing.Size(938, 556);
this.splitContainer1.SplitterDistance = 723;
- this.splitContainer1.TabIndex = 12;
+ this.splitContainer1.TabIndex = 0;
//
// frmMain
//
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 504ca4443..4c533ea43 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -49,10 +49,6 @@ namespace Handbrake lblStatus.Location = new Point(10, 280);
splash.Controls.Add(lblStatus);
- //Fire a thread to wait for 2 seconds. The splash screen will exit when the time expires
- Thread timer = new Thread(splashTimer);
- timer.Start();
-
InitializeComponent();
// Update the users config file with the CLI version data.
@@ -66,8 +62,13 @@ namespace Handbrake Properties.Settings.Default.hb_build = int.Parse(x[1].ToString());
Properties.Settings.Default.hb_version = x[0].ToString();
}
- catch (Exception) { /* Do Nothing */ }
+ catch (Exception)
+ {
+ Properties.Settings.Default.hb_build = 0;
+ Properties.Settings.Default.hb_version = "0";
+ }
}
+ Thread.Sleep(100);
// show the form, but leave disabled until preloading is complete then show the main form
this.Enabled = false;
@@ -99,17 +100,12 @@ namespace Handbrake if (Properties.Settings.Default.tooltipEnable == "Checked")
ToolTip.Active = true;
lbl_encode.Text = "";
- Thread.Sleep(400);
-
+ Thread.Sleep(100);
//Finished Loading
lblStatus.Text = "Loading Complete!";
Application.DoEvents();
- Thread.Sleep(200);
-
- // Wait until splash screen is done
- while (timer.IsAlive)
- { Thread.Sleep(100); }
+ Thread.Sleep(100);
//Close the splash screen
splash.Close();
@@ -119,7 +115,7 @@ namespace Handbrake this.Enabled = true;
// Some event Handlers. Used for minimize to taskbar
- this.Resize += new EventHandler(frmMain_Resize);
+ this.Resize += new EventHandler(frmMain_Resize);
}
// Startup Functions
@@ -140,23 +136,11 @@ namespace Handbrake updateWindow.Show();
}
}
- catch (Exception)
- {
- // Don't want to have an exception messagebox displayed behind the splash screen,
- // So, exception is ignored. Lets hope there are no bugs here :)
- }
- }
- private void splashTimer(object sender)
- {
- Thread.Sleep(1000); //sit for 1 seconds then exit
- }
- private void showSplash(object sender)
- {
- Form splash = new frmSplashScreen();
- splash.Show();
+ catch (Exception) { /* Do Nothing*/ }
}
private void setupH264Panel()
{
+ // Set the default settings of the x264 panel
drop_bFrames.Text = "Default (0)";
drop_refFrames.Text = "Default (1)";
drop_subpixelMotionEstimation.Text = "Default (4)";
@@ -171,17 +155,14 @@ namespace Handbrake }
private void loadUserDefaults()
{
+ // Try to load the users default settings.
string userDefaults = Properties.Settings.Default.defaultUserSettings;
try
{
- // Send the query from the file to the Query Parser class Then load the preset
Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);
hb_common_func.presetLoader(this, presetQuery, "User Defaults ");
}
- catch (Exception)
- {
- // Do Nothing. We don't want an error appearing behind the splash screen.
- }
+ catch (Exception) { /* Do Nothing */ }
}
#endregion
@@ -189,7 +170,6 @@ namespace Handbrake // The Applications Main Menu *****************************************
#region File Menu
-
private void mnu_open_Click(object sender, EventArgs e)
{
string filename;
@@ -224,11 +204,9 @@ namespace Handbrake {
Application.Exit();
}
-
#endregion
#region Tools Menu
-
private void mnu_encode_Click(object sender, EventArgs e)
{
queueWindow.setQueue(encodeQueue);
@@ -249,11 +227,9 @@ namespace Handbrake Form Options = new frmOptions(this);
Options.ShowDialog();
}
-
#endregion
#region Presets Menu
-
private void mnu_presetReset_Click(object sender, EventArgs e)
{
hb_common_func.grabCLIPresets();
@@ -287,12 +263,11 @@ namespace Handbrake #endregion
#region Help Menu
-
private void mnu_handbrake_forums_Click(object sender, EventArgs e)
{
Process.Start("http://forum.handbrake.fr/");
}
- private void mnu_user_guide_Click_1(object sender, EventArgs e)
+ private void mnu_user_guide_Click(object sender, EventArgs e)
{
Process.Start("http://trac.handbrake.fr/wiki/HandBrakeGuide");
}
@@ -316,7 +291,6 @@ namespace Handbrake Form About = new frmAbout();
About.ShowDialog();
}
-
#endregion
// MainWindow Components, Actions and Functions ***********************
@@ -354,7 +328,7 @@ namespace Handbrake btn_start.Text = "Stop";
btn_start.Image = Properties.Resources.stop;
}
-
+
}
private void btn_add2Queue_Click(object sender, EventArgs e)
@@ -898,7 +872,7 @@ namespace Handbrake trackBar2.Enabled = true;
drp_audbit_2.Text = "160";
drp_audenc_2.Text = "AAC";
- drp_audsr_2.Text = "48";
+ drp_audsr_2.Text = "Auto";
drp_audmix_2.Text = "Automatic";
// Enable the 3rd Track.
@@ -942,7 +916,7 @@ namespace Handbrake trackBar3.Enabled = true;
drp_audbit_3.Text = "160";
drp_audenc_3.Text = "AAC";
- drp_audsr_3.Text = "48";
+ drp_audsr_3.Text = "Auto";
drp_audmix_3.Text = "Automatic";
// Enable the 4th Track.
@@ -978,12 +952,12 @@ namespace Handbrake trackBar4.Enabled = true;
drp_audbit_4.Text = "160";
drp_audenc_4.Text = "AAC";
- drp_audsr_4.Text = "48";
+ drp_audsr_4.Text = "Auto";
drp_audmix_4.Text = "Automatic";
}
}
- private void drp_audioMixDown_SelectedIndexChanged(object sender, EventArgs e)
+ private void drp_audmix_1_SelectedIndexChanged(object sender, EventArgs e)
{
if ((drp_audenc_1.Text == "AAC") && (drp_audmix_1.Text == "6 Channel Discrete"))
setBitrateSelections384(drp_audbit_1);
@@ -1361,7 +1335,7 @@ namespace Handbrake }
private void check_Cabac_CheckedChanged(object sender, EventArgs e)
{
-
+
x264PanelFunctions.on_x264_WidgetChange("cabac", this);
}
@@ -1456,7 +1430,6 @@ namespace Handbrake // Chapter Selection Duration calculation
public void calculateDuration()
{
-
int start_chapter;
int end_chapter;
TimeSpan Duration = TimeSpan.FromSeconds(0.0);
@@ -1479,10 +1452,7 @@ namespace Handbrake }
}
}
- catch (Exception)
- {
- // Don't do anything
- }
+ catch (Exception) { /* Don't do anything */ }
// Set the Duration
lbl_duration.Text = Duration.ToString();
@@ -1786,17 +1756,10 @@ namespace Handbrake // Preset system functions
private void loadNormalPreset()
{
- // Select the "Normal" preset if it exists.
- int normal = -1;
foreach (TreeNode treenode in treeView_presets.Nodes)
{
if (treenode.Text.ToString().Equals("Normal"))
- normal = treenode.Index;
- }
- if (normal != -1)
- {
- TreeNode np = treeView_presets.Nodes[normal];
- treeView_presets.SelectedNode = np;
+ treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index];
}
}
public void loadPresetPanel()
@@ -1860,7 +1823,7 @@ namespace Handbrake #endregion
- #region Encoding and Queue
+ #region Encoding
// Declarations
private delegate void UpdateUIHandler();
@@ -1870,15 +1833,11 @@ namespace Handbrake {
// Make sure we are not already encoding and if we are then display an error.
if (hbProc != null)
- {
hbProc.CloseMainWindow();
- }
else
{
hbProc = cliObj.runCli(this, (string)state);
-
hbProc.WaitForExit();
-
setEncodeLabelFinished();
hbProc = null;
@@ -1914,7 +1873,7 @@ namespace Handbrake #endregion
- #region Taskbar
+ #region Taskbar Tray Icon
private void frmMain_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
@@ -1925,11 +1884,8 @@ namespace Handbrake this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
- {
notifyIcon.Visible = false;
- }
}
-
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Visible = true;
@@ -1937,12 +1893,10 @@ namespace Handbrake this.WindowState = FormWindowState.Normal;
notifyIcon.Visible = false;
}
-
private void btn_minimize_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
-
private void btn_restore_Click(object sender, EventArgs e)
{
this.Visible = true;
@@ -1950,7 +1904,6 @@ namespace Handbrake this.WindowState = FormWindowState.Normal;
notifyIcon.Visible = false;
}
-
#endregion
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 1b5323eb3..d0c9f18a9 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -155,6 +155,12 @@ Make sure you have selected a "Title" from the "Source" box above otherwise the list will not be populated with the correct amount of chapters.
Note: Do not change any of the chapter numbers!</value>
</data>
+ <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
<metadata name="DVD_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>223, 15</value>
</metadata>
|