Skip to content

Commit

Permalink
Final v1.5.0 commit
Browse files Browse the repository at this point in the history
Added option to toggle grid lines from issue #51
Added option to toggle 86Box logging to specified file from issue #48
  • Loading branch information
daviunic committed Apr 17, 2019
1 parent 3139df8 commit df9782d
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 31 deletions.
81 changes: 54 additions & 27 deletions 86BoxManager/dlgSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 45 additions & 3 deletions 86BoxManager/dlgSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void btnOK_Click(object sender, EventArgs e)
private void txt_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(txtEXEdir.Text) || string.IsNullOrWhiteSpace(txtCFGdir.Text) ||
string.IsNullOrWhiteSpace(txtLaunchTimeout.Text))
string.IsNullOrWhiteSpace(txtLaunchTimeout.Text) || string.IsNullOrWhiteSpace(txtLogPath.Text))
{
btnApply.Enabled = false;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ private void Get86BoxVersion()
}
else //Completely unsupported, since version info can't be obtained anyway
{
lbl86BoxVer1.Text = "2.0 (pre-1763) - not supported";
lbl86BoxVer1.Text = "2.0 (pre-1763) - no support / unofficial build - support level unknown";
lbl86BoxVer1.ForeColor = Color.Red;
}
}
Expand Down Expand Up @@ -131,6 +131,8 @@ private void SaveSettings()
regkey.SetValue("CloseToTray", cbxCloseTray.Checked, RegistryValueKind.DWord);
regkey.SetValue("LaunchTimeout", int.Parse(txtLaunchTimeout.Text), RegistryValueKind.DWord);
regkey.SetValue("EnableLogging", cbxLogging.Checked, RegistryValueKind.DWord);
regkey.SetValue("LogPath", txtLogPath.Text, RegistryValueKind.String);
regkey.SetValue("EnableGridLines", cbxGrid.Checked, RegistryValueKind.DWord);
regkey.Close();

settingsChanged = CheckForChanges();
Expand Down Expand Up @@ -173,6 +175,10 @@ private void LoadSettings()
cbxCloseTray.Checked = false;
cbxLogging.Checked = false;
txtLaunchTimeout.Text = "5000";
txtLogPath.Text = "";
cbxGrid.Checked = false;
btnBrowse3.Enabled = false;
txtLogPath.Enabled = false;

SaveSettings(); //This will write the default values to the registry
}
Expand All @@ -186,6 +192,10 @@ private void LoadSettings()
cbxCloseTray.Checked = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
cbxLogging.Checked = Convert.ToBoolean(regkey.GetValue("EnableLogging"));
txtLaunchTimeout.Text = Convert.ToString(regkey.GetValue("LaunchTimeout"));
txtLogPath.Text = Convert.ToString(regkey.GetValue("LogPath"));
cbxGrid.Checked = Convert.ToBoolean(regkey.GetValue("EnableGridLines"));
txtLogPath.Enabled = cbxLogging.Checked;
btnBrowse3.Enabled = cbxLogging.Checked;
}

regkey.Close();
Expand All @@ -200,6 +210,10 @@ private void LoadSettings()
cbxCloseTray.Checked = false;
cbxLogging.Checked = false;
txtLaunchTimeout.Text = "5000";
txtLogPath.Text = "";
cbxGrid.Checked = false;
txtLogPath.Enabled = false;
btnBrowse3.Enabled = false;
}
}

Expand Down Expand Up @@ -268,6 +282,10 @@ private void ResetSettings()
cbxCloseTray.Checked = false;
cbxLogging.Checked = false;
txtLaunchTimeout.Text = "5000";
txtLogPath.Text = "";
cbxGrid.Checked = false;
txtLogPath.Enabled = false;
btnBrowse3.Enabled = false;

