[chronojump] Removed free tasks



commit 9ff1e10c45e214ac52c9b1de56886f4b4b1b12d4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jun 29 15:18:13 2017 +0200

    Removed free tasks

 glade/dialog_person_popup.glade |   58 +------------------
 src/gui/dialogPersonPopup.cs    |   30 ++--------
 src/gui/networks.cs             |    5 +-
 src/json.cs                     |  126 ++++++++++++++++-----------------------
 4 files changed, 60 insertions(+), 159 deletions(-)
---
diff --git a/glade/dialog_person_popup.glade b/glade/dialog_person_popup.glade
index e6f1132..2b4679f 100644
--- a/glade/dialog_person_popup.glade
+++ b/glade/dialog_person_popup.glade
@@ -179,7 +179,7 @@
                   <widget class="GtkLabel" id="label23">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label">Tasques automàtiques</property>
+                    <property name="label">Tasques</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -193,62 +193,6 @@
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <widget class="GtkFrame" id="frame_tasks_free">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label_xalign">0</property>
-                <property name="label_yalign">0.69999998807907104</property>
-                <property name="shadow_type">out</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="top_padding">10</property>
-                    <property name="bottom_padding">10</property>
-                    <property name="left_padding">10</property>
-                    <property name="right_padding">10</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <widget class="GtkVBox" id="vbox_tasks_free">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <placeholder/>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label">Tasques lliures</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
           </widget>
           <packing>
             <property name="expand">False</property>
diff --git a/src/gui/dialogPersonPopup.cs b/src/gui/dialogPersonPopup.cs
index f982a47..d897534 100644
--- a/src/gui/dialogPersonPopup.cs
+++ b/src/gui/dialogPersonPopup.cs
@@ -33,9 +33,7 @@ public class DialogPersonPopup
        [Widget] Gtk.Image image_close;
        [Widget] Gtk.Label label_rfid;
        [Widget] Gtk.Frame frame_tasks_parametrized;
-       [Widget] Gtk.Frame frame_tasks_free;
        [Widget] Gtk.VBox vbox_tasks_parametrized;
-       [Widget] Gtk.VBox vbox_tasks_free;
 
        private List<Task> list_tasks_fixed; //This list has "R,L" separated
        private List<Gtk.Button> list_buttons_start;
@@ -87,7 +85,6 @@ public class DialogPersonPopup
                Fake_button_start_task = new Gtk.Button();
 
                bool task_parametrized_exist = false;
-               bool task_free_exist = false;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture.png");
 
                Gtk.HBox hboxRow;
@@ -117,10 +114,7 @@ public class DialogPersonPopup
                                hboxRow.PackStart(hboxStartAndLabel, false, false, 0);
                        }
 
-                       if(t.Type == 'P')
-                               task_parametrized_exist = true;
-                       else //
-                               task_free_exist = true;
+                       task_parametrized_exist = true;
 
                        //create button_done (shared on R,L)
                        Gtk.Button button_done = new Gtk.Button("Fet!");
@@ -130,21 +124,13 @@ public class DialogPersonPopup
                        list_buttons_done_id.Add(t.Id);
                        list_hboxs_row.Add(hboxRow);
 
-                       if(t.Type == 'P')
-                               vbox_tasks_parametrized.PackStart(hboxRow, false, false, 0);
-                       else // 'F'
-                               vbox_tasks_free.PackStart(hboxRow, false, false, 0);
+                       vbox_tasks_parametrized.PackStart(hboxRow, false, false, 0);
                }
 
                if(task_parametrized_exist)
                        vbox_tasks_parametrized.ShowAll();
                else
                        frame_tasks_parametrized.Visible = false;
-
-               if(task_free_exist)
-                       vbox_tasks_free.ShowAll();
-               else
-                       frame_tasks_free.Visible = false;
        }
 
        private Gtk.HBox createHBoxStartAndLabel(Task t, Pixbuf pixbuf)
@@ -153,16 +139,10 @@ public class DialogPersonPopup
                HBox hbox = new Gtk.HBox(false, 12);
                Button button_start;
 
-               if(t.Type == 'P')
-               {
-                       Gtk.Image image = new Gtk.Image();
-                       image.Pixbuf = pixbuf;
+               Gtk.Image image = new Gtk.Image();
+               image.Pixbuf = pixbuf;
 
-                       button_start = new Gtk.Button(image);
-               } else // 'F'
-               {
-                       button_start = new Gtk.Button("Prepara");
-               }
+               button_start = new Gtk.Button(image);
                button_start.Clicked += new EventHandler(button_start_clicked);
 
                hbox.PackStart(button_start, false, false, 0);
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 8a854cb..806bd50 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -604,9 +604,8 @@ public partial class ChronoJumpWindow
                }
                image_encoder_bell.Pixbuf = pixbuf;
 
-               //start test if task is parametrized
-               if(task.Type == 'P')
-                       on_button_encoder_capture_clicked (new object(), new EventArgs ());
+               //start test
+               on_button_encoder_capture_clicked (new object(), new EventArgs ());
        }
 
 
diff --git a/src/json.cs b/src/json.cs
index 2c46212..e54658c 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -459,26 +459,18 @@ public class Json
                        int exerciseId = jsonTask ["exerciseId"];
                        string exerciseName = jsonTask ["exerciseName"];
 
