[chronojump] Webcam preferences fill pixel_format from sqlite. Hidden custom stuff



commit b36325bfe438ba9bb62b9a915379ee90ffec4eda
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jul 5 10:21:55 2019 +0200

    Webcam preferences fill pixel_format from sqlite. Hidden custom stuff

 glade/preferences_win.glade |  1 +
 src/gui/preferences.cs      | 37 ++++++++++++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index f274a815..ab4a1120 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -3815,6 +3815,7 @@ Other</property>
                                 </child>
                                 <child>
                                   <widget class="GtkHBox" id="hbox_combo_camera_pixel_format">
+                                    <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <child>
                                       <placeholder/>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 2c3e58c5..ba6c2988 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -693,14 +693,24 @@ public class PreferencesWindow
 
                // 2) pixel_format
 
+               List<string> pixelFormats = new List<string>();
+               if(pixelFormat != "")
+               {
+                       pixelFormats.Add(pixelFormat);
+                       UtilGtk.ComboUpdate(combo_camera_pixel_format, pixelFormats);
+                       combo_camera_pixel_format.Active = 0;
+               }
+
                hbox_combo_camera_pixel_format.PackStart(combo_camera_pixel_format, true, true, 0);
-               //hbox_combo_camera_pixel_format.ShowAll();
+               hbox_combo_camera_pixel_format.ShowAll();
                combo_camera_pixel_format.Changed += new EventHandler (on_combo_camera_pixel_format_changed);
 
                // 3) resolution
 
-               combo_camera_resolution = ComboBox.NewText ();
                List<string> resolutions = new List<string>();
+               /*
+                * do not have this default values, just write the option on sqlite (if any)
+                *
                resolutions.Add("320x240");
                resolutions.Add("640x480");
                resolutions.Add("1280x720");
@@ -710,6 +720,7 @@ public class PreferencesWindow
                if(resolution == "") //(first time using this) give a value
                        resolution = "640x480";
 
+
                bool found = false;
                foreach(string str in resolutions)
                        if(str == resolution)
@@ -726,6 +737,13 @@ public class PreferencesWindow
                        }
                        hbox_camera_resolution_custom.Visible = true;
                }
+               */
+               if(resolution != "")
+               {
+                       resolutions.Add(resolution);
+                       UtilGtk.ComboUpdate(combo_camera_resolution, resolutions);
+                       combo_camera_resolution.Active = 0;
+               }
 
                hbox_combo_camera_resolution.PackStart(combo_camera_resolution, true, true, 0);
                hbox_combo_camera_resolution.ShowAll();
@@ -735,6 +753,9 @@ public class PreferencesWindow
 
                combo_camera_framerate = ComboBox.NewText ();
                List<string> framerates = new List<string>();
+               /*
+                * do not have this default values, just write the option on sqlite (if any)
+                *
                framerates.Add("30");
                framerates.Add("60");
                framerates.Add(Catalog.GetString("Custom")); //in SQL will be stored the values not "Custom" 
text
@@ -765,6 +786,13 @@ public class PreferencesWindow
                        }
                        hbox_camera_framerate_custom.Visible = true;
                }
+               */
+               if(framerate != "")
+               {
+                       framerates.Add(framerate);
+                       UtilGtk.ComboUpdate(combo_camera_framerate, framerates);
+                       combo_camera_framerate.Active = 0;
+               }
 
                hbox_combo_camera_framerate.PackStart(combo_camera_framerate, true, true, 0);
                hbox_combo_camera_framerate.ShowAll();
@@ -895,14 +923,9 @@ public class PreferencesWindow
                        UtilGtk.ComboUpdate(combo_camera_resolution, wfsm.PopulateFirstList());
                        combo_camera_resolution.Active = 0;
 
-                       //TODO: framerates
-
                        UtilGtk.ComboUpdate(combo_camera_pixel_format, wfsm.GetPixelFormats());
                        combo_camera_pixel_format.Active = 0;
                        hbox_combo_camera_pixel_format.ShowAll();
-
-                       //label_camera_pixel_format.Visible = true;
-                       hbox_combo_camera_pixel_format.Visible = true;
                }
        }
 


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