[ekiga/ds-gsettings2: 28/33] Moved VideoOutputCore to GSettings.



commit a0148faef66966fa95b53f1f5193e089dfba2be6
Author: Damien Sandras <dsandras beip be>
Date:   Sun Jun 23 15:53:25 2013 +0200

    Moved VideoOutputCore to GSettings.
    
    This is all done.

 lib/Makefile.am                             |    2 -
 lib/ekiga-settings.h                        |    1 +
 lib/engine/engine.cpp                       |    2 +-
 lib/engine/gui/gtk-frontend/ext-window.cpp  |    1 +
 lib/engine/videooutput/videooutput-core.cpp |   73 ++++++++++++++++++++++++---
 lib/engine/videooutput/videooutput-core.h   |    9 ++--
 6 files changed, 74 insertions(+), 14 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a4a85d4..e5c539c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -337,8 +337,6 @@ libekiga_la_SOURCES += \
        engine/videooutput/videooutput-manager.h \
        engine/videooutput/videooutput-core.h \
        engine/videooutput/videooutput-core.cpp \
-       engine/videooutput/videooutput-gmconf-bridge.h \
-       engine/videooutput/videooutput-gmconf-bridge.cpp
 
 ##
 # Sources of the video input stack
diff --git a/lib/ekiga-settings.h b/lib/ekiga-settings.h
index a0cf2b7..fba4634 100644
--- a/lib/ekiga-settings.h
+++ b/lib/ekiga-settings.h
@@ -47,6 +47,7 @@
 #define SOUND_EVENTS_SCHEMA "org.gnome." PACKAGE_NAME ".general.sound-events"
 #define AUDIO_DEVICES_SCHEMA "org.gnome." PACKAGE_NAME ".devices.audio"
 #define VIDEO_DEVICES_SCHEMA "org.gnome." PACKAGE_NAME ".devices.video"
+#define VIDEO_DISPLAY_SCHEMA USER_INTERFACE ".video-display"
 
 namespace Ekiga {
 
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 8df82f0..c781ec1 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -197,7 +197,7 @@ engine_init (Ekiga::ServiceCorePtr service_core,
      code in question to do it itself
    */
 
-  videooutput_core->setup_conf_bridge();
+  videooutput_core->setup ();
   videoinput_core->setup ("any");
   audioinput_core->setup ();
   audiooutput_core->setup ();
diff --git a/lib/engine/gui/gtk-frontend/ext-window.cpp b/lib/engine/gui/gtk-frontend/ext-window.cpp
index 6dc71a4..89ffbbf 100644
--- a/lib/engine/gui/gtk-frontend/ext-window.cpp
+++ b/lib/engine/gui/gtk-frontend/ext-window.cpp
@@ -27,6 +27,7 @@
  */
 
 #include "ext-window.h"
+#include "gmconf.h"
 
 #ifndef WIN32
 #include <gdk/gdkx.h>
diff --git a/lib/engine/videooutput/videooutput-core.cpp b/lib/engine/videooutput/videooutput-core.cpp
index dcb3683..4ea1184 100644
--- a/lib/engine/videooutput/videooutput-core.cpp
+++ b/lib/engine/videooutput/videooutput-core.cpp
@@ -50,16 +50,15 @@ VideoOutputCore::VideoOutputCore ()
   videooutput_stats.rx_frames = 0;
   videooutput_stats.tx_frames = 0;
   number_times_started = 0;
-  videooutput_core_conf_bridge = NULL;
+
+  settings = new Settings (VIDEO_DISPLAY_SCHEMA);
+  settings->changed.connect (boost::bind (&VideoOutputCore::setup, this, _1));
 }
 
 VideoOutputCore::~VideoOutputCore ()
 {
   PWaitAndSignal m(core_mutex);
 
-  if (videooutput_core_conf_bridge)
-    delete videooutput_core_conf_bridge;
-
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++)
@@ -68,11 +67,71 @@ VideoOutputCore::~VideoOutputCore ()
   managers.clear();
 }
 
