3 This file is part of the HandBrake source code.
\r
4 Homepage: <http://handbrake.fr>.
\r
5 It may be used under the terms of the GNU General Public License. */
\r
8 using System.Globalization;
\r
9 using System.Windows.Forms;
\r
10 using Handbrake.Functions;
\r
14 public partial class frmOptions : Form
\r
18 InitializeComponent();
\r
20 // #############################
\r
22 // #############################
\r
25 if (Properties.Settings.Default.tooltipEnable)
\r
27 check_tooltip.CheckState = CheckState.Checked;
\r
28 ToolTip.Active = true;
\r
31 // Setup Widgets to match settings.
\r
32 if (Properties.Settings.Default.updateStatus)
\r
33 check_updateCheck.CheckState = CheckState.Checked;
\r
35 // enable loading of default user settings.
\r
36 if (Properties.Settings.Default.defaultSettings)
\r
37 check_userDefaultSettings.CheckState = CheckState.Checked;
\r
39 // On Encode Completeion Action
\r
40 drp_completeOption.Text = Properties.Settings.Default.CompletionOption;
\r
42 // Enable auto naming feature.
\r
43 if (Properties.Settings.Default.autoNaming)
\r
44 check_autoNaming.CheckState = CheckState.Checked;
\r
46 // Store the auto name path
\r
47 text_an_path.Text = Properties.Settings.Default.autoNamePath;
\r
48 if (text_an_path.Text == string.Empty)
\r
49 text_an_path.Text = "Click 'Browse' to set the default location";
\r
51 // Store auto name format
\r
52 txt_autoNameFormat.Text = Properties.Settings.Default.autoNameFormat;
\r
54 // Use iPod/iTunes friendly .m4v extension for MP4 files.
\r
55 if (Properties.Settings.Default.useM4v)
\r
56 check_m4v.CheckState = CheckState.Checked;
\r
58 // #############################
\r
60 // #############################
\r
63 txt_vlcPath.Text = Properties.Settings.Default.VLC_Path;
\r
65 // #############################
\r
67 // #############################
\r
69 // Enable Start CLI minimized
\r
70 if (Properties.Settings.Default.cli_minimized)
\r
71 check_cli_minimized.CheckState = CheckState.Checked;
\r
73 // Number of processor cores
\r
74 drp_processors.Text = Properties.Settings.Default.Processors;
\r
76 // Priority level for encodes
\r
77 drp_Priority.Text = Properties.Settings.Default.processPriority;
\r
79 // Log Verbosity Level
\r
80 cb_logVerboseLvl.SelectedIndex = Properties.Settings.Default.verboseLevel;
\r
83 // Save logs in the same directory as encoded files
\r
84 if (Properties.Settings.Default.saveLogWithVideo)
\r
85 check_saveLogWithVideo.CheckState = CheckState.Checked;
\r
87 // Save Logs in a specified path
\r
88 if (Properties.Settings.Default.saveLogToSpecifiedPath)
\r
89 check_logsInSpecifiedLocation.CheckState = CheckState.Checked;
\r
91 // The saved log path
\r
92 text_logPath.Text = Properties.Settings.Default.saveLogPath;
\r
95 // #############################
\r
97 // #############################
\r
99 // Enable GUI DVD Drive detection code
\r
100 if (Properties.Settings.Default.drive_detection)
\r
101 btn_drive_detect.CheckState = CheckState.Checked;
\r
103 // Minimise to Tray
\r
104 if (Properties.Settings.Default.trayIconAlerts)
\r
105 check_trayStatusAlerts.CheckState = CheckState.Checked;
\r
107 // Tray Balloon popups
\r
108 if (Properties.Settings.Default.MainWindowMinimize)
\r
109 check_mainMinimize.CheckState = CheckState.Checked;
\r
111 // Enable / Disable Query editor tab
\r
112 if (Properties.Settings.Default.QueryEditorTab)
\r
113 check_queryEditorTab.CheckState = CheckState.Checked;
\r
115 // Preset update notification
\r
116 if (Properties.Settings.Default.presetNotification)
\r
117 check_disablePresetNotification.CheckState = CheckState.Checked;
\r
119 // Experimental In-GUI encode status indicator.
\r
120 if (Properties.Settings.Default.enocdeStatusInGui)
\r
121 check_inGuiStatus.CheckState = CheckState.Checked;
\r
123 // Days between update checks
\r
124 numeric_updateCheckDays.Value = Properties.Settings.Default.daysBetweenUpdateCheck;
\r
127 CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
\r
128 drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep.ToString(culture);
\r
130 // Use Experimental dvdnav
\r
131 if (Properties.Settings.Default.dvdnav)
\r
132 check_dvdnav.CheckState = CheckState.Checked;
\r
136 private void check_updateCheck_CheckedChanged(object sender, EventArgs e)
\r
138 Properties.Settings.Default.updateStatus = check_updateCheck.Checked;
\r
141 private void check_userDefaultSettings_CheckedChanged(object sender, EventArgs e)
\r
143 Properties.Settings.Default.defaultSettings = check_userDefaultSettings.Checked;
\r
146 private void check_tooltip_CheckedChanged(object sender, EventArgs e)
\r
148 Properties.Settings.Default.tooltipEnable = check_tooltip.Checked;
\r
150 private void drp_completeOption_SelectedIndexChanged(object sender, EventArgs e)
\r
152 Properties.Settings.Default.CompletionOption = drp_completeOption.Text;
\r
155 private void check_autoNaming_CheckedChanged(object sender, EventArgs e)
\r
157 Properties.Settings.Default.autoNaming = check_autoNaming.Checked;
\r
160 private void txt_autoNameFormat_TextChanged(object sender, EventArgs e)
\r
162 Properties.Settings.Default.autoNameFormat = txt_autoNameFormat.Text;
\r
165 private void btn_browse_Click(object sender, EventArgs e)
\r
167 pathFinder.ShowDialog();
\r
168 text_an_path.Text = pathFinder.SelectedPath;
\r
171 private void text_an_path_TextChanged(object sender, EventArgs e)
\r
173 if (text_an_path.Text == string.Empty)
\r
175 Properties.Settings.Default.autoNamePath = "";
\r
176 text_an_path.Text = "Click 'Browse' to set the default location";
\r
179 Properties.Settings.Default.autoNamePath = text_an_path.Text;
\r
182 private void check_m4v_CheckedChanged(object sender, EventArgs e)
\r
184 Properties.Settings.Default.useM4v = check_m4v.Checked;
\r
189 private void btn_vlcPath_Click(object sender, EventArgs e)
\r
191 openFile_vlc.ShowDialog();
\r
192 if (openFile_vlc.FileName != string.Empty)
\r
193 txt_vlcPath.Text = openFile_vlc.FileName;
\r
195 private void txt_vlcPath_TextChanged(object sender, EventArgs e)
\r
197 Properties.Settings.Default.VLC_Path = txt_vlcPath.Text;
\r
202 private void check_cli_minimized_CheckedChanged(object sender, EventArgs e)
\r
204 Properties.Settings.Default.cli_minimized = check_cli_minimized.Checked;
\r
207 private void drp_processors_SelectedIndexChanged(object sender, EventArgs e)
\r
209 Properties.Settings.Default.Processors = drp_processors.Text;
\r
212 private void drp_Priority_SelectedIndexChanged(object sender, EventArgs e)
\r
214 Properties.Settings.Default.processPriority = drp_Priority.Text;
\r
217 private void cb_logVerboseLvl_SelectedIndexChanged(object sender, EventArgs e)
\r
219 Properties.Settings.Default.verboseLevel = cb_logVerboseLvl.SelectedIndex;
\r
222 private void check_saveLogWithVideo_CheckedChanged(object sender, EventArgs e)
\r
224 Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.Checked;
\r
227 private void check_logsInSpecifiedLocation_CheckedChanged(object sender, EventArgs e)
\r
229 Properties.Settings.Default.saveLogToSpecifiedPath = check_logsInSpecifiedLocation.Checked;
\r
232 private void btn_saveLog_Click(object sender, EventArgs e)
\r
234 pathFinder.SelectedPath = String.Empty;
\r
235 pathFinder.ShowDialog();
\r
236 if (pathFinder.SelectedPath != string.Empty)
\r
237 text_logPath.Text = pathFinder.SelectedPath;
\r
240 private void text_logPath_TextChanged(object sender, EventArgs e)
\r
242 Properties.Settings.Default.saveLogPath = text_logPath.Text;
\r
245 private void btn_viewLogs_Click(object sender, EventArgs e)
\r
247 string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
\r
248 string windir = Environment.GetEnvironmentVariable("WINDIR");
\r
249 System.Diagnostics.Process prc = new System.Diagnostics.Process();
\r
250 prc.StartInfo.FileName = windir + @"\explorer.exe";
\r
251 prc.StartInfo.Arguments = logDir;
\r
255 private void btn_clearLogs_Click(object sender, EventArgs e)
\r
257 DialogResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
\r
258 if (result == DialogResult.Yes)
\r
261 MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK,
\r
262 MessageBoxIcon.Information);
\r
268 private void btn_drive_detect_CheckedChanged(object sender, EventArgs e)
\r
270 Properties.Settings.Default.drive_detection = btn_drive_detect.Checked;
\r
273 private void check_mainMinimize_CheckedChanged(object sender, EventArgs e)
\r
275 Properties.Settings.Default.MainWindowMinimize = check_mainMinimize.Checked;
\r
278 private void check_trayStatusAlerts_CheckedChanged(object sender, EventArgs e)
\r
280 Properties.Settings.Default.trayIconAlerts = check_trayStatusAlerts.Checked;
\r
283 private void check_queryEditorTab_CheckedChanged(object sender, EventArgs e)
\r
285 Properties.Settings.Default.QueryEditorTab = check_queryEditorTab.Checked;
\r
288 private void check_disablePresetNotification_CheckedChanged(object sender, EventArgs e)
\r
290 Properties.Settings.Default.presetNotification = check_disablePresetNotification.Checked;
\r
293 private void check_inGuiStatus_CheckedChanged(object sender, EventArgs e)
\r
295 Properties.Settings.Default.enocdeStatusInGui = check_inGuiStatus.Checked;
\r
298 private void numeric_updateCheckDays_ValueChanged(object sender, EventArgs e)
\r
300 Properties.Settings.Default.daysBetweenUpdateCheck = (int)numeric_updateCheckDays.Value;
\r
303 private void x264step_SelectedIndexChanged(object sender, EventArgs e)
\r
305 switch (drop_x264step.SelectedIndex)
\r
308 Properties.Settings.Default.x264cqstep = 1.0;
\r
311 Properties.Settings.Default.x264cqstep = 0.50;
\r
314 Properties.Settings.Default.x264cqstep = 0.25;
\r
317 Properties.Settings.Default.x264cqstep = 0.20;
\r
322 private void check_dvdnav_CheckedChanged(object sender, EventArgs e)
\r
324 Properties.Settings.Default.dvdnav = check_dvdnav.Checked;
\r
328 private void btn_close_Click(object sender, EventArgs e)
\r
330 Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this
\r