summaryrefslogtreecommitdiffstats
path: root/win/C#/frmPreview.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-04-12 20:10:47 +0000
committersr55 <[email protected]>2009-04-12 20:10:47 +0000
commit5680b256e398c3c4c28c36e479e8983284b0a340 (patch)
treefc270d846f87a8d20ce9b7ee264a637e1b99fb7a /win/C#/frmPreview.cs
parent7c54b2bdfdcfa132eed627f8d1a4d02bd888c3e7 (diff)
WinGui:
- Improvements to the preview window design. - Code tweaks to make it less crash / error prone (QT Control) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2320 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmPreview.cs')
-rw-r--r--win/C#/frmPreview.cs49
1 files changed, 36 insertions, 13 deletions
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs
index e5ebd21f6..4591b3d6d 100644
--- a/win/C#/frmPreview.cs
+++ b/win/C#/frmPreview.cs
@@ -4,6 +4,8 @@ using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
+using AxQTOControlLib;
+using QTOControlLib;
using QTOLibrary;
namespace Handbrake
@@ -36,18 +38,42 @@ namespace Handbrake
cb_preview.SelectedIndex = 0;
cb_duration.SelectedIndex = 1;
}
-
+
#region Encode Sample
private void btn_playVLC_Click(object sender, EventArgs e)
{
+ lbl_status.Visible = true;
+ try
+ {
+ QTControl.URL = "";
+ if (File.Exists(currently_playing))
+ File.Delete(currently_playing);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(this, "Unable to delete previous preview file. You may need to restart the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (VLC) ...";
String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
- ThreadPool.QueueUserWorkItem(procMonitor, query);
+ ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void btn_playQT_Click(object sender, EventArgs e)
{
+ lbl_status.Visible = true;
+ try
+ {
+ QTControl.URL = "";
+ if (File.Exists(currently_playing))
+ File.Delete(currently_playing);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(this, "Unable to delete previous preview file. You may need to restart the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (QT) ...";
@@ -92,9 +118,9 @@ namespace Handbrake
// Play back in QT or VLC
if (playerSelection == "QT")
play();
- else
+ else
playVLC();
-
+
lbl_status.Text = "";
}
catch (Exception exc)
@@ -113,6 +139,7 @@ namespace Handbrake
{
player = new Thread(OpenMovie) { IsBackground = true };
player.Start();
+ lbl_status.Visible = false;
}
/// <summary>
@@ -138,6 +165,7 @@ namespace Handbrake
else
MessageBox.Show(this, "Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
+ lbl_status.Visible = false;
}
/// <summary>
@@ -153,18 +181,13 @@ namespace Handbrake
BeginInvoke(new UpdateUIHandler(OpenMovie));
return;
}
+ QTControl.Sizing = QTSizingModeEnum.qtControlFitsMovie;
QTControl.URL = currently_playing;
- QTControl.Width = QTControl.Movie.Width;
- QTControl.Height = QTControl.Movie.Height;
- // The initial control size is 64,64. If we do not reload the clip here
- // it'll scale the video from 64,64.
- // Unsure why as it correctly resizes the control to the movies actual size.
- QTControl.URL = currently_playing;
- QTControl.SetScale(0);
+ QTControl.Sizing = QTSizingModeEnum.qtMovieFitsControl;
QTControl.Show();
- this.Width = QTControl.Width + 5;
- this.Height = QTControl.Height + 90;
+ this.ClientSize = QTControl.Size;
+ this.Height += 25;
}
catch (COMException ex)
{