]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/commands/cmd_dialogs.hpp
DirectX: kill a warning from unused variable
[vlc] / modules / gui / skins2 / commands / cmd_dialogs.hpp
index 7f5f3d757367c66e74960af4e576204d133d6bfe..aa38e3125d3e48b2dd23ebf92c1d7f0c441ed10b 100644 (file)
@@ -17,9 +17,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef CMD_DIALOGS_HPP
 #include "../src/dialogs.hpp"
 #include "cmd_change_skin.hpp"
 
-#include <vlc_interaction.h>
+#include <vlc_interface.h>
 
-template<int TYPE = 0> class CmdDialogs;
 
-// XXX use an enum instead
-typedef CmdDialogs<1> CmdDlgChangeSkin;
-typedef CmdDialogs<2> CmdDlgFileSimple;
-typedef CmdDialogs<3> CmdDlgFile;
-typedef CmdDialogs<4> CmdDlgDisc;
-typedef CmdDialogs<5> CmdDlgNet;
-typedef CmdDialogs<6> CmdDlgMessages;
-typedef CmdDialogs<7> CmdDlgPrefs;
-typedef CmdDialogs<8> CmdDlgFileInfo;
-typedef CmdDialogs<9> CmdDlgShowPopupMenu;
-typedef CmdDialogs<10> CmdDlgHidePopupMenu;
-typedef CmdDialogs<11> CmdDlgAdd;
-typedef CmdDialogs<12> CmdDlgPlaylistLoad;
-typedef CmdDialogs<13> CmdDlgPlaylistSave;
-typedef CmdDialogs<14> CmdDlgDirectory;
-typedef CmdDialogs<15> CmdDlgStreamingWizard;
-typedef CmdDialogs<16> CmdDlgPlaytreeLoad;
-typedef CmdDialogs<17> CmdDlgPlaytreeSave;
+#define DEFC( a, c ) \
+class CmdDlg##a: public CmdGeneric                              \
+{   public:                                                     \
+    CmdDlg##a( intf_thread_t *pIntf ): CmdGeneric( pIntf ) { }  \
+    virtual ~CmdDlg##a() { }                                    \
+    virtual void execute()                                      \
+    {                                                           \
+        Dialogs *dlg = Dialogs::instance( getIntf() );          \
+        if( dlg ) dlg->c;                                       \
+    }                                                           \
+    virtual string getType() const { return #a" dialog"; }      \
+};
 
+DEFC( ChangeSkin,         showChangeSkin() )
+DEFC( FileSimple,         showFileSimple( true ) )
+DEFC( File,               showFile( true ) )
+DEFC( Disc,               showDisc( true ) )
+DEFC( Net,                showNet( true ) )
+DEFC( Messages,           showMessages() )
+DEFC( Prefs,              showPrefs() )
+DEFC( FileInfo,           showFileInfo() )
 
-/// Generic "Open dialog" command
-template<int TYPE>
-class CmdDialogs: public CmdGeneric
-{
-    public:
-        CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
-        virtual ~CmdDialogs() {}
+DEFC( Add,                showFile( false ) )
+DEFC( PlaylistLoad,       showPlaylistLoad() )
+DEFC( PlaylistSave,       showPlaylistSave() )
+DEFC( Directory,          showDirectory( true ) )
+DEFC( StreamingWizard,    showStreamingWizard() )
+DEFC( Playlist,           showPlaylist() )
 
-        /// This method does the real job of the command
-        virtual void execute()
-        {
-            /// Get the dialogs provider
-            Dialogs *pDialogs = Dialogs::instance( getIntf() );
-            if( pDialogs == NULL )
-            {
-                return;
-            }
+DEFC( ShowPopupMenu,      showPopupMenu(true,INTF_DIALOG_POPUPMENU) )
+DEFC( HidePopupMenu,      showPopupMenu(false,INTF_DIALOG_POPUPMENU) )
+DEFC( ShowAudioPopupMenu, showPopupMenu(true,INTF_DIALOG_AUDIOPOPUPMENU) )
+DEFC( HideAudioPopupMenu, showPopupMenu(false,INTF_DIALOG_AUDIOPOPUPMENU) )
+DEFC( ShowVideoPopupMenu, showPopupMenu(true,INTF_DIALOG_VIDEOPOPUPMENU) )
+DEFC( HideVideoPopupMenu, showPopupMenu(false,INTF_DIALOG_VIDEOPOPUPMENU) )
+DEFC( ShowMiscPopupMenu,  showPopupMenu(true,INTF_DIALOG_MISCPOPUPMENU) )
+DEFC( HideMiscPopupMenu,  showPopupMenu(false,INTF_DIALOG_MISCPOPUPMENU) )
 
-            switch( TYPE )
-            {
-                case 1:
-                    pDialogs->showChangeSkin();
-                    break;
-                case 2:
-                    pDialogs->showFileSimple( true );
-                    break;
-                case 3:
-                    pDialogs->showFile( true );
-                    break;
-                case 4:
-                    pDialogs->showDisc( true );
-                    break;
-                case 5:
-                    pDialogs->showNet( true );
-                    break;
-                case 6:
-                    pDialogs->showMessages();
-                    break;
-                case 7:
-                    pDialogs->showPrefs();
-                    break;
-                case 8:
-                    pDialogs->showFileInfo();
-                    break;
-                case 9:
-                    pDialogs->showPopupMenu( true );
-                    break;
-                case 10:
-                    pDialogs->showPopupMenu( false );
-                    break;
-                case 11:
-                    pDialogs->showFile( false );
-                    break;
-                case 12:
-                    pDialogs->showPlaylistLoad();
-                    break;
-                case 13:
-                    pDialogs->showPlaylistSave();
-                    break;
-                case 14:
-                    pDialogs->showDirectory( true );
-                    break;
-                case 15:
-                    pDialogs->showStreamingWizard();
-                    break;
-                default:
-                    msg_Warn( getIntf(), "unknown dialog type" );
-                    break;
-            }
-        }
-
-        /// Return the type of the command
-        virtual string getType() const { return "dialog"; }
-};
+#undef DEFC
 
 class CmdInteraction: public CmdGeneric
 {
-    public:
-        CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t *
-                        p_dialog ): CmdGeneric( pIntf ), m_pDialog( p_dialog )
-        {}
-        virtual ~CmdInteraction() {}
-
-        /// This method does the real job of the command
-        virtual void execute()
-        {
-            if( m_pDialog->i_type == INTERACT_PROGRESS )
-            {
-                 /// \todo Handle progress in the interface
-            }
-            else
-            {
-                /// Get the dialogs provider
-                Dialogs *pDialogs = Dialogs::instance( getIntf() );
-                if( pDialogs == NULL )
-                {
-                    return;
-                }
-                pDialogs->showInteraction( m_pDialog );
-            }
-        }
+public:
+    CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t * p_dialog )
+                  : CmdGeneric( pIntf ), m_pDialog( p_dialog ) { }
+    virtual ~CmdInteraction() { }
 
-        virtual string getType() const { return "interaction"; }
-    private:
-        interaction_dialog_t *m_pDialog;
+    virtual void execute()
+    {
+        Dialogs *pDialogs = Dialogs::instance( getIntf() );
+        if( pDialogs != NULL )
+            pDialogs->showInteraction( m_pDialog );
+    }
+    virtual string getType() const { return "interaction"; }
+private:
+    interaction_dialog_t *m_pDialog;
 };
 
 #endif