[chronojump] Added comments to signals from main GUI. Also comments not removed now on recalculate



commit 7dd9ef5de3f0359691b8d8a9787c92b09267134b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 3 17:48:17 2015 +0100

    Added comments to signals from main GUI. Also comments not removed now on recalculate

 glade/chronojump.glade |  195 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/gui/encoder.cs     |   33 ++++++--
 src/sqlite/main.cs     |   26 +++++-
 3 files changed, 240 insertions(+), 14 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index bf189ad..6207e8a 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6586,6 +6586,12 @@ Second Chronopic to platforms.</property>
                                                         <child>
                                                           <placeholder/>
                                                         </child>
+                                                        <child>
+                                                          <placeholder/>
+                                                        </child>
+                                                        <child>
+                                                          <placeholder/>
+                                                        </child>
                                                       </widget>
                                                       <packing>
                                                         <property name="expand">True</property>
@@ -7421,6 +7427,12 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -8508,6 +8520,12 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -9236,6 +9254,12 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -14108,6 +14132,87 @@ on current Chronojump version.</property>
                                                         <property name="position">1</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkFrame" 
id="frame_encoder_signal_comment">
+                                                        <property name="visible">True</property>
+                                                        <property name="sensitive">False</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label_xalign">0</property>
+                                                        <property name="shadow_type">none</property>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox75">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkTextView" 
id="textview_encoder_signal_comment">
+                                                            <property name="width_request">150</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox96">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">8</property>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_encoder_signal_comment_apply">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_encoder_signal_comment_apply_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_signal_delete1">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-apply</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkLabel" id="label124">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Commentary</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">True</property>
+                                                        <property name="position">2</property>
+                                                      </packing>
+                                                    </child>
                                                   </widget>
                                                   <packing>
                                                     <property name="top_attach">1</property>
@@ -19630,6 +19735,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -20266,6 +20377,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -21394,6 +21511,12 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -21579,6 +21702,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -31291,6 +31420,42 @@ options</property>
                             <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>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -33307,6 +33472,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                             </child>
                           </widget>
@@ -33981,6 +34152,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -36621,6 +36798,12 @@ show elevation as:</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -36921,6 +37104,12 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -37236,6 +37425,12 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 2048b0d..abd8e5a 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -66,9 +66,12 @@ public partial class ChronoJumpWindow
        //[Widget] Gtk.Entry entry_encoder_signal_comment;
        //[Widget] Gtk.Entry entry_encoder_curve_comment;
        //[Widget] Gtk.Button button_encoder_save_curve;
+       [Widget] Gtk.Frame frame_encoder_signal_comment;
+       [Widget] Gtk.TextView textview_encoder_signal_comment;
        [Widget] Gtk.Button button_encoder_export_all_curves;
        [Widget] Gtk.Label label_encoder_curve_action;
        [Widget] Gtk.Button button_encoder_delete_signal;
+       
                
        //encoder video
        [Widget] Gtk.Notebook notebook_video_encoder;
@@ -529,7 +532,7 @@ public partial class ChronoJumpWindow
                        encoderProcessFinish = false;
                        encoderThreadStart(encoderActions.CAPTURE);
                        
-                       //entry_encoder_signal_comment.Text = "";
+                       textview_encoder_signal_comment.Buffer.Text = "";
 
                        LogB.Debug("end of Calling encoderThreadStart for capture");
                //}
@@ -679,6 +682,19 @@ public partial class ChronoJumpWindow
                encoderCalculeCurves(encoderActions.CURVES);
        }
 
+       void on_button_encoder_signal_comment_apply_clicked (object o, EventArgs args) {
+               LogB.Debug(encoderSignalUniqueID);
+               if(encoderSignalUniqueID != null && Convert.ToInt32(encoderSignalUniqueID) > 0) {
+                       Sqlite.Update(false, Constants.EncoderTable, "description", "", 
+                                       
Util.RemoveTildeAndColonAndDot(textview_encoder_signal_comment.Buffer.Text), 
+                                       "uniqueID", encoderSignalUniqueID);
+                       new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Saved."));
+               }
+       }
+
+
+
+
        private void encoderUpdateTreeViewCapture(string contents)
        {
                if (contents == null || contents == "") {
@@ -770,7 +786,7 @@ public partial class ChronoJumpWindow
                                "",     //path,                 //url
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_time.Value, 
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_min_height.Value, 
-                               "",             //desc,
+                               Util.RemoveTildeAndColonAndDot(textview_encoder_signal_comment.Buffer.Text), 
//desc,
                                "", videoURL,           //status, videoURL
                                encoderConfigurationCurrent,
                                "","","",       //future1, 2, 3
@@ -1335,7 +1351,7 @@ public partial class ChronoJumpWindow
                                spin_encoder_extra_weight.Value = Convert.ToInt32(eSQL.extraWeight);
 
                                encoderCaptureOptionsWin.spin_encoder_capture_min_height.Value = 
eSQL.minHeight;
-                               //entry_encoder_signal_comment.Text = eSQL.description;
+                               textview_encoder_signal_comment.Buffer.Text = eSQL.description;
                                encoderTimeStamp = eSQL.GetDate(false); 
                                encoderSignalUniqueID = eSQL.uniqueID;
                        
@@ -1657,7 +1673,7 @@ public partial class ChronoJumpWindow
                UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, 
encoder_capture_curves_bars_pixmap);
                encoderButtonsSensitive(encoderSensEnum.DONENOSIGNAL);
                encoder_pulsebar_capture.Text = Catalog.GetString("Set deleted");
-               //entry_encoder_signal_comment.Text = "";
+               textview_encoder_signal_comment.Buffer.Text = "";
        }
 
        private int getActiveCurvesNum(ArrayList curvesArray) {
@@ -1811,8 +1827,7 @@ public partial class ChronoJumpWindow
                                }
                        }
                
