summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Win32.cs4
-rw-r--r--win/C#/HandBrake.ApplicationServices/Init.cs6
-rw-r--r--win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs12
-rw-r--r--win/C#/HandBrake.ApplicationServices/Properties/Settings.settings3
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Encode.cs15
-rw-r--r--win/C#/HandBrake.ApplicationServices/app.config3
-rw-r--r--win/C#/Program.cs2
-rw-r--r--win/C#/frmMain.cs8
-rw-r--r--win/C#/frmOptions.cs2
9 files changed, 39 insertions, 16 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs b/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs
index 72e4d8db0..a45d7441a 100644
--- a/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs
+++ b/win/C#/HandBrake.ApplicationServices/Functions/Win32.cs
@@ -154,7 +154,7 @@ namespace HandBrake.ApplicationServices.Functions
/// <summary>
/// Prevent the system from sleeping
/// </summary>
- public void PreventSleep()
+ public static void PreventSleep()
{
SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_AWAYMODE_REQUIRED);
}
@@ -162,7 +162,7 @@ namespace HandBrake.ApplicationServices.Functions
/// <summary>
/// Allow the system to sleep.
/// </summary>
- public void AllowSleep()
+ public static void AllowSleep()
{
SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS);
}
diff --git a/win/C#/HandBrake.ApplicationServices/Init.cs b/win/C#/HandBrake.ApplicationServices/Init.cs
index 280827605..7fb0e902c 100644
--- a/win/C#/HandBrake.ApplicationServices/Init.cs
+++ b/win/C#/HandBrake.ApplicationServices/Init.cs
@@ -49,9 +49,12 @@ namespace HandBrake.ApplicationServices
/// <param name="showCliForInGuiEncodeStatus">
/// The show cli for in gui encode status.
/// </param>
+ /// <param name="preventSleep">
+ /// Prevent the system from sleeping
+ /// </param>
public static void SetupSettings(bool cli_minimized, string completionOption, bool disableDvdNav, bool enocdeStatusInGui,
bool growlEncode, bool growlQueue, string processPriority, string saveLogPath, bool saveLogToSpecifiedPath,
- bool saveLogWithVideo, bool showCliForInGuiEncodeStatus)
+ bool saveLogWithVideo, bool showCliForInGuiEncodeStatus, bool preventSleep)
{
Properties.Settings.Default.cli_minimized = cli_minimized;
Properties.Settings.Default.CompletionOption = completionOption;
@@ -64,6 +67,7 @@ namespace HandBrake.ApplicationServices
Properties.Settings.Default.saveLogToSpecifiedPath = saveLogToSpecifiedPath;
Properties.Settings.Default.saveLogWithVideo = saveLogWithVideo;
Properties.Settings.Default.showCliForInGuiEncodeStatus = showCliForInGuiEncodeStatus;
+ Properties.Settings.Default.preventSleep = preventSleep;
Properties.Settings.Default.Save();
}
diff --git a/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs b/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
index bf2781961..d835524af 100644
--- a/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
+++ b/win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
@@ -154,5 +154,17 @@ namespace HandBrake.ApplicationServices.Properties {
this["growlEncode"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool preventSleep {
+ get {
+ return ((bool)(this["preventSleep"]));
+ }
+ set {
+ this["preventSleep"] = value;
+ }
+ }
}
}
diff --git a/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings b/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings
index 20239afcc..96d2de89a 100644
--- a/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings
+++ b/win/C#/HandBrake.ApplicationServices/Properties/Settings.settings
@@ -35,5 +35,8 @@
<Setting Name="growlEncode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
+ <Setting Name="preventSleep" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">False</Value>
+ </Setting>
</Settings>
</SettingsFile> \ No newline at end of file
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
index ad5cd8c3d..1731d4851 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
@@ -193,6 +193,11 @@ namespace HandBrake.ApplicationServices.Services
this.job = encJob;
try
{
+ if (Properties.Settings.Default.preventSleep)
+ {
+ Win32.PreventSleep();
+ }
+
ResetLogReader();
IsEncoding = true;
@@ -215,8 +220,7 @@ namespace HandBrake.ApplicationServices.Services
HbProcess = Process.Start(cliStart);
this.processID = Main.GetCliProcess(before);
- if (HbProcess != null)
- this.processHandle = HbProcess.MainWindowHandle; // Set the process Handle
+ this.processHandle = HbProcess.MainWindowHandle; // Set the process Handle
// Start the Log Monitor
windowTimer = new Timer(new TimerCallback(ReadFile), null, 1000, 1000);
@@ -286,6 +290,11 @@ namespace HandBrake.ApplicationServices.Services
{
windowsSeven.SetTaskBarProgressToNoProgress();
}
+
+ if (Properties.Settings.Default.preventSleep)
+ {
+ Win32.AllowSleep();
+ }
}
/// <summary>
@@ -579,7 +588,7 @@ namespace HandBrake.ApplicationServices.Services
while (!encode.EndOfStream)
encode.ReadEncodeStatus();
- // Main.ShowExceptiowWindow("Encode Monitor Stopped", "Stopped");
+ // Main.ShowExceptiowWindow("Encode Monitor Stopped", "Stopped");
}
catch (Exception exc)
{
diff --git a/win/C#/HandBrake.ApplicationServices/app.config b/win/C#/HandBrake.ApplicationServices/app.config
index 5b9648fa1..29ee4894d 100644
--- a/win/C#/HandBrake.ApplicationServices/app.config
+++ b/win/C#/HandBrake.ApplicationServices/app.config
@@ -40,6 +40,9 @@
<setting name="growlEncode" serializeAs="String">
<value>False</value>
</setting>
+ <setting name="preventSleep" serializeAs="String">
+ <value>False</value>
+ </setting>
</HandBrake.ApplicationServices.Properties.Settings>
</userSettings>
</configuration> \ No newline at end of file
diff --git a/win/C#/Program.cs b/win/C#/Program.cs
index 19f5fb2cb..dde4a1a62 100644
--- a/win/C#/Program.cs
+++ b/win/C#/Program.cs
@@ -91,7 +91,7 @@ namespace Handbrake
Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,
- Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus);
+ Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);
}
/// <summary>
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 4cf0483ec..6937c5923 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -351,20 +351,12 @@ namespace Handbrake
private void encodeStarted(object sender, EventArgs e)
{
- if (Properties.Settings.Default.preventSleep)
- {
- Win32.PreventSleep();
- }
SetEncodeStarted();
encodeQueue.EncodeStatusChanged += EncodeQueue_EncodeStatusChanged;
}
private void encodeEnded(object sender, EventArgs e)
{
- if (Properties.Settings.Default.preventSleep)
- {
- Win32.AllowSleep();
- }
encodeQueue.EncodeStatusChanged -= EncodeQueue_EncodeStatusChanged;
SetEncodeFinished();
}
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs
index 399cf01b8..3ca0298f7 100644
--- a/win/C#/frmOptions.cs
+++ b/win/C#/frmOptions.cs
@@ -507,7 +507,7 @@ namespace Handbrake
Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,
- Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus);
+ Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);
}
}
} \ No newline at end of file