SaveSettings();
regkey.Close();
Expand All @@ -287,7 +305,9 @@ private bool CheckForChanges()
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")) ||
txtLaunchTimeout.Text != Convert.ToString(regkey.GetValue("LaunchTimeout")) ||
cbxLogging.Checked != Convert.ToBoolean(regkey.GetValue("EnableLogging")));
cbxLogging.Checked != Convert.ToBoolean(regkey.GetValue("EnableLogging")) ||
txtLogPath.Text != regkey.GetValue("LogPath").ToString() ||
cbxGrid.Checked != Convert.ToBoolean(regkey.GetValue("EnableGridLines")));

return btnApply.Enabled;
}
Expand All @@ -305,5 +325,27 @@ private void cbx_CheckedChanged(object sender, EventArgs e)
{
settingsChanged = CheckForChanges();
}

private void cbxLogging_CheckedChanged(object sender, EventArgs e)
{
settingsChanged = CheckForChanges();
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...
txtLogPath.Enabled = cbxLogging.Checked;
btnBrowse3.Enabled = cbxLogging.Checked;
}

private void btnBrowse3_Click(object sender, EventArgs e)
{
SaveFileDialog ofd = new SaveFileDialog();
ofd.DefaultExt = "log";
ofd.Title = "Select a file where 86Box logs will be saved";
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
ofd.Filter = "Log files (*.log)|*.log";

if (ofd.ShowDialog() == DialogResult.OK)
{
txtLogPath.Text = ofd.FileName;
}
}
}
}
17 changes: 16 additions & 1 deletion 86BoxManager/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public struct COPYDATASTRUCT
private int sortColumn = -1; //For column sorting's asc/desc capability
private int launchTimeout = 5000; //Timeout for waiting for 86Box.exe to initialize
private bool logging = false; //Logging enabled for 86Box.exe (-L parameter)?
private string logpath = ""; //Path to log file
private bool gridlines = false; //Are grid lines enabled for VM list?

public frmMain()
{
Expand Down Expand Up @@ -206,6 +208,11 @@ private void LoadSettings()
minimizeTray = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
closeTray = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
launchTimeout = int.Parse(regkey.GetValue("LaunchTimeout").ToString());
logpath = regkey.GetValue("LogPath").ToString();
logging = Convert.ToBoolean(regkey.GetValue("EnableLogging"));
gridlines = Convert.ToBoolean(regkey.GetValue("EnableGridLines"));

lstVMs.GridLines = gridlines;
}
catch (Exception ex)
{
Expand All @@ -226,6 +233,11 @@ private void LoadSettings()
minimizeTray = false;
closeTray = false;
launchTimeout = 5000;
logging = false;
logpath = "";
gridlines = false;

lstVMs.GridLines = false;

//Defaults must also be written to the registry
regkey.SetValue("EXEdir", exepath, RegistryValueKind.String);
Expand All @@ -235,6 +247,9 @@ private void LoadSettings()
regkey.SetValue("MinimizeToTray", minimizeTray, RegistryValueKind.DWord);
regkey.SetValue("CloseToTray", closeTray, RegistryValueKind.DWord);
regkey.SetValue("LaunchTimeout", launchTimeout, RegistryValueKind.DWord);
regkey.SetValue("EnableLogging", logging, RegistryValueKind.DWord);
regkey.SetValue("LogPath", logpath, RegistryValueKind.String);
regkey.SetValue("EnableGridLines", gridlines, RegistryValueKind.DWord);
}
finally
{
Expand Down Expand Up @@ -513,7 +528,7 @@ private void VMStart()
p.StartInfo.Arguments = "-P \"" + lstVMs.SelectedItems[0].SubItems[2].Text + "\" -H " + ZEROID + "," + hWndHex;
if (logging)
{
p.StartInfo.Arguments += " -L";
p.StartInfo.Arguments += " -L \"" + logpath + "\"";
}
if (!showConsole)
{
Expand Down

0 comments on commit df9782d

Please sign in to comment.