-                       if(type == 'F') //'F' Free
-                       {
-                               string comment = jsonTask ["comment"];
-                               tasks.Add(new Task(id, exerciseId, exerciseName, comment));
-                       }
-                       else //'P' Parametrized
-                       {
-                               int personId = jsonTask ["personId"];
-                               int stationId = jsonTask ["stationId"];
-                               int sets = jsonTask ["sets"];
-                               int nreps = jsonTask ["nreps"];
-                               float load = jsonTask ["load"];
-                               float speed = jsonTask ["speed"];
-                               float percentMaxSpeed = jsonTask ["percentMaxSpeed"];
-                               string laterality = jsonTask ["laterality"];
-                               string comment = jsonTask ["comment"];
-                               tasks.Add(new Task(id, personId, stationId, exerciseId, exerciseName,
-                                       sets, nreps, load, speed, percentMaxSpeed,
-                                       laterality, comment));
-                       }
+                       int personId = jsonTask ["personId"];
+                       int stationId = jsonTask ["stationId"];
+                       int sets = jsonTask ["sets"];
+                       int nreps = jsonTask ["nreps"];
+                       float load = jsonTask ["load"];
+                       float speed = jsonTask ["speed"];
+                       float percentMaxSpeed = jsonTask ["percentMaxSpeed"];
+                       string laterality = jsonTask ["laterality"];
+                       string comment = jsonTask ["comment"];
+                       tasks.Add(new Task(id, personId, stationId, exerciseId, exerciseName,
+                                               sets, nreps, load, speed, percentMaxSpeed,
+                                               laterality, comment));
                }
                return tasks;
        }
@@ -822,7 +814,7 @@ public class UploadEncoderDataObject
 public class Task
 {
        public int Id;
-       public char Type;
+       public char Type; //initially 'P'arametrized or 'F'ree. Now all are 'P'
        public int PersonId;
        public int StationId;
        public int ExerciseId;
@@ -841,16 +833,6 @@ public class Task
                Comment = "";
        }
 
-       public Task(int id, int exerciseId, string exerciseName, string comment)
-       {
-               Type = 'F'; //free
-
-               Id = id;
-               ExerciseId = exerciseId;
-               ExerciseName = exerciseName;
-               Comment = comment;
-       }
-
        public Task(int id, int personId, int stationId, int exerciseId, string exerciseName,
                        int sets, int nreps, float load, float speed, float percentMaxSpeed,
                        string laterality, string comment)
@@ -873,50 +855,46 @@ public class Task
 
        public override string ToString()
        {
-               if(Type == 'F')
-                       return ExerciseName + ": " + Comment;
-               else {
-                       string sep = "";
-                       string str = "";
-                       if (Laterality == "R" || Laterality == "L")
-                       {
-                               string lateralityStr = Catalog.GetString("Right");
-                               if (Laterality == "L")
-                                       lateralityStr = Catalog.GetString("Left");
+               string sep = "";
+               string str = "";
+               if (Laterality == "R" || Laterality == "L")
+               {
+                       string lateralityStr = Catalog.GetString("Right");
+                       if (Laterality == "L")
+                               lateralityStr = Catalog.GetString("Left");
 
-                               str += sep + lateralityStr;
-                               sep = "; ";
-                       }
-                       if (Load != -1)
-                       {
-                               str += sep + "Càrrega = " + Load.ToString() + " Kg";
-                               sep = "; ";
-                       }
-                       if (Sets != -1)
-                       {
-                               str += sep + "Series = " + Sets.ToString();
-                               sep = "; ";
-                       }
-                       if (Nreps != -1)
-                       {
-                               str += sep + "Repeticions = " + Nreps.ToString();
-                               sep = "; ";
-                       }
-                       if (Speed != -1)
-                       {
-                               str += sep + "Velocitat = " + Speed.ToString() + " m/s";
-                               sep = "; ";
-                       }
-                       if (PercentMaxSpeed != -1)
-                       {
-                               str += sep + "Velocitat = " + PercentMaxSpeed.ToString() + " %";
-                               sep = "; ";
-                       }
-                       if (Comment != "")
-                       {
-                               str += "\n" + Comment;
-                       }
-                       return ExerciseName + ": " + str;
+                       str += sep + lateralityStr;
+                       sep = "; ";
+               }
+               if (Load != -1)
+               {
+                       str += sep + "Càrrega = " + Load.ToString() + " Kg";
+                       sep = "; ";
+               }
+               if (Sets != -1)
+               {
+                       str += sep + "Series = " + Sets.ToString();
+                       sep = "; ";
+               }
+               if (Nreps != -1)
+               {
+                       str += sep + "Repeticions = " + Nreps.ToString();
+                       sep = "; ";
+               }
+               if (Speed != -1)
+               {
+                       str += sep + "Velocitat = " + Speed.ToString() + " m/s";
+                       sep = "; ";
+               }
+               if (PercentMaxSpeed != -1)
+               {
+                       str += sep + "Velocitat = " + PercentMaxSpeed.ToString() + " %";
+                       sep = "; ";
+               }
+               if (Comment != "")
+               {
+                       str += "\n" + Comment;
                }
+               return ExerciseName + ": " + str;
        }
 }


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