cheese r756 - in branches/cheese-vala: . src
- From: jhaitsma svn gnome org
- To: svn-commits-list gnome org
- Subject: cheese r756 - in branches/cheese-vala: . src
- Date: Sat, 7 Jun 2008 10:39:12 +0000 (UTC)
Author: jhaitsma
Date: Sat Jun 7 10:39:12 2008
New Revision: 756
URL: http://svn.gnome.org/viewvc/cheese?rev=756&view=rev
Log:
more stuff
Modified:
branches/cheese-vala/ (props changed)
branches/cheese-vala/src/Makefile.am
branches/cheese-vala/src/cheese-flash.vala
branches/cheese-vala/src/cheese-webcam.vala
branches/cheese-vala/src/cheese-window.vala
Modified: branches/cheese-vala/src/Makefile.am
==============================================================================
--- branches/cheese-vala/src/Makefile.am (original)
+++ branches/cheese-vala/src/Makefile.am Sat Jun 7 10:39:12 2008
@@ -34,6 +34,7 @@
cheese_VALASOURCES = \
cheese.vala \
cheese-audio.vala \
+ cheese-flash.vala \
cheese-window.vala \
cheese-thumb-view.vala \
cheese-webcam.vala
Modified: branches/cheese-vala/src/cheese-flash.vala
==============================================================================
--- branches/cheese-vala/src/cheese-flash.vala (original)
+++ branches/cheese-vala/src/cheese-flash.vala Sat Jun 7 10:39:12 2008
@@ -100,10 +100,11 @@
return false;
}
- bool on_expose_event (Widget widget, EventExpose event) {
- Context ctx = Gdk.cairo_create (widget.window);
+ bool on_expose_event (Gtk.Window window, Gdk.Event event) {
+ Context ctx = Gdk.cairo_create (window.window);
ctx.set_source_rgb (1, 1, 1);
- ctx.rectangle (event.area.x, event.area.y, event.area.width, event.area.height);
+ EventExpose e = event.expose;
+ ctx.rectangle (e.area.x, e.area.y, e.area.width, e.area.height);
ctx.fill ();
return true;
}
Modified: branches/cheese-vala/src/cheese-webcam.vala
==============================================================================
--- branches/cheese-vala/src/cheese-webcam.vala (original)
+++ branches/cheese-vala/src/cheese-webcam.vala Sat Jun 7 10:39:12 2008
@@ -130,6 +130,8 @@
bool pipeline_is_playing = false;
string photo_filename;
+ Flash flash = new Flash ();
+
public Webcam (Widget window) {
this.video_window = window;
}
@@ -214,7 +216,7 @@
photo_filename = filename;
/* Take the photo by connecting the handoff signal */
photo_handler_id = Signal.connect (photo_sink, "handoff", (GLib.Callback)on_photo_data, this);
- // flash.fire ();
+ flash.fire ();
}
public ArrayList<Device> get_devices () {
Modified: branches/cheese-vala/src/cheese-window.vala
==============================================================================
--- branches/cheese-vala/src/cheese-window.vala (original)
+++ branches/cheese-vala/src/cheese-window.vala Sat Jun 7 10:39:12 2008
@@ -24,6 +24,11 @@
public class Cheese.CheeseWindow : Builder {
+ enum Mode {
+ PHOTO,
+ VIDEO
+ }
+
const string[] authors = {
"daniel g. siegel <dgsiegel gmail com>",
"Jaap A. Haitsma <jaap haitsma org>",
@@ -38,16 +43,14 @@
N_("You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.")
};
- bool recording = false;
+ bool is_recording = false;
string media_path;
string video_filename;
string photo_filename;
- int counter = 0;
-
Webcam webcam;
- //WebcamMode webcam_mode;
+ Mode mode;
const string GCONF_COUNTDOWN_KEY = "/apps/cheese/countdown";
const string GCONF_WEBCAM_KEY = "/apps/cheese/webcam";
@@ -77,7 +80,7 @@
ToggleButton button_photo;
ToggleButton button_video;
- Widget image_take_photo;
+ Image image_take_photo;
Label label_effects;
Label label_photo;
Label label_take_photo;
@@ -106,8 +109,6 @@
UIManager ui_manager;
- int audio_play_counter = 0;
- Rand rand = new Rand();
const ActionEntry[] action_entries_main = {
{"Cheese", null, N_("_Cheese")},
@@ -167,6 +168,8 @@
public void setup () {
media_path = Path.build_filename (Environment.get_home_dir(), ".local", "share", "cheese", "media");
DirUtils.create_with_parents (media_path, 0775);
+ mode = Mode.PHOTO;
+
setup_ui ();
webcam = new Webcam (screen);
@@ -202,11 +205,11 @@
}
void on_photo_saved () {
-
+ print ("on_photo_saved ()\n");
}
void on_video_saved () {
-
+ print ("on_video_saved ()\n");
}
void on_quit (Action action) {
@@ -251,15 +254,50 @@
}
void on_take_photo_action (Action action) {
+ take_photo ();
}
void on_recording_action (Action action) {
+ if (!is_recording) {
+ start_recording ();
+ } else {
+ stop_recording ();
+ }
}
void on_action_button (Button button) {
- Audio.play_file (Path.build_filename (Config.PACKAGE_DATADIR, "sounds", "shutter0.ogg"));
+ if (mode == Mode.PHOTO) {
+ take_photo ();
+ } else if (mode == Mode.VIDEO) {
+ if (!is_recording) {
+ start_recording ();
+ } else {
+ stop_recording ();
+ }
+ }
}
+ void take_photo () {
+ webcam.take_photo ("/home/haitsma/1.jpg");
+ Audio.play_file (Path.build_filename (Config.PACKAGE_DATADIR, "sounds", "shutter0.ogg"));
+ }
+
+ void start_recording () {
+ webcam.start_recording ("/home/haitsma/1.ogg");
+ is_recording = true;
+ label_take_photo.set_text_with_mnemonic ("<b>" + _("_Stop recording") + "</b>");
+ label_take_photo.set_use_markup (true);
+ image_take_photo.set_from_stock (STOCK_MEDIA_STOP, IconSize.BUTTON);
+ }
+
+ void stop_recording () {
+ webcam.stop_recording ();
+ is_recording = false;
+ label_take_photo.set_text_with_mnemonic ("<b>" + _("_Start recording") + "</b>");
+ label_take_photo.set_use_markup (true);
+ image_take_photo.set_from_stock (STOCK_MEDIA_RECORD, IconSize.BUTTON);
+ }
+
void on_account_photo (Action action) {
}
@@ -287,30 +325,30 @@
/* Set ignore_callback because we are call ToggleButton.set_active in
the next few lines */
ignore_callback = true;
-
+
if (button == button_photo) {
- if (!button_photo.get_active ()) {
- button_photo.set_active (true);
- } else {
- button_video.set_active (false);
- }
-
+ if (mode == Mode.PHOTO)
+ return;
+ else
+ mode = Mode.VIDEO;
} else if (button == button_video) {
- if (!button_video.get_active ()) {
- button_video.set_active (true);
- } else {
- button_photo.set_active (false);
- }
+ if (mode == Mode.VIDEO)
+ return;
+ else
+ mode = Mode.VIDEO;
} else {
assert_not_reached ();
}
-
- if (button_photo.get_active ()) {
+
+ if (mode == Mode.PHOTO) {
+ button_photo.set_active (true);
+ button_video.set_active (false);
label_take_photo.set_text_with_mnemonic ("<b>" + _("_Take a photo") + "</b>");
label_take_photo.set_use_markup (true);
// TODO: add actions
-
} else {
+ button_photo.set_active (false);
+ button_video.set_active (true);
label_take_photo.set_text_with_mnemonic ("<b>" + _("_Start recording") + "</b>");
label_take_photo.set_use_markup (true);
}
@@ -334,7 +372,7 @@
button_effects = (Button) get_object ("button_effects");
button_photo = (ToggleButton) get_object ("button_photo");
button_video = (ToggleButton) get_object ("button_video");
- image_take_photo = (Widget) get_object ("image_take_photo");
+ image_take_photo = (Image) get_object ("image_take_photo");
label_effects = (Label) get_object ("label_effects");
label_photo = (Label) get_object ("label_photo");
label_take_photo = (Label) get_object ("label_take_photo");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]