[chronojump] Webcam: user cannot activate it without all params ok on preferences



commit 744332613df8b179bf19dc99879705dbd1c1ca89
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jul 11 13:33:51 2019 +0200

    Webcam: user cannot activate it without all params ok on preferences

 src/gui/webcam.cs  | 4 ++--
 src/preferences.cs | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/webcam.cs b/src/gui/webcam.cs
index 9b9b0d60..205415a7 100644
--- a/src/gui/webcam.cs
+++ b/src/gui/webcam.cs
@@ -591,7 +591,7 @@ public partial class ChronoJumpWindow
        {
                if(checkbutton_video.Active)
                {
-                       if(preferences.videoDevice == "") //on mac can be "0"... || preferences.videoDevice 
== "0")
+                       if(! preferences.IsVideoConfigured())
                        {
                                new DialogMessage(Constants.MessageTypes.WARNING, "Video device is not 
configured. Check Preferences / Multimedia.");
                                checkbutton_video.Active = false;
@@ -618,7 +618,7 @@ public partial class ChronoJumpWindow
        {
                if(checkbutton_video_encoder.Active)
                {
-                       if(preferences.videoDevice == "") //on mac can be "0"... || preferences.videoDevice 
== "0")
+                       if(! preferences.IsVideoConfigured())
                        {
                                new DialogMessage(Constants.MessageTypes.WARNING, "Video device is not 
configured. Check Preferences / Multimedia.");
                                checkbutton_video_encoder.Active = false;
diff --git a/src/preferences.cs b/src/preferences.cs
index fdeee4b3..1a0e90f0 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -316,6 +316,12 @@ public class Preferences
                }
        }
 
+       public bool IsVideoConfigured()
+       {
+               return (videoDevice != "" && videoDevicePixelFormat != "" &&
+                               videoDeviceResolution != "" && videoDeviceFramerate != "");
+       }
+
        ~Preferences() {}
           
 }


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