[chronojump] encoder fixed change repetitions owner when set owner (person) changes
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder fixed change repetitions owner when set owner (person) changes
- Date: Thu, 16 May 2019 16:29:44 +0000 (UTC)
commit c7c3e9bc5091c4de0b039876117141847d3d88e0
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu May 16 18:28:44 2019 +0200
encoder fixed change repetitions owner when set owner (person) changes
src/gui/encoder.cs | 50 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 900fbb23..973c17f6 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1746,35 +1746,55 @@ public partial class ChronoJumpWindow
genericWin.ShowEditRow(true);
}
- protected void on_encoder_load_signal_row_edit_apply (object o, EventArgs args) {
+ protected void on_encoder_load_signal_row_edit_apply (object o, EventArgs args)
+ {
LogB.Information("row edit apply at load signal");
-
- int curveID = genericWin.TreeviewSelectedUniqueID;
- EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, curveID, 0, 0,
Constants.EncoderGI.ALL,
- -1, "", EncoderSQL.Eccons.ALL, false, true)[0];
- //if changed comment, update SQL, and update treeview
+ //1) select set
+ int setID = genericWin.TreeviewSelectedUniqueID;
+ EncoderSQL eSQL_set = (EncoderSQL) SqliteEncoder.Select(false, setID, 0, 0,
Constants.EncoderGI.ALL,
+ -1, "", EncoderSQL.Eccons.ALL, false, true)[0];
+
+ //2) if changed comment, update SQL, and update treeview
//first remove conflictive characters
string comment = Util.RemoveTildeAndColonAndDot(genericWin.EntryEditRow);
- if(comment != eSQL.description) {
- eSQL.description = comment;
- SqliteEncoder.Update(false, eSQL);
+ if(comment != eSQL_set.description)
+ {
+ eSQL_set.description = comment;
+ SqliteEncoder.Update(false, eSQL_set);
//update treeview
genericWin.on_edit_selected_done_update_treeview();
}
- //if changed person, proceed
- LogB.Information("new person: " + genericWin.GetComboSelected);
- int newPersonID = Util.FetchID(genericWin.GetComboSelected);
- if(newPersonID != currentPerson.UniqueID) {
- EncoderSQL eSQLChangedPerson = eSQL.ChangePerson(genericWin.GetComboSelected);
+ //3) change the session param and the url of signal and curves (if any)
+ string idName = genericWin.GetComboSelected;
+ LogB.Information("new person: " + idName);
+ int newPersonID = Util.FetchID(idName);
+ if(newPersonID != currentPerson.UniqueID)
+ {
+ //change stuff on signal
+ EncoderSQL eSQLChangedPerson = eSQL_set.ChangePerson(idName);
SqliteEncoder.Update(false, eSQLChangedPerson);
-
genericWin.RemoveSelectedRow();
+
+ //select linkedReps (if any)
+ ArrayList linkedReps = SqliteEncoder.SelectSignalCurve(
+ false, setID, -1, -1, -1); //DBopened, signal, curve, msStart,
msEnd
+
+ //change stuff on repetitions (if any)
+ foreach (EncoderSignalCurve esc in linkedReps)
+ {
+ EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, esc.curveID, 0, 0,
Constants.EncoderGI.ALL,
+ -1, "curve", EncoderSQL.Eccons.ALL, false, true)[0];
+
+ eSQLChangedPerson = eSQL.ChangePerson(idName);
+ SqliteEncoder.Update(false, eSQLChangedPerson);
+ }
}
genericWin.ShowEditRow(false);
+ //TODO: make the current set on app1 unsensitive, because maybe we changed the already loaded
set
}
protected void on_encoder_load_signal_row_delete_pre (object o, EventArgs args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]