-void VideoOutputCore::setup_conf_bridge ()
+void VideoOutputCore::setup (std::string setting)
 {
-  PWaitAndSignal m(core_mutex);
+  GSettings *s = settings->get_g_settings ();
+  if (setting.empty () || setting == "video-view")  {
 
-  videooutput_core_conf_bridge = new VideoOutputCoreConfBridge (*this);
+    DisplayInfo display_info;
+    PTRACE(4, "VideoOutputCore\tUpdating video view");
+
+    if ((g_settings_get_int (s, "video-view") < Ekiga::VO_MODE_LOCAL) ||
+       (g_settings_get_int (s, "video-view") >= Ekiga::VO_MODE_UNSET))
+      g_settings_set_int (s, "video-view", Ekiga::VO_MODE_LOCAL);
+
+    display_info.mode = (VideoOutputMode) g_settings_get_int (s, "video-view");
+    set_display_info (display_info);
+  }
+
+  if (setting.empty () || setting == "zoom") {
+
+    DisplayInfo display_info;
+    PTRACE(4, "VideoOutputCore\tUpdating zoom");
+
+    display_info.zoom = g_settings_get_int (s, "zoom");
+    if ((display_info.zoom != 100) &&
+       (display_info.zoom != 50) &&
+       (display_info.zoom != 200)) {
+      display_info.zoom = 100;
+      g_settings_set_int (s, "zoom", 100);
+    }
+
+    set_display_info (display_info);
+  }
+
+  if (setting.empty () || setting == "ext-zoom") {
+
+    DisplayInfo display_info;
+
+    display_info.zoom = g_settings_get_int (s, "ext-zoom");
+    if ((display_info.zoom != 100) &&
+       (display_info.zoom != 50) &&
+       (display_info.zoom != 200)) {
+      display_info.zoom = 100;
+      g_settings_set_int (s, "ext-zoom", 100);
+    }
+
+    set_ext_display_info(display_info);
+  }
+
+  if (setting.empty () || setting == "stay-on-top" || setting == "disable-hw-accel"
+      || setting == "allow-pip-sw-scaling" || setting == "sw-scaling-algorithm") {
+
+    PTRACE(4, "VideoOutputCore\tUpdating Video Settings");
+    DisplayInfo display_info;
+
+    display_info.on_top = g_settings_get_boolean (s, "stay-on-top");
+    display_info.disable_hw_accel = g_settings_get_boolean (s, "disable-hw-accel");
+    display_info.allow_pip_sw_scaling = g_settings_get_boolean (s,"allow-pip-sw-scaling");
+    display_info.sw_scaling_algorithm = g_settings_get_int (s, "sw-scaling-algorithm");
+    if (display_info.sw_scaling_algorithm > 3) {
+      display_info.sw_scaling_algorithm = 0;
+      g_settings_set_int (s, "sw-scaling-algorithm", 0);
+    }
+    display_info.config_info_set = TRUE;
+
+    set_display_info(display_info);
+  }
 }
 
 void VideoOutputCore::add_manager (VideoOutputManager &manager)
diff --git a/lib/engine/videooutput/videooutput-core.h b/lib/engine/videooutput/videooutput-core.h
index d1640e2..0c6a90e 100644
--- a/lib/engine/videooutput/videooutput-core.h
+++ b/lib/engine/videooutput/videooutput-core.h
@@ -39,7 +39,6 @@
 
 #include "services.h"
 
-#include "videooutput-gmconf-bridge.h"
 #include "videooutput-manager.h"
 
 #include <boost/signals2.hpp>
@@ -49,6 +48,8 @@
 #include <glib.h>
 #include <ptlib.h>
 
+#include "ekiga-settings.h"
+
 namespace Ekiga
 {
 
@@ -79,9 +80,9 @@ namespace Ekiga
       */
       ~VideoOutputCore ();
 
-      /** Set up gmconf bridge
+      /** Set up core
        */
-      void setup_conf_bridge();
+      void setup (std::string setting = "");
 
 
       /*** Service Implementation ***/
@@ -193,7 +194,7 @@ namespace Ekiga
 
       PMutex core_mutex;
 
-      VideoOutputCoreConfBridge* videooutput_core_conf_bridge;
+      Settings* settings;
     };
 /**
  * @}


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