@@ -64,7 +64,7 @@ private void btnOK_Click(object sender, EventArgs e)
6464 private void txt_TextChanged ( object sender , EventArgs e )
6565 {
6666 if ( string . IsNullOrWhiteSpace ( txtEXEdir . Text ) || string . IsNullOrWhiteSpace ( txtCFGdir . Text ) ||
67- string . IsNullOrWhiteSpace ( txtLaunchTimeout . Text ) )
67+ string . IsNullOrWhiteSpace ( txtLaunchTimeout . Text ) || string . IsNullOrWhiteSpace ( txtLogPath . Text ) )
6868 {
6969 btnApply . Enabled = false ;
7070 }
@@ -93,7 +93,7 @@ private void Get86BoxVersion()
9393 }
9494 else //Completely unsupported, since version info can't be obtained anyway
9595 {
96- lbl86BoxVer1 . Text = "2.0 (pre-1763) - not supported " ;
96+ lbl86BoxVer1 . Text = "2.0 (pre-1763) - no support / unofficial build - support level unknown " ;
9797 lbl86BoxVer1 . ForeColor = Color . Red ;
9898 }
9999 }
@@ -131,6 +131,8 @@ private void SaveSettings()
131131 regkey . SetValue ( "CloseToTray" , cbxCloseTray . Checked , RegistryValueKind . DWord ) ;
132132 regkey . SetValue ( "LaunchTimeout" , int . Parse ( txtLaunchTimeout . Text ) , RegistryValueKind . DWord ) ;
133133 regkey . SetValue ( "EnableLogging" , cbxLogging . Checked , RegistryValueKind . DWord ) ;
134+ regkey . SetValue ( "LogPath" , txtLogPath . Text , RegistryValueKind . String ) ;
135+ regkey . SetValue ( "EnableGridLines" , cbxGrid . Checked , RegistryValueKind . DWord ) ;
134136 regkey . Close ( ) ;
135137
136138 settingsChanged = CheckForChanges ( ) ;
@@ -173,6 +175,10 @@ private void LoadSettings()
173175 cbxCloseTray . Checked = false ;
174176 cbxLogging . Checked = false ;
175177 txtLaunchTimeout . Text = "5000" ;
178+ txtLogPath . Text = "" ;
179+ cbxGrid . Checked = false ;
180+ btnBrowse3 . Enabled = false ;
181+ txtLogPath . Enabled = false ;
176182
177183 SaveSettings ( ) ; //This will write the default values to the registry
178184 }
@@ -186,6 +192,10 @@ private void LoadSettings()
186192 cbxCloseTray . Checked = Convert . ToBoolean ( regkey . GetValue ( "CloseToTray" ) ) ;
187193 cbxLogging . Checked = Convert . ToBoolean ( regkey . GetValue ( "EnableLogging" ) ) ;
188194 txtLaunchTimeout . Text = Convert . ToString ( regkey . GetValue ( "LaunchTimeout" ) ) ;
195+ txtLogPath . Text = Convert . ToString ( regkey . GetValue ( "LogPath" ) ) ;
196+ cbxGrid . Checked = Convert . ToBoolean ( regkey . GetValue ( "EnableGridLines" ) ) ;
197+ txtLogPath . Enabled = cbxLogging . Checked ;
198+ btnBrowse3 . Enabled = cbxLogging . Checked ;
189199 }
190200
191201 regkey . Close ( ) ;
@@ -200,6 +210,10 @@ private void LoadSettings()
200210 cbxCloseTray . Checked = false ;
201211 cbxLogging . Checked = false ;
202212 txtLaunchTimeout . Text = "5000" ;
213+ txtLogPath . Text = "" ;
214+ cbxGrid . Checked = false ;
215+ txtLogPath . Enabled = false ;
216+ btnBrowse3 . Enabled = false ;
203217 }
204218 }
205219
@@ -268,6 +282,10 @@ private void ResetSettings()
268282 cbxCloseTray . Checked = false ;
269283 cbxLogging . Checked = false ;
270284 txtLaunchTimeout . Text = "5000" ;
285+ txtLogPath . Text = "" ;
286+ cbxGrid . Checked = false ;
287+ txtLogPath . Enabled = false ;
288+ btnBrowse3 . Enabled = false ;
271289
272290 SaveSettings ( ) ;
273291 regkey . Close ( ) ;
@@ -287,7 +305,9 @@ private bool CheckForChanges()
287305 cbxMinimizeTray . Checked != Convert . ToBoolean ( regkey . GetValue ( "MinimizeToTray" ) ) ||
288306 cbxCloseTray . Checked != Convert . ToBoolean ( regkey . GetValue ( "CloseToTray" ) ) ||
289307 txtLaunchTimeout . Text != Convert . ToString ( regkey . GetValue ( "LaunchTimeout" ) ) ||
290- cbxLogging . Checked != Convert . ToBoolean ( regkey . GetValue ( "EnableLogging" ) ) ) ;
308+ cbxLogging . Checked != Convert . ToBoolean ( regkey . GetValue ( "EnableLogging" ) ) ||
309+ txtLogPath . Text != regkey . GetValue ( "LogPath" ) . ToString ( ) ||
310+ cbxGrid . Checked != Convert . ToBoolean ( regkey . GetValue ( "EnableGridLines" ) ) ) ;
291311
292312 return btnApply . Enabled ;
293313 }
@@ -305,5 +325,27 @@ private void cbx_CheckedChanged(object sender, EventArgs e)
305325 {
306326 settingsChanged = CheckForChanges ( ) ;
307327 }
328+
329+ private void cbxLogging_CheckedChanged ( object sender , EventArgs e )
330+ {
331+ settingsChanged = CheckForChanges ( ) ;
332+ txt_TextChanged ( sender , e ) ; //Needed so the Apply button doesn't get enabled on an empty logpath textbox. Too lazy to write a duplicated empty check...
333+ txtLogPath . Enabled = cbxLogging . Checked ;
334+ btnBrowse3 . Enabled = cbxLogging . Checked ;
335+ }
336+
337+ private void btnBrowse3_Click ( object sender , EventArgs e )
338+ {
339+ SaveFileDialog ofd = new SaveFileDialog ( ) ;
340+ ofd . DefaultExt = "log" ;
341+ ofd . Title = "Select a file where 86Box logs will be saved" ;
342+ ofd . InitialDirectory = Environment . GetFolderPath ( Environment . SpecialFolder . MyComputer ) ;
343+ ofd . Filter = "Log files (*.log)|*.log" ;
344+
345+ if ( ofd . ShowDialog ( ) == DialogResult . OK )
346+ {
347+ txtLogPath . Text = ofd . FileName ;
348+ }
349+ }
308350 }
309351}
0 commit comments