[chronojump] EncoderConfiguration on config
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] EncoderConfiguration on config
- Date: Mon, 15 Jun 2015 23:00:54 +0000 (UTC)
commit a142417dd71a8c2d817c90738e435311a510c551
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 16 00:56:37 2015 +0200
EncoderConfiguration on config
chronojump_config.txt | 4 ++++
src/config.cs | 23 ++++++++++++++++++++++-
src/gui/networks.cs | 6 ++++++
3 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/chronojump_config.txt b/chronojump_config.txt
index c6137ec..1f9200a 100644
--- a/chronojump_config.txt
+++ b/chronojump_config.txt
@@ -40,6 +40,10 @@ AutodetectPort=DISCARDFIRST
#Only Encoder. When connected to a machine and there's always encoder mode
OnlyEncoder=TRUE
+#EncoderConfiguration if exists, this will be used and cannot be changed
+#name:d:D:anglePush:angleWeight:inertiaMachine:gearedDown:inertiaTotal:extraWeightN:extraWeightGrams:extraWeightLenght
+EncoderConfiguration=ROTARYAXISINERTIAL:4:-1:-1:-1:42:1:71:2:300:7
+
#Session modes:
#STANDARD: default mode where sessions are created by user
#UNIQUE: there's only one session called "session". Menubar is hidden (use it only with OnlyEncoder = TRUE)
diff --git a/src/config.cs b/src/config.cs
index a042da4..34c9db3 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -32,6 +32,7 @@ public class Config
public bool UseVideo;
public AutodetectPortEnum AutodetectPort;
public bool OnlyEncoder;
+ public EncoderConfiguration Econf;
public SessionModeEnum SessionMode;
public string RunScriptOnExit;
@@ -42,6 +43,7 @@ public class Config
UseVideo = true;
AutodetectPort = AutodetectPortEnum.ACTIVE;
OnlyEncoder = false;
+ Econf = null;
SessionMode = SessionModeEnum.STANDARD;
RunScriptOnExit = "";
}
@@ -76,6 +78,19 @@ public class Config
Enum.Parse(typeof(AutodetectPortEnum), parts[1]);
else if(parts[0] == "OnlyEncoder" && Util.StringToBool(parts[1]))
OnlyEncoder = true;
+ else if(parts[0] == "EncoderConfiguration")
+ {
+ string [] ecFull = parts[1].Split(new char[] {':'});
+
if(Enum.IsDefined(typeof(Constants.EncoderConfigurationNames), ecFull[0]))
+ {
+ //create object
+ Econf = new EncoderConfiguration(
+ (Constants.EncoderConfigurationNames)
+
Enum.Parse(typeof(Constants.EncoderConfigurationNames), ecFull[0]) );
+ //assign the rest of params
+ Econf.ReadParamsFromSQL(ecFull);
+ }
+ }
else if(parts[0] == "SessionMode" &&
Enum.IsDefined(typeof(SessionModeEnum), parts[1]))
SessionMode = (SessionModeEnum)
Enum.Parse(typeof(SessionModeEnum), parts[1]);
@@ -86,13 +101,19 @@ public class Config
}
}
- public override string ToString() {
+ public override string ToString()
+ {
+ string econfStr = "";
+ if(Econf != null)
+ econfStr = Econf.ToStringPretty();
+
return(
"Maximized = " + Maximized.ToString() + "\n" +
"CustomButtons = " + CustomButtons.ToString() + "\n" +
"UseVideo = " + UseVideo.ToString() + "\n" +
"AutodetectPort = " + AutodetectPort.ToString() + "\n" +
"OnlyEncoder = " + OnlyEncoder.ToString() + "\n" +
+ "Econf = " + econfStr + "\n" +
"SessionMode = " + SessionMode.ToString() + "\n" +
"RunScriptOnExit = " + RunScriptOnExit.ToString() + "\n"
);
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 9717a85..0b7c956 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -70,6 +70,12 @@ public partial class ChronoJumpWindow
if(config.OnlyEncoder)
select_menuitem_mode_toggled(menuitem_modes.POWER);
+ if(config.Econf != null) {
+ encoderConfigurationCurrent = config.Econf;
+ encoderConfigurationGUIUpdate();
+ //TODO: allow to see full data, but don't allow to change it (Open window content as
unsensitive)
+ }
+
if(config.SessionMode == Config.SessionModeEnum.UNIQUE)
{
main_menu.Visible = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]