[longomatch] Only resync events for newly created projects with periods info



commit f96e8f0a851e1029bc24e25c2d3f07df80064c2a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Apr 1 21:23:49 2015 +0200

    Only resync events for newly created projects with periods info

 LongoMatch.GUI/Gui/Component/ProjectPeriods.cs   |    9 ++++-----
 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs      |    4 +++-
 LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs |    5 ++++-
 3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
index e10ac03..321f500 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
@@ -41,7 +41,6 @@ namespace LongoMatch.Gui.Component
                Project project;
                PeriodsMenu menu;
                Dictionary<Period, Period> periodsDict;
-               bool projectHasPeriods;
                double maxSecondsPerPixels;
 
                enum DidacticMessage
@@ -164,10 +163,12 @@ namespace LongoMatch.Gui.Component
                        }
                }
 
-               public void SaveChanges ()
+               public void SaveChanges (bool resyncEvents)
                {
-                       if (!projectHasPeriods)
+
+                       if (!resyncEvents)
                                return;
+
                        foreach (Period p in periodsDict.Keys) {
                                Period newp = periodsDict [p];
                                TimeNode tn = p.PeriodNode;
@@ -210,7 +211,6 @@ namespace LongoMatch.Gui.Component
                                                start += pDuration;
                                        }
                                        value.Periods = periods;
-                                       projectHasPeriods = false;
                                } else {
                                        periodsDict = new Dictionary <Period, Period> ();
                                        foreach (Period p in project.Periods) {
@@ -218,7 +218,6 @@ namespace LongoMatch.Gui.Component
                                                newp.Nodes.Add (p.PeriodNode);
                                                periodsDict.Add (p, newp);
                                        }
-                                       projectHasPeriods = true;
                                        periods = periodsDict.Values.ToList ();
                                }
 
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index 4b17805..32a2805 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -58,6 +58,7 @@ namespace LongoMatch.Gui.Panel
                Dashboard analysisTemplate;
                TeamTagger teamtagger;
                SizeGroup sg;
+               bool resyncEvents;
 
                public NewProjectPanel (Project project)
                {
@@ -84,6 +85,7 @@ namespace LongoMatch.Gui.Panel
                                notebook1.Page = firstPage = 1;
                                this.project = project;
                                projectType = ProjectType.EditProject;
+                               resyncEvents = true;
                                SetProjectType ();
                                FillProjectDetails ();
                        }
@@ -516,7 +518,7 @@ namespace LongoMatch.Gui.Panel
                        } else if (notebook1.Page == PROJECT_PERIODS) {
                                // Pause playback and then save periods changes into the project. Fileset has 
already been updated.
                                projectperiods1.Pause ();
-                               projectperiods1.SaveChanges ();
+                               projectperiods1.SaveChanges (resyncEvents);
                                StartProject ();
                                return;
                        }
diff --git a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs 
b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
index fe55ec4..020f188 100644
--- a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
@@ -167,7 +167,10 @@ namespace LongoMatch.Gui.Panel
                                }
                        } else {
                                projectperiods1.Pause ();
-                               projectperiods1.SaveChanges ();
+                               /* FIXME: we don't support adding new cameras, so there is nothing
+                                * to fix or update */
+                               //projectperiods1.SaveChanges (false);
+
                                // We need to reload project details
                                LoadProject (loadedProject);
                                // And remember that the project has changed


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