]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/dialogs.cpp
A bit of headers cleanup
[vlc] / modules / gui / skins2 / src / dialogs.cpp
index 7c23d7fdf3cf810863a5ff62ac1b51f7f7802b8e..968d6d6f35a791ed70128e1056a2db68fd76acce 100644 (file)
@@ -5,7 +5,7 @@
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "dialogs.hpp"
@@ -28,7 +28,7 @@
 #include "../commands/cmd_quit.hpp"
 #include "../commands/cmd_playlist.hpp"
 #include "../commands/cmd_playtree.hpp"
-
+#include <vlc_playlist.h>
 
 /// Callback called when a new skin is chosen
 void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
@@ -41,11 +41,10 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
         {
             // Create a change skin command
             CmdChangeSkin *pCmd =
-                new CmdChangeSkin( pIntf, pArg->psz_results[0] );
+                new CmdChangeSkin( pIntf, sFromLocale( pArg->psz_results[0] ) );
 
             // Push the command in the asynchronous command queue
             AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
-            pQueue->remove( "change skin" );
             pQueue->push( CmdGenericPtr( pCmd ) );
         }
     }
@@ -58,7 +57,6 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
     }
 }
 
-
 void Dialogs::showPlaylistLoadCB( intf_dialog_args_t *pArg )
 {
     intf_thread_t *pIntf = (intf_thread_t *)pArg->p_arg;
@@ -67,12 +65,10 @@ void Dialogs::showPlaylistLoadCB( intf_dialog_args_t *pArg )
     {
         // Create a Playlist Load command
         CmdPlaylistLoad *pCmd =
-            new CmdPlaylistLoad( pIntf, pArg->psz_results[0] );
+            new CmdPlaylistLoad( pIntf, sFromLocale( pArg->psz_results[0] ) );
 
         // Push the command in the asynchronous command queue
         AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
-        pQueue->remove( "load playlist" );
-        pQueue->remove( "load playtree" );
         pQueue->push( CmdGenericPtr( pCmd ) );
     }
 }
@@ -90,8 +86,6 @@ void Dialogs::showPlaylistSaveCB( intf_dialog_args_t *pArg )
 
         // Push the command in the asynchronous command queue
         AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
-        pQueue->remove( "load playlist" );
-        pQueue->remove( "load playtree" );
         pQueue->push( CmdGenericPtr( pCmd ) );
     }
 }
@@ -102,7 +96,7 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
                         vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     Dialogs *p_dialogs = (Dialogs *)param;
-    p_dialogs->showPopupMenu( new_val.b_bool != 0 );
+    p_dialogs->showPopupMenu( new_val.b_bool != 0, INTF_DIALOG_POPUPMENU );
 
     return VLC_SUCCESS;
 }
@@ -175,7 +169,7 @@ bool Dialogs::init()
     m_pModule = module_Need( m_pProvider, "dialogs provider", NULL, 0 );
     if( m_pModule == NULL )
     {
-        msg_Err( getIntf(), "No suitable dialogs provider found (hint: compile the wxWidgets plugin, and make sure it is loaded properly)" );
+        msg_Err( getIntf(), "no suitable dialogs provider found (hint: compile the wxWidgets plugin, and make sure it is loaded properly)" );
         vlc_object_destroy( m_pProvider );
         m_pProvider = NULL;
         return false;
@@ -226,7 +220,7 @@ void Dialogs::showFileGeneric( const string &rTitle, const string &rExtensions,
 void Dialogs::showChangeSkin()
 {
     showFileGeneric( _("Open a skin file"),
-                     _("Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml"),
+                     _("Skin files (*.vlt;*.wsz)|*.vlt;*.wsz|Skin files (*.xml)|*.xml"),
                      showChangeSkinCB, kOPEN );
 }
 
@@ -234,17 +228,27 @@ void Dialogs::showChangeSkin()
 void Dialogs::showPlaylistLoad()
 {
     showFileGeneric( _("Open playlist"),
-                     _("All playlists|*.pls;*.m3u;*.asx;*.b4s|M3U files|*.m3u"),
+                     _("All playlists|*.pls;*.m3u;*.asx;*.b4s;*.xspf|"
+                       "M3U files|*.m3u|"
+                       "XSPF playlist|*.xspf"),
                      showPlaylistLoadCB, kOPEN );
 }
 
 
 void Dialogs::showPlaylistSave()
 {
-    showFileGeneric( _("Save playlist"), _("M3U file|*.m3u"),
+    showFileGeneric( _("Save playlist"), _("M3U file|*.m3u|XSPF playlist|*.xspf"),
                      showPlaylistSaveCB, kSAVE );
 }
 
+void Dialogs::showPlaylist()
+{
+    if( m_pProvider && m_pProvider->pf_show_dialog )
+    {
+        m_pProvider->pf_show_dialog( m_pProvider, INTF_DIALOG_PLAYLIST,
+                                     0, 0 );
+    }
+}
 
 void Dialogs::showFileSimple( bool play )
 {
@@ -332,12 +336,27 @@ void Dialogs::showStreamingWizard()
 }
 
 
-void Dialogs::showPopupMenu( bool bShow )
+void Dialogs::showPopupMenu( bool bShow, int popupType = INTF_DIALOG_POPUPMENU )
 {
     if( m_pProvider && m_pProvider->pf_show_dialog )
     {
-        m_pProvider->pf_show_dialog( m_pProvider, INTF_DIALOG_POPUPMENU,
+        m_pProvider->pf_show_dialog( m_pProvider, popupType,
                                      (int)bShow, 0 );
     }
 }
 
+void Dialogs::showInteraction( interaction_dialog_t *p_dialog )
+{
+    intf_dialog_args_t *p_arg =
+            (intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
+    memset( p_arg, 0, sizeof(intf_dialog_args_t) );
+
+    p_arg->p_dialog = p_dialog;
+    p_arg->p_intf = getIntf();
+
+    if( m_pProvider && m_pProvider->pf_show_dialog )
+    {
+        m_pProvider->pf_show_dialog( m_pProvider, INTF_DIALOG_INTERACTION,
+                                     0, p_arg );
+    }
+}