[cheese/tpo: 6/6] Added noir effect, and simple effect parsing code in new EffectsManager class



commit 03d8a3da06f5da6570f8ca6cf335e463624557d0
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Fri Jun 25 04:49:07 2010 +0530

    Added noir effect, and simple effect parsing code in new EffectsManager class

 data/effects/Makefile.am            |    7 +++++++
 data/effects/noir.effect            |    3 +++
 valasrc/Makefile.am                 |    1 +
 valasrc/cheese-effects-manager.vala |   17 +++++++++++++++++
 valasrc/cheese-window.vala          |    8 ++++----
 valasrc/vapi/cheese-common.vapi     |    4 ++--
 6 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/data/effects/Makefile.am b/data/effects/Makefile.am
new file mode 100644
index 0000000..28a2c3a
--- /dev/null
+++ b/data/effects/Makefile.am
@@ -0,0 +1,7 @@
+Datadir = $(datadir)/cheese/effects
+
+Data_DATA = noir.effect
+
+EXTRA_DIST =			\
+	$(Data_DATA)
+
diff --git a/data/effects/noir.effect b/data/effects/noir.effect
new file mode 100644
index 0000000..69a488a
--- /dev/null
+++ b/data/effects/noir.effect
@@ -0,0 +1,3 @@
+[effect]
+name=Noir
+pipeline_desc=videobalance saturation=0
\ No newline at end of file
diff --git a/valasrc/Makefile.am b/valasrc/Makefile.am
index cccf2ea..bae91a1 100644
--- a/valasrc/Makefile.am
+++ b/valasrc/Makefile.am
@@ -36,6 +36,7 @@ cheese_SOURCES = \
 	cheese-main.vala \
 	cheese-window.vala \
 	cheese-countdown.vala \
+	cheese-effects-manager.vala \
 	thumbview/cheese-gconf.c \
 	thumbview/cheese-thumb-view.c \
 	thumbview/eog-thumb-nav.c \
diff --git a/valasrc/cheese-effects-manager.vala b/valasrc/cheese-effects-manager.vala
new file mode 100644
index 0000000..3f63a6d
--- /dev/null
+++ b/valasrc/cheese-effects-manager.vala
@@ -0,0 +1,17 @@
+using GLib;
+
+const string GROUP_NAME = "effect";
+
+internal class Cheese.EffectsManager : GLib.Object
+{
+	public static Cheese.Effect parse_effect_file(string filename)
+	{
+		KeyFile kf = new KeyFile();
+		kf.load_from_file (filename, KeyFileFlags.NONE);
+		Effect eff = new Effect();
+		eff.name = kf.get_string (GROUP_NAME, "name");
+		eff.pipeline_desc = kf.get_string (GROUP_NAME, "pipeline_desc");
+		critical("%s", eff.pipeline_desc);
+		return eff;
+	}
+}
\ No newline at end of file
diff --git a/valasrc/cheese-window.vala b/valasrc/cheese-window.vala
index e31b0c2..c6ffd63 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -60,7 +60,8 @@ public class Cheese.MainWindow : Gtk.Window
   private Cheese.FileUtil fileutil;
   private Cheese.Flash    flash;
   private Cheese.GConf    conf;
-
+  private Cheese.EffectsManager effects_manager;
+  
   [CCode (instance_pos = -1)]
   internal void on_quit (Action action)
   {
@@ -470,9 +471,8 @@ public class Cheese.MainWindow : Gtk.Window
     camera.setup (conf.gconf_prop_camera);
     camera.play ();
 
-	Effect e = new Effect();
-	e.name = "blah";
-	e.pipeline_desc = "warptv";
+	string mock_path = GLib.Path.build_filename (Config.PACKAGE_DATADIR, "effects", "noir.effect");
+	Effect e = EffectsManager.parse_effect_file (mock_path);
 	camera.set_effect(e);
 
     set_wide_mode (conf.gconf_prop_wide_mode, true);
diff --git a/valasrc/vapi/cheese-common.vapi b/valasrc/vapi/cheese-common.vapi
index 9019ccb..37c0420 100644
--- a/valasrc/vapi/cheese-common.vapi
+++ b/valasrc/vapi/cheese-common.vapi
@@ -9,9 +9,9 @@ namespace Cheese
 		[CCode (has_construct_function = false)]
 		public Effect ();
 		[NoAccessorMethod]
-		public string name {get; set;}
+		public string name {owned get; set;}
 		[NoAccessorMethod]
-		public string pipeline_desc {get; set;}
+		public string pipeline_desc {owned get; set;}
 	}
 
   [CCode (cheader_filename = "cheese-camera.h")]



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