[longomatch/fakelive] Save fake live projects to a file when the capture finishes



commit efaabd0d4be2453aaa4bec130cfb85af47cc56dc
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Mar 6 23:58:11 2010 +0100

    Save fake live projects to a file when the capture finishes

 LongoMatch/Gui/MainWindow.cs |   46 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 40 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 0b9a28e..2ca1a7c 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -149,6 +149,9 @@ namespace LongoMatch.Gui
 					Title = "LongoMatch";
 					playerbin1.Visible = false;					
 					capturerBin = new CapturerBin();
+					capturerBin.CaptureFinished += delegate {
+						CloseActualProyect();	
+					};
 					eManager.Capturer = capturerBin;
 					hbox2.Add(capturerBin);
 					(capturerBin).Show();	
@@ -172,21 +175,25 @@ namespace LongoMatch.Gui
 		}
 
 		private void CloseActualProyect() {
-			bool playlistVisible = playlistwidget2.Visible;
+			bool playlistVisible = playlistwidget2.Visible;			
 			
-			Title = "LongoMatch";
-			ClearWidgets();
-			HideWidgets();	
 			if (projectType != ProjectType.NewFileProject){
+				if (projectType == ProjectType.NewFakeCaptureProject)
+					if (!SaveFakeLiveProject(openedProject))
+						return;
 				playerbin1.Visible = true;
 				eManager.Capturer = null;
 				if (capturerBin != null)
-					capturerBin.Destroy();			
-			}
+					capturerBin.Destroy();
+			}			
 			else {
 				playerbin1.Close();
 				playerbin1.LogoMode = true;
 			}
+			Title = "LongoMatch";
+			ClearWidgets();
+			HideWidgets();	
+			
 			if (openedProject != null) {
 				openedProject.Clear();
 				openedProject = null;
@@ -261,6 +268,33 @@ namespace LongoMatch.Gui
 			md.Destroy();			
 			return res;
 		}
+		
+		private bool SaveFakeLiveProject(Project project){
+			bool res = false;
+			MessagePopup.PopupMessage(this.Toplevel, MessageType.Info, 
+			                          Catalog.GetString("The project will be saved to a file. To add it to the databse, use the "+
+			                                            "Import function after adding the associated video file to your computer."));
+			                                                                             
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
+			                (Gtk.Window)Toplevel,
+			                FileChooserAction.Save,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-save",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.HomeDir());
+			FileFilter filter = new FileFilter();
+			filter.Name = "LongoMatch Project";
+			filter.AddPattern("*.lpr");
+
+			fChooser.AddFilter(filter);
+			if (fChooser.Run() == (int)ResponseType.Accept) {
+				Project.Export(project, fChooser.Filename);
+				MessagePopup.PopupMessage(this.Toplevel, MessageType.Info, 
+				                          Catalog.GetString("Project saved successfully"));			  
+				res = true;
+			}
+			fChooser.Destroy();
+			return res;
+		}
 
 		#endregion
 



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