[chronojump] RSA users can define tests



commit 717ee1048a48f3f8bb5993a3f1a2991824dd8941
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jan 6 13:22:51 2013 +0100

    RSA users can define tests

 glade/chronojump.glade |   18 +++++++++++++++++-
 src/gui/runType.cs     |   39 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 51 insertions(+), 6 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 1e77145..2ef39b0 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -29664,7 +29664,7 @@ suitable for agility tests)</property>
                                   <widget class="GtkLabel" id="label547">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">Number of tracks</property>
+                                    <property name="label" translatable="yes">Number of different tracks</property>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -29693,6 +29693,22 @@ suitable for agility tests)</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <widget class="GtkButton" id="button_help_rsa">
+                                    <property name="label" translatable="yes">Help RSA</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <signal name="clicked" handler="on_button_help_rsa_clicked" swapped="no"/>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="pack_type">end</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
                               </widget>
                               <packing>
                                 <property name="expand">True</property>
diff --git a/src/gui/runType.cs b/src/gui/runType.cs
index 7eb6462..60dc07e 100644
--- a/src/gui/runType.cs
+++ b/src/gui/runType.cs
@@ -354,6 +354,19 @@ public class RunTypeAddWindow
 		}
 		hbox_distance_variable.ShowAll();
 	}
+	
+	private void on_button_help_rsa_clicked (object o, EventArgs args) {
+		new DialogMessage(Constants.MessageTypes.HELP, 
+				Catalog.GetString("On RSA tests, rest time counts as a \"track\".") + 
+				"\n" + 	Catalog.GetString("You should write the time in seconds after a capital 'R' (meaning \"Rest\").") + 
+				"\n\n" + 	Catalog.GetString("Eg. A test that repeats 5 times the following sequence:") + 
+				"\n\n\t" + Catalog.GetString("Run 10 meters, run 8 meters, rest 4 seconds.") + 
+				"\n\n" + Catalog.GetString("Will be limited by tracks with a fixed value of 15") + 
+				"\n" + Catalog.GetString("(3 different tracks x 5 times)") + 
+				"\n\n" + Catalog.GetString("And the 'distance' of each track will be:") + 
+				"\n\n\t10, 8, R4"
+				);
+	}
 
 	private string getEntriesString () {
 		string str = "";
@@ -379,12 +392,28 @@ public class RunTypeAddWindow
 
 		if(radiobutton_dist_different.Active) {
 			string ddString = getEntriesString();
-			string [] s = ddString.Split(new char[] {'-'});
-			foreach (string myS in s)
-				if( ! Util.IsNumber(myS, true)) {
-					button_accept.Sensitive = false;
-					return;
+			string [] ddSplitted = ddString.Split(new char[] {'-'});
+			bool distancesAreOk = true;
+			foreach (string s in ddSplitted) {
+				string s2 = s;
+
+				if( s2.Length == 0) {
+					distancesAreOk = false;
+					break;
+				}
+
+				if( s2.Length > 1 && s2[0] == 'R')
+					s2 = s2.Substring(1);
+
+				if( ! Util.IsNumber(s2, true)) {
+					distancesAreOk = false;
+					break;
 				}
+			}
+			if(! distancesAreOk) {
+				button_accept.Sensitive = false;
+				return;
+			}
 		}
 			
 		button_accept.Sensitive = true;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]