[longomatch] Open the new project panel for fake live projects



commit a2ddc0cfb95317843bfc3e42ed382c8e9005326f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Oct 28 01:10:21 2014 +0100

    Open the new project panel for fake live projects

 LongoMatch.GUI/Gui/Component/ProjectPeriods.cs  |   26 +++++++++++-----------
 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs     |    4 ++-
 LongoMatch.Services/Services/ProjectsManager.cs |   12 +--------
 3 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
index 9ff2662..ad94d85 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
@@ -78,22 +78,22 @@ namespace LongoMatch.Gui.Component
                                start = new Time (0);
                                duration = file.Duration;
                                pDuration = new Time (duration.MSeconds / gamePeriods.Count);
-                               List<Period> periods = new List<Period> ();
-                               gamePeriods = value.Dashboard.GamePeriods;
-                               
+                               if (project.Periods == null || project.Periods.Count == 0) {
+                                       List<Period> periods = new List<Period> ();
+                                       gamePeriods = value.Dashboard.GamePeriods;
+                                       foreach (string s in gamePeriods) {
+                                               Period period = new Period { Name = s };
+                                               period.StartTimer (start);
+                                               period.StopTimer (start + pDuration);
+                                               periods.Add (period);
+                                               start += pDuration;
+                                       }
+                                       value.Periods = periods;
+                               }
+                               timersTimeline.LoadPeriods (value.Periods, duration);
                                timerule.Duration = duration;
                                SetZoom ();
                                playerbin2.Open (value.Description.FileSet);
-                               
-                               foreach (string s in gamePeriods) {
-                                       Period period = new Period { Name = s };
-                                       period.StartTimer (start);
-                                       period.StopTimer (start + pDuration);
-                                       periods.Add (period);
-                                       start += pDuration;
-                               }
-                               value.Periods = periods;
-                               timersTimeline.LoadPeriods (periods, duration);
                        }
                }
 
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index 9a5aca6..2e7a994 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -84,6 +84,7 @@ namespace LongoMatch.Gui.Panel
                                notebook1.Page = 1;
                                this.project = project;
                                projectType = ProjectType.EditProject;
+                               SetProjectType ();
                                FillProjectDetails ();
                        }
                        UpdateTitle ();
@@ -199,7 +200,8 @@ namespace LongoMatch.Gui.Panel
                {
                        bool filemode = false, urimode = false, capturemode = false;
                        
-                       if (projectType == ProjectType.FileProject) {
+                       if (projectType == ProjectType.FileProject ||
+                           projectType == ProjectType.EditProject) {
                                filemode = true;
                        } else if (projectType == ProjectType.CaptureProject) {
                                capturemode = true;
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 0d39ef6..ff367c1 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -360,16 +360,8 @@ namespace LongoMatch.Services
                                /* If it's a fake live project prompt for a video file and
                                 * create a new PreviewMediaFile for this project and recreate the thumbnails 
*/
                                Log.Debug ("Importing fake live project");
-                               if (guiToolkit.SelectMediaFiles (project)) {
-                                       try {
-                                               Config.DatabaseManager.ActiveDB.UpdateProject (project);
-                                       } catch (Exception e) {
-                                               Log.Exception (e);
-                                       }
-                               } else {
-                                       guiToolkit.ErrorMessage (Catalog.GetString ("No valid video files 
associated. The project will be closed")); 
-                                       return;
-                               }
+                               Config.EventsBroker.EmitNewProject (project);
+                               return;
                        }
                        project.UpdateEventTypesAndTimers ();
                        SetProject (project, ProjectType.FileProject, new CaptureSettings ());


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