X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config-gui%2FCecConfigGUI.cs;h=8fb066f2e9349915ad260c15d55306ea78792218;hb=5baac2856b8c5615ba764006c76541f40eb8befa;hp=2f9b38903b5b24eb740c6cfb2bdfaafd6c3df025;hpb=5cf99fae5cadae864a31ca6a7f67f31528838cb3;p=deb_libcec.git
diff --git a/src/cec-config-gui/CecConfigGUI.cs b/src/cec-config-gui/CecConfigGUI.cs
index 2f9b389..8fb066f 100644
--- a/src/cec-config-gui/CecConfigGUI.cs
+++ b/src/cec-config-gui/CecConfigGUI.cs
@@ -28,7 +28,7 @@ namespace CecConfigGui
Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
Config.DeviceName = "CEC Config";
Config.GetSettingsFromROM = true;
- Config.ClientVersion = CecClientVersion.Version1_5_0;
+ Config.ClientVersion = CecClientVersion.Version1_5_1;
Callbacks = new CecCallbackWrapper(this);
Config.SetCallbacks(Callbacks);
LoadXMLConfiguration(ref Config);
@@ -160,6 +160,10 @@ namespace CecConfigGui
case "port":
//TODO
break;
+ // 1.5.1 settings
+ case "send_inactive_source":
+ config.SendInactiveSource = value.Equals("1") || value.ToLower().Equals("true") || value.ToLower().Equals("yes");
+ break;
default:
break;
}
@@ -317,13 +321,19 @@ namespace CecConfigGui
}
SetControlVisible(pProgress, false);
break;
+ case UpdateEventType.ExitApplication:
+ ActiveProcess = null;
+ SetControlsEnabled(false);
+ SetControlVisible(pProgress, false);
+ Application.Exit();
+ break;
}
}
private void SetControlsEnabled(bool val)
{
- SetControlEnabled(cbPortNumber, val && !Config.AutodetectAddress && Config.PhysicalAddress != 0);
- SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 && !Config.AutodetectAddress && val);
+ SetControlEnabled(cbPortNumber, val && !cbOverrideAddress.Checked);
+ SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 && !cbOverrideAddress.Checked && val);
SetControlEnabled(cbOverrideAddress, val);
SetControlEnabled(tbPhysicalAddress, val && !Config.AutodetectAddress && cbOverrideAddress.Checked);
SetControlEnabled(cbDeviceType, val);
@@ -335,6 +345,7 @@ namespace CecConfigGui
SetControlEnabled(cbPowerOffDevices, val);
SetControlEnabled(cbVendorOverride, val);
SetControlEnabled(cbVendorId, val && cbVendorOverride.Checked);
+ SetControlEnabled(cbSendInactiveSource, val);
SetControlEnabled(bClose, val);
SetControlEnabled(bSaveConfig, val);
SetControlEnabled(bReloadConfig, val);
@@ -483,6 +494,8 @@ namespace CecConfigGui
private void cbOverrideAddress_CheckedChanged(object sender, EventArgs e)
{
SetControlEnabled(tbPhysicalAddress, ((CheckBox)sender).Checked);
+ SetControlEnabled(cbPortNumber, !((CheckBox)sender).Checked);
+ SetControlEnabled(cbConnectedDevice, !((CheckBox)sender).Checked && cbConnectedDevice.Items.Count > 1);
}
private void tbPhysicalAddress_TextChanged(object sender, EventArgs e)
@@ -534,99 +547,97 @@ namespace CecConfigGui
Config.ActivateSource = cbActivateSource.Checked;
Config.PowerOffScreensaver = cbPowerOffScreensaver.Checked;
Config.PowerOffOnStandby = cbPowerOffOnStandby.Checked;
+ Config.SendInactiveSource = cbSendInactiveSource.Checked;
Config.WakeDevices = WakeDevices;
Config.PowerOffDevices = PowerOffDevices;
- if (!Lib.CanPersistConfiguration())
+ /* save settings in the eeprom */
+ Lib.PersistConfiguration(Config);
+
+ /* and in xml */
+ if (ActiveProcess == null)
{
- if (ActiveProcess == null)
- {
- SetControlsEnabled(false);
- string xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
- string defaultDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+ SetControlsEnabled(false);
+ string xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
+ string defaultDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- SaveFileDialog dialog = new SaveFileDialog()
+ SaveFileDialog dialog = new SaveFileDialog()
+ {
+ Title = "Where do you want to store the settings?",
+ InitialDirectory = Directory.Exists(xbmcDir) ? xbmcDir : defaultDir,
+ FileName = "usb_2548_1001.xml",
+ Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*",
+ FilterIndex = 1
+ };
+
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ FileStream fs = null;
+ string error = string.Empty;
+ try
{
- Title = "Where do you want to store the settings?",
- InitialDirectory = Directory.Exists(xbmcDir) ? xbmcDir : defaultDir,
- FileName = "usb_2548_1001.xml",
- Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*",
- FilterIndex = 1
- };
-
- if (dialog.ShowDialog() == DialogResult.OK)
+ fs = (FileStream)dialog.OpenFile();
+ }
+ catch (Exception ex)
{
- FileStream fs = null;
- string error = string.Empty;
- try
- {
- fs = (FileStream)dialog.OpenFile();
- }
- catch (Exception ex)
- {
- error = ex.Message;
- }
- if (fs == null)
- {
- MessageBox.Show("Cannot open '" + dialog.FileName + "' for writing" + (error.Length > 0 ? ": " + error : string.Empty ), "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- else
- {
- StreamWriter writer = new StreamWriter(fs);
- StringBuilder output = new StringBuilder();
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
-
- // only supported by 1.5.0+ clients
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
- output.AppendLine("");
-
- output.Append("");
-
- output.Append("");
-
- output.AppendLine("");
- writer.Write(output.ToString());
- writer.Close();
- fs.Close();
- fs.Dispose();
- MessageBox.Show("Settings are stored.", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
+ error = ex.Message;
+ }
+ if (fs == null)
+ {
+ MessageBox.Show("Cannot open '" + dialog.FileName + "' for writing" + (error.Length > 0 ? ": " + error : string.Empty ), "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ else
+ {
+ StreamWriter writer = new StreamWriter(fs);
+ StringBuilder output = new StringBuilder();
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+
+ // only supported by 1.5.0+ clients
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+ output.AppendLine("");
+
+ output.Append("");
+
+ output.Append("");
+
+ // only supported by 1.5.1+ clients
+ output.AppendLine("");
+ output.AppendLine("");
+
+ output.AppendLine("");
+ writer.Write(output.ToString());
+ writer.Close();
+ fs.Close();
+ fs.Dispose();
+ MessageBox.Show("Settings are stored.", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- SetControlsEnabled(true);
}
+ SetControlsEnabled(true);
}
- else
- {
- if (!Lib.PersistConfiguration(Config))
- MessageBox.Show("Could not persist the new settings.", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Error);
- else
- MessageBox.Show("Settings are stored.", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- SetControlsEnabled(true);
}
private void bReloadConfig_Click(object sender, EventArgs e)
@@ -1036,6 +1047,7 @@ namespace CecConfigGui
SetCheckboxChecked(cbActivateSource, Config.ActivateSource);
SetCheckboxChecked(cbPowerOffScreensaver, Config.PowerOffScreensaver);
SetCheckboxChecked(cbPowerOffOnStandby, Config.PowerOffOnStandby);
+ SetCheckboxChecked(cbSendInactiveSource, Config.SendInactiveSource);
UpdateSelectedDevice();
for (int iPtr = 0; iPtr < 15; iPtr++)