- ensure the paths given are valid before closing the dialog

- sync dialog info back to the database on close

svn path=/trunk/tools/RosTE/; revision=268
This commit is contained in:
Ged Murphy 2007-06-29 15:15:15 +00:00
parent 399865108d
commit c4d5f13966
4 changed files with 237 additions and 176 deletions

View File

@ -30,32 +30,32 @@ namespace RosTEGUI
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.conQemuLoc = new System.Windows.Forms.TextBox();
this.conVdkLoc = new System.Windows.Forms.TextBox();
this.conDefVmLoc = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.conAppDebug = new System.Windows.Forms.CheckBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.conUpdateCombo = new System.Windows.Forms.ComboBox();
this.conUpdateNow = new System.Windows.Forms.Button();
this.conUpdateCombo = new System.Windows.Forms.ComboBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.conDefVmLoc = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.conVdkLoc = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.conQemuLoc = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.conAppDebug = new System.Windows.Forms.CheckBox();
this.conDialogOK = new System.Windows.Forms.Button();
this.conDialogCancel = new System.Windows.Forms.Button();
this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@ -80,143 +80,6 @@ namespace RosTEGUI
this.tabPage1.Text = "General";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.groupBox3);
this.tabPage2.Controls.Add(this.groupBox2);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(295, 261);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Paths";
this.tabPage2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(159, 305);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(240, 305);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.conAppDebug);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(295, 261);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Advanced";
this.tabPage3.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.conQemuLoc);
this.groupBox1.Location = new System.Drawing.Point(6, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(283, 65);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Location of QEmu";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.conVdkLoc);
this.groupBox2.Location = new System.Drawing.Point(6, 88);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(283, 65);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Location of VDK";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button5);
this.groupBox3.Controls.Add(this.conDefVmLoc);
this.groupBox3.Location = new System.Drawing.Point(6, 170);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(283, 65);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Default location for virtual machines";
//
// conQemuLoc
//
this.conQemuLoc.Location = new System.Drawing.Point(6, 28);
this.conQemuLoc.Name = "conQemuLoc";
this.conQemuLoc.Size = new System.Drawing.Size(190, 20);
this.conQemuLoc.TabIndex = 0;
//
// conVdkLoc
//
this.conVdkLoc.Location = new System.Drawing.Point(6, 29);
this.conVdkLoc.Name = "conVdkLoc";
this.conVdkLoc.Size = new System.Drawing.Size(190, 20);
this.conVdkLoc.TabIndex = 0;
//
// conDefVmLoc
//
this.conDefVmLoc.Location = new System.Drawing.Point(6, 30);
this.conDefVmLoc.Name = "conDefVmLoc";
this.conDefVmLoc.Size = new System.Drawing.Size(190, 20);
this.conDefVmLoc.TabIndex = 0;
//
// button3
//
this.button3.Location = new System.Drawing.Point(202, 26);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 1;
this.button3.Text = "Browse...";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(202, 27);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 1;
this.button4.Text = "Browse...";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(202, 28);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 1;
this.button5.Text = "Browse...";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// conAppDebug
//
this.conAppDebug.AutoSize = true;
this.conAppDebug.Location = new System.Drawing.Point(21, 33);
this.conAppDebug.Name = "conAppDebug";
this.conAppDebug.Size = new System.Drawing.Size(170, 17);
this.conAppDebug.TabIndex = 0;
this.conAppDebug.Text = "Turn on application debugging";
this.conAppDebug.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.conUpdateNow);
@ -228,6 +91,15 @@ namespace RosTEGUI
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Check for updates";
//
// conUpdateNow
//
this.conUpdateNow.Location = new System.Drawing.Point(202, 33);
this.conUpdateNow.Name = "conUpdateNow";
this.conUpdateNow.Size = new System.Drawing.Size(75, 23);
this.conUpdateNow.TabIndex = 1;
this.conUpdateNow.Text = "Check now";
this.conUpdateNow.UseVisualStyleBackColor = true;
//
// conUpdateCombo
//
this.conUpdateCombo.FormattingEnabled = true;
@ -241,22 +113,150 @@ namespace RosTEGUI
this.conUpdateCombo.Size = new System.Drawing.Size(190, 21);
this.conUpdateCombo.TabIndex = 0;
//
// conUpdateNow
// tabPage2
//
this.conUpdateNow.Location = new System.Drawing.Point(202, 33);
this.conUpdateNow.Name = "conUpdateNow";
this.conUpdateNow.Size = new System.Drawing.Size(75, 23);
this.conUpdateNow.TabIndex = 1;
this.conUpdateNow.Text = "Check now";
this.conUpdateNow.UseVisualStyleBackColor = true;
this.tabPage2.Controls.Add(this.groupBox3);
this.tabPage2.Controls.Add(this.groupBox2);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(295, 261);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Paths";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button5);
this.groupBox3.Controls.Add(this.conDefVmLoc);
this.groupBox3.Location = new System.Drawing.Point(6, 170);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(283, 65);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Default location for virtual machines";
//
// button5
//
this.button5.Location = new System.Drawing.Point(202, 28);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 1;
this.button5.Text = "Browse...";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// conDefVmLoc
//
this.conDefVmLoc.Location = new System.Drawing.Point(6, 30);
this.conDefVmLoc.Name = "conDefVmLoc";
this.conDefVmLoc.Size = new System.Drawing.Size(190, 20);
this.conDefVmLoc.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.conVdkLoc);
this.groupBox2.Location = new System.Drawing.Point(6, 88);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(283, 65);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Location of VDK";
//
// button4
//
this.button4.Location = new System.Drawing.Point(202, 27);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 1;
this.button4.Text = "Browse...";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// conVdkLoc
//
this.conVdkLoc.Location = new System.Drawing.Point(6, 29);
this.conVdkLoc.Name = "conVdkLoc";
this.conVdkLoc.Size = new System.Drawing.Size(190, 20);
this.conVdkLoc.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.conQemuLoc);
this.groupBox1.Location = new System.Drawing.Point(6, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(283, 65);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Location of QEmu";
//
// button3
//
this.button3.Location = new System.Drawing.Point(202, 26);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 1;
this.button3.Text = "Browse...";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// conQemuLoc
//
this.conQemuLoc.Location = new System.Drawing.Point(6, 28);
this.conQemuLoc.Name = "conQemuLoc";
this.conQemuLoc.Size = new System.Drawing.Size(190, 20);
this.conQemuLoc.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.conAppDebug);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(295, 261);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Advanced";
this.tabPage3.UseVisualStyleBackColor = true;
//
// conAppDebug
//
this.conAppDebug.AutoSize = true;
this.conAppDebug.Location = new System.Drawing.Point(21, 33);
this.conAppDebug.Name = "conAppDebug";
this.conAppDebug.Size = new System.Drawing.Size(170, 17);
this.conAppDebug.TabIndex = 0;
this.conAppDebug.Text = "Turn on application debugging";
this.conAppDebug.UseVisualStyleBackColor = true;
//
// conDialogOK
//
this.conDialogOK.Location = new System.Drawing.Point(159, 305);
this.conDialogOK.Name = "conDialogOK";
this.conDialogOK.Size = new System.Drawing.Size(75, 23);
this.conDialogOK.TabIndex = 1;
this.conDialogOK.Text = "OK";
this.conDialogOK.UseVisualStyleBackColor = true;
this.conDialogOK.Click += new System.EventHandler(this.conDialogOK_Click);
//
// conDialogCancel
//
this.conDialogCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.conDialogCancel.Location = new System.Drawing.Point(240, 305);
this.conDialogCancel.Name = "conDialogCancel";
this.conDialogCancel.Size = new System.Drawing.Size(75, 23);
this.conDialogCancel.TabIndex = 2;
this.conDialogCancel.Text = "Cancel";
this.conDialogCancel.UseVisualStyleBackColor = true;
//
// ConsoleSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(327, 340);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.conDialogCancel);
this.Controls.Add(this.conDialogOK);
this.Controls.Add(this.tabControl1);
this.MaximizeBox = false;
this.MinimizeBox = false;
@ -266,16 +266,16 @@ namespace RosTEGUI
this.Text = "Settings";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.ResumeLayout(false);
}
@ -285,8 +285,8 @@ namespace RosTEGUI
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button conDialogOK;
private System.Windows.Forms.Button conDialogCancel;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.TextBox conDefVmLoc;

