[chronojump] Fixed: 631505. Add units at result of server query



commit a1121aab394bf05d50291dcf2b9063ace982147c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 18 10:56:54 2011 +0100

    Fixed: 631505. Add units at result of server query

 glade/chronojump.glade |   88 +++++++++++++++++++++++++++++++-----------------
 src/gui/queryServer.cs |   32 ++++++++++++++++--
 2 files changed, 86 insertions(+), 34 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 102d3be..fba8e40 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12089,36 +12089,6 @@ comments</property>
               </packing>
             </child>
             <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
               <widget class="GtkLabel" id="label_distance_units">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
@@ -12163,6 +12133,36 @@ comments</property>
                 <property name="y_options"></property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="position">1</property>
@@ -16874,7 +16874,7 @@ by you</property>
                           <widget class="GtkTable" id="table72">
                             <property name="visible">True</property>
                             <property name="n_rows">2</property>
-                            <property name="n_columns">2</property>
+                            <property name="n_columns">3</property>
                             <property name="column_spacing">4</property>
                             <property name="row_spacing">4</property>
                             <child>
@@ -16927,6 +16927,32 @@ by you</property>
                                 <property name="y_options"></property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkLabel" id="label_results_num_units">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                              </widget>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="right_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label_results_avg_units">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                              </widget>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="right_attach">3</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="position">1</property>
diff --git a/src/gui/queryServer.cs b/src/gui/queryServer.cs
index 090e94a..61ff250 100644
--- a/src/gui/queryServer.cs
+++ b/src/gui/queryServer.cs
@@ -64,6 +64,8 @@ public class QueryServerWindow
 	[Widget] Gtk.Label label_speciallity;
 	[Widget] Gtk.Label label_results_num;
 	[Widget] Gtk.Label label_results_avg;
+	[Widget] Gtk.Label label_results_num_units;
+	[Widget] Gtk.Label label_results_avg_units;
 	
 	[Widget] Gtk.Image image_test_type;
 	[Widget] Gtk.Image image_country;
@@ -743,12 +745,14 @@ public class QueryServerWindow
 
 				string [] resultFull = result.Split(new char[] {':'});
 				label_results_num.Text = resultFull[0];
-				if(resultFull[0] == "0")
+
+				printUnits(resultFull[0]);
+		
+				if(resultFull[0] == "0") 
 					label_results_avg.Text = "-";
-				else {
+				else 
 					label_results_avg.Text = Util.TrimDecimals(
 						Util.ConvertToPointIfNeeded(resultFull[1]), pDN);
-}
 			}
 
 			return sqlString;
@@ -757,9 +761,31 @@ public class QueryServerWindow
 			//also on run (maybe because there's no data)
 			label_results_num.Text = "0";
 			label_results_avg.Text = "-";
+			printUnits("0");
 			return "";
 		}
 	}
+				
+	private void printUnits(string result) {
+		string testType = UtilGtk.ComboGetActive(combo_test_types);
+		if(testType == Catalog.GetString(Constants.JumpSimpleName) ||
+				testType == Catalog.GetString(Constants.JumpReactiveName))
+			label_results_num_units.Text = Catalog.GetString("jumps");
+		else if (testType == Catalog.GetString(Constants.RunSimpleName))
+			label_results_num_units.Text = Catalog.GetString("runs");
+
+		string strVariable = UtilGtk.ComboGetActive(combo_variables);
+		if(result == "0")
+			label_results_avg_units.Text = "";
+		else if(strVariable == "TV" || strVariable == "TC" || strVariable == Catalog.GetString("Time")) 
+			label_results_avg_units.Text = Catalog.GetString("seconds");
+		else if(strVariable == Constants.RJPotencyBoscoFormula)
+			label_results_avg_units.Text = Catalog.GetString("watts");
+		else if(strVariable == Constants.QIndexFormula)
+			label_results_avg_units.Text = "";
+		else
+			label_results_avg_units.Text = "%";
+	}
 
 	private void fillDialog ()
 	{



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