[vlc-devel] commit: skins2: solve minor problem when opening skin dialog box ( Erwan Tulou )

git version control git at videolan.org
Wed Mar 25 09:51:07 CET 2009


vlc | branch: master | Erwan Tulou <brezhoneg1 at yahoo.fr> | Fri Mar 20 15:21:01 2009 +0100| [28d7e588fd23788834a4e89bed50962d24f8a04e] | committer: Jean-Baptiste Kempf 

skins2: solve minor problem when opening skin dialog box

(could not be opened twice in a row)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28d7e588fd23788834a4e89bed50962d24f8a04e
---

 modules/gui/qt4/menus.cpp                   |    8 +++++++-
 modules/gui/skins2/src/theme_repository.cpp |   26 ++++++++++++++------------
 modules/gui/skins2/src/theme_repository.hpp |    6 ++----
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 51b12d9..d9231d9 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -956,15 +956,21 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
         /* In skins interface, append some items */
         if( !mi )
         {
-            objects.clear(); varnames.clear();
 
             vlc_object_t *p_object = ( vlc_object_t* )
                 vlc_object_find_name( p_intf, "skins2", FIND_PARENT );
             if( p_object )
             {
+                objects.clear(); varnames.clear();
                 objects.push_back( p_object );
                 varnames.push_back( "intf-skins" );
                 Populate( p_intf, submenu, varnames, objects );
+ 
+                objects.clear(); varnames.clear();
+                objects.push_back( p_object );
+                varnames.push_back( "intf-skins-interactive" );
+                Populate( p_intf, submenu, varnames, objects );
+              
                 vlc_object_release( p_object );
             }
             else
diff --git a/modules/gui/skins2/src/theme_repository.cpp b/modules/gui/skins2/src/theme_repository.cpp
index 8aef4e6..04fc44e 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -35,8 +35,6 @@
 #endif
 
 
-const char *ThemeRepository::kOpenDialog = "{openSkin}";
-
 
 ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
 {
@@ -78,14 +76,19 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
         parseDirectory( *it );
     }
 
-    // Add an entry for the "open skin" dialog
-    val.psz_string = (char*)kOpenDialog;
-    text.psz_string = _("Open skin...");
-    var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val,
-                &text );
-
     // Set the callback
     var_AddCallback( pIntf, "intf-skins", changeSkin, this );
+
+
+    // variable for opening a dialog box to change skins
+    var_Create( pIntf, "intf-skins-interactive", VLC_VAR_VOID |
+                VLC_VAR_ISCOMMAND );
+    text.psz_string = _("Open skin ...");
+    var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT, &text, NULL );
+
+    // Set the callback
+    var_AddCallback( pIntf, "intf-skins-interactive", changeSkin, this );
+
 }
 
 
@@ -147,19 +150,18 @@ void ThemeRepository::parseDirectory( const string &rDir_locale )
 
 
 
-int ThemeRepository::changeSkin( vlc_object_t *pIntf, char const *pCmd,
+int ThemeRepository::changeSkin( vlc_object_t *pIntf, char const *pVariable,
                                  vlc_value_t oldval, vlc_value_t newval,
                                  void *pData )
 {
     ThemeRepository *pThis = (ThemeRepository*)(pData);
 
-    // Special menu entry for the open skin dialog
-    if( !strcmp( newval.psz_string, kOpenDialog ) )
+    if( !strcmp( pVariable, "intf-skins-interactive" ) )
     {
         CmdDlgChangeSkin cmd( pThis->getIntf() );
         cmd.execute();
     }
-    else
+    else if( !strcmp( pVariable, "intf-skins" ) )
     {
         // Try to load the new skin
         CmdChangeSkin *pCmd = new CmdChangeSkin( pThis->getIntf(),
diff --git a/modules/gui/skins2/src/theme_repository.hpp b/modules/gui/skins2/src/theme_repository.hpp
index 23f0d8d..c374bb5 100644
--- a/modules/gui/skins2/src/theme_repository.hpp
+++ b/modules/gui/skins2/src/theme_repository.hpp
@@ -44,14 +44,12 @@ class ThemeRepository: public SkinObject
         virtual ~ThemeRepository();
 
     private:
-        /// Identifier for the special menu entry
-        static const char *kOpenDialog;
 
-       /// Look for themes in a directory
+        /// Look for themes in a directory
         void parseDirectory( const string &rDir );
 
         /// Callback for menu item selection
-        static int changeSkin( vlc_object_t *pThis, char const *pCmd,
+        static int changeSkin( vlc_object_t *pThis, char const *pVariable,
                                vlc_value_t oldval, vlc_value_t newval,
                                void *pData );
 };




More information about the vlc-devel mailing list