[cheese/three-point-oh] Wonky support for Burst mode



commit bf2e5df834c218800becf1a525753e6d3f1be21e
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Wed Jun 9 02:21:58 2010 +0530

    Wonky support for Burst mode

 valasrc/cheese-window.vala |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/valasrc/cheese-window.vala b/valasrc/cheese-window.vala
index 4a1fe15..ac6ef63 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -48,6 +48,7 @@ public class Cheese.MainWindow : Gtk.Window {
 	private bool is_fullscreen;
 	private bool is_wide_mode;
 	private bool is_recording; // Video Recording Flag
+	private bool is_bursting;
 	
 	private Gtk.Button[] buttons;
 
@@ -267,11 +268,19 @@ public class Cheese.MainWindow : Gtk.Window {
 	{
 		this.viewport_layout.set_size(viewport.width, viewport.height);
 	}
+
+	internal void take_photo() {
+		string file_name = fileutil.get_new_media_filename(this.current_mode);
+		camera.take_photo(file_name);
+		// FIXME: 3 second delay, to make sure we get unique photo_names.
+		// Flash, countdown, etc, should make this better and *non blocking*
+		GLib.Thread.usleep(1 * 1000 * 1000); 
+	}
 	
 	[CCode (instance_pos = -1)]
 	internal void on_take_action (Action action ) {
 		if (current_mode == MediaMode.PHOTO) {
-			camera.take_photo(fileutil.get_new_media_filename(this.current_mode));
+			this.take_photo();
 		}
 		else if (current_mode == MediaMode.VIDEO) {
 			if (!is_recording) {
@@ -289,6 +298,21 @@ public class Cheese.MainWindow : Gtk.Window {
 				this.enable_mode_change();
 			}
 		}
+		else if (current_mode == MediaMode.BURST) {
+			int burst_count = 3;
+			is_bursting = true;
+			this.disable_mode_change();
+			take_action_button.sensitive = false;
+			for (int i = 0; i < burst_count; i++) {
+				if (is_bursting) {
+					this.take_photo();
+				}
+			}
+			this.is_bursting = false;
+			this.enable_mode_change();
+			take_action_button.sensitive = true;
+			fileutil.reset_burst();
+		}
 	}
 	
 	public	void setup_ui () {



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