-                       //desc = Util.RemoveTildeAndColonAndDot(entry_encoder_curve_comment.Text.ToString());
-                       desc = "";
+                       desc = Util.RemoveTildeAndColonAndDot(textview_encoder_signal_comment.Buffer.Text);
 
                        LogB.Information(curveStart + "->" + duration);
                
@@ -1837,8 +1852,7 @@ public partial class ChronoJumpWindow
 
                        path = UtilEncoder.GetEncoderSessionDataCurveDir(currentSession.UniqueID);
                } else { //signal
-                       //desc = Util.RemoveTildeAndColonAndDot(entry_encoder_signal_comment.Text.ToString());
-                       desc = "";
+                       desc = Util.RemoveTildeAndColonAndDot(textview_encoder_signal_comment.Buffer.Text);
 
                        fileSaved = UtilEncoder.CopyTempToEncoderData (currentSession.UniqueID, 
currentPerson.UniqueID, 
                                        currentPerson.Name, encoderTimeStamp);
@@ -3726,7 +3740,7 @@ public partial class ChronoJumpWindow
                //c1 button_encoder_recalculate
                //c2 button_encoder_load_signal
                //c3 hbox_encoder_capture_curves_save_all_none, button_encoder_export_all_curves,
-               //      button_encoder_delete_signal, entry_encoder_signal_comment,
+               //      button_encoder_delete_signal, frame_encoder_signal_comment,
                //      and images: image_encoder_capture , image_encoder_analyze.Sensitive. Update: both NOT 
managed here
                //UNUSED c4 button_encoder_save_curve, entry_encoder_curve_comment
                //c5 button_encoder_analyze
@@ -3793,6 +3807,7 @@ public partial class ChronoJumpWindow
                hbox_encoder_capture_curves_save_all_none.Sensitive = Util.IntToBool(table[3]);
                button_encoder_export_all_curves.Sensitive = Util.IntToBool(table[3]);
                button_encoder_delete_signal.Sensitive = Util.IntToBool(table[3]);
+               frame_encoder_signal_comment.Sensitive = Util.IntToBool(table[3]);
                //image_encoder_capture.Sensitive = Util.IntToBool(table[3]);
                //image_encoder_analyze.Sensitive = Util.IntToBool(table[3]);
                
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index eeae579..c957968 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -2764,20 +2764,36 @@ LogB.SQL("5" + tableName);
                return myReturn;
        }
 
+       //if we want to use the condition2 but not the searchValue, leave this as ""
        public static void Update(bool dbconOpened, string tableName, string columnName, string searchValue, 
string newValue, 
                        string columnNameCondition2, string searchValueCondition2)
        {
                if( ! dbconOpened)
                        Sqlite.Open();
                
-               string andStr = "";
-               if(columnNameCondition2 != "" && searchValueCondition2 != "")
-                       andStr = " AND " + columnNameCondition2 + " == '" + searchValueCondition2 + "'"; 
+               bool whereDone = false;
+               string cond1 = "";
+               if(searchValue != "") {
+                       cond1 = " WHERE " + columnName + " == '" + searchValue + "'";
+                       whereDone = true;
+               }
+
+               string cond2 = "";
+               if(columnNameCondition2 != "" && searchValueCondition2 != "") 
+               {
+                       string cond2Pre = "";
+                       if(whereDone)
+                               cond2Pre = " AND ";
+                       else
+                               cond2Pre = " WHERE ";
+
+                       cond2 = cond2Pre + columnNameCondition2 + " == '" + searchValueCondition2 + "'"; 
+               }
 
                dbcmd.CommandText = "Update " + tableName +
                        " SET " + columnName + " = '" + newValue + "'" +  
-                       " WHERE " + columnName + " == '" + searchValue + "'" + 
-                       andStr
+                       cond1 +
+                       cond2
                        ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();


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