summaryrefslogtreecommitdiffstats
path: root/tools/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gui')
-rw-r--r--tools/gui/control.c34
-rw-r--r--tools/gui/control.glade77
2 files changed, 108 insertions, 3 deletions
diff --git a/tools/gui/control.c b/tools/gui/control.c
index 07b7937..0b59837 100644
--- a/tools/gui/control.c
+++ b/tools/gui/control.c
@@ -44,6 +44,11 @@ typedef struct {
GtkWidget *download_button;
GtkComboBox *zoom_box;
+ GtkDialog *download_dialog;
+ GtkProgressBar *download_progressbar;
+ GtkWidget *download_close_button;
+ GtkAdjustment *download_adjustment;
+
GtkWidget *histogram_view;
GtkToggleButton *histogram_button;
GtkAdjustment *frame_slider;
@@ -290,17 +295,21 @@ on_record_button_clicked (GtkWidget *widget, ThreadData *data)
}
}
-static void
-on_download_button_clicked (GtkWidget *widget, ThreadData *data)
+static gpointer
+download_frames (ThreadData *data)
{
gpointer buffer;
+ guint n_frames;
GError *error = NULL;
+ g_object_get (data->camera, "recorded-frames", &n_frames, NULL);
+ g_print ("recorded %i frames\n", n_frames);
+
uca_camera_start_readout (data->camera, &error);
if (error != NULL) {
g_printerr ("Failed to start read out of camera memory: %s\n", error->message);
- return;
+ return NULL;
}
ring_buffer_reset (data->buffer);
@@ -327,6 +336,22 @@ on_download_button_clicked (GtkWidget *widget, ThreadData *data)
if (error != NULL)
g_printerr ("Failed to stop reading out of camera memory: %s\n", error->message);
+
+ return NULL;
+}
+
+static void
+on_download_button_clicked (GtkWidget *widget, ThreadData *data)
+{
+ GError *error = NULL;
+
+ if (!g_thread_create ((GThreadFunc) download_frames, data, FALSE, &error)) {
+ g_printerr ("Failed to create thread: %s\n", error->message);
+ }
+
+ gtk_window_set_modal (GTK_WINDOW (data->download_dialog), TRUE);
+ gtk_dialog_run (data->download_dialog);
+ gtk_window_set_modal (GTK_WINDOW (data->download_dialog), FALSE);
}
static void
@@ -408,6 +433,9 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name)
td.histogram_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "histogram-checkbutton"));
td.frame_slider = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "frames-adjustment"));
+ td.download_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "download-dialog"));
+ td.download_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "download-adjustment"));
+
/* Set initial data */
pixel_size = bits_per_sample > 8 ? 2 : 1;
image_size = pixel_size * width * height;
diff --git a/tools/gui/control.glade b/tools/gui/control.glade
index 2d2aaac..eec9dde 100644
--- a/tools/gui/control.glade
+++ b/tools/gui/control.glade
@@ -555,4 +555,81 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkDialog" id="download-dialog">
+ <property name="border_width">5</property>
+ <property name="type_hint">normal</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Downloading Frames …</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="download-progressbar">
+ <property name="visible">True</property>
+ <property name="adjustment">download-adjustment</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="download-close-button">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">download-close-button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkAdjustment" id="download-adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
</interface>