View File

@ -5,11 +5,37 @@ using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace RosTEGUI
{
public partial class ConsoleSettings : Form
{
public string QemuPath
{
get { return conQemuLoc.Text; }
}
public string VdkPath
{
get { return conVdkLoc.Text; }
}
public string DefVmPath
{
get { return conDefVmLoc.Text; }
}
public int UpdateSched
{
get { return conUpdateCombo.SelectedIndex; }
}
public bool AppDebug
{
get { return conAppDebug.Checked; }
}
private string GetFolderLocation()
{
folderBrowserDialog.ShowDialog();
@ -46,5 +72,29 @@ namespace RosTEGUI
{
conDefVmLoc.Text = GetFolderLocation();
}
private void conDialogOK_Click(object sender, EventArgs e)
{
if (!File.Exists(conQemuLoc.Text + "\\qemu.exe"))
{
MessageBox.Show("Cannot find qemu.exe in " + conQemuLoc.Text);
return;
}
if (!File.Exists(conVdkLoc.Text + "\\vdk.exe"))
{
MessageBox.Show("Cannot find vdk.exe in " + conVdkLoc.Text);
return;
}
if (!Directory.Exists(conDefVmLoc.Text))
{
MessageBox.Show(conDefVmLoc.Text + " does not exist");
return;
}
this.DialogResult = DialogResult.OK;
}
}
}

View File

@ -190,7 +190,14 @@ namespace RosTEGUI
{
ConsoleSettings cs = new ConsoleSettings(mainConf);
cs.StartPosition = FormStartPosition.CenterParent;
cs.ShowDialog();
if (cs.ShowDialog() == DialogResult.OK)
{
mainConf.UpdateSched = cs.UpdateSched;
mainConf.QemuPath = cs.QemuPath;
mainConf.VdkPath = cs.VdkPath;
mainConf.DefVmPath = cs.DefVmPath;
mainConf.AppDebug = cs.AppDebug;
}
}
}
}

View File

@ -13,6 +13,8 @@ namespace RosTEGUI
private Data data;
private DataRow hdDataRow;
#region properties
public int DiskID
{
get { return (int)hdDataRow["DiskID"]; }
@ -51,6 +53,8 @@ namespace RosTEGUI
data = dataIn;
}
#endregion
public override string ToString()
{
return Name;