cmd_dialogs.hpp
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:6k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * cmd_dialogs.hpp
  3.  *****************************************************************************
  4.  * Copyright (C) 2003 the VideoLAN team
  5.  * $Id: d01de3da5c8df198fa93229b9e32a9e5861c97db $
  6.  *
  7.  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  8.  *          Olivier Teulière <ipkiss@via.ecp.fr>
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * (at your option) any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23.  *****************************************************************************/
  24. #ifndef CMD_DIALOGS_HPP
  25. #define CMD_DIALOGS_HPP
  26. #include "cmd_generic.hpp"
  27. #include "../src/dialogs.hpp"
  28. #include "cmd_change_skin.hpp"
  29. #include <vlc_interface.h>
  30. template<int TYPE = 0> class CmdDialogs;
  31. // XXX use an enum instead
  32. typedef CmdDialogs<1> CmdDlgChangeSkin;
  33. typedef CmdDialogs<2> CmdDlgFileSimple;
  34. typedef CmdDialogs<3> CmdDlgFile;
  35. typedef CmdDialogs<4> CmdDlgDisc;
  36. typedef CmdDialogs<5> CmdDlgNet;
  37. typedef CmdDialogs<6> CmdDlgMessages;
  38. typedef CmdDialogs<7> CmdDlgPrefs;
  39. typedef CmdDialogs<8> CmdDlgFileInfo;
  40. typedef CmdDialogs<11> CmdDlgAdd;
  41. typedef CmdDialogs<12> CmdDlgPlaylistLoad;
  42. typedef CmdDialogs<13> CmdDlgPlaylistSave;
  43. typedef CmdDialogs<14> CmdDlgDirectory;
  44. typedef CmdDialogs<15> CmdDlgStreamingWizard;
  45. typedef CmdDialogs<16> CmdDlgPlaytreeLoad;
  46. typedef CmdDialogs<17> CmdDlgPlaytreeSave;
  47. typedef CmdDialogs<18> CmdDlgPlaylist;
  48. typedef CmdDialogs<30> CmdDlgShowPopupMenu;
  49. typedef CmdDialogs<31> CmdDlgHidePopupMenu;
  50. typedef CmdDialogs<32> CmdDlgShowAudioPopupMenu;
  51. typedef CmdDialogs<33> CmdDlgHideAudioPopupMenu;
  52. typedef CmdDialogs<34> CmdDlgShowVideoPopupMenu;
  53. typedef CmdDialogs<35> CmdDlgHideVideoPopupMenu;
  54. typedef CmdDialogs<36> CmdDlgShowMiscPopupMenu;
  55. typedef CmdDialogs<37> CmdDlgHideMiscPopupMenu;
  56. /// Generic "Open dialog" command
  57. template<int TYPE>
  58. class CmdDialogs: public CmdGeneric
  59. {
  60.     public:
  61.         CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
  62.         virtual ~CmdDialogs() {}
  63.         /// This method does the real job of the command
  64.         virtual void execute()
  65.         {
  66.             /// Get the dialogs provider
  67.             Dialogs *pDialogs = Dialogs::instance( getIntf() );
  68.             if( pDialogs == NULL )
  69.             {
  70.                 return;
  71.             }
  72.             switch( TYPE )
  73.             {
  74.                 case 1:
  75.                     pDialogs->showChangeSkin();
  76.                     break;
  77.                 case 2:
  78.                     pDialogs->showFileSimple( true );
  79.                     break;
  80.                 case 3:
  81.                     pDialogs->showFile( true );
  82.                     break;
  83.                 case 4:
  84.                     pDialogs->showDisc( true );
  85.                     break;
  86.                 case 5:
  87.                     pDialogs->showNet( true );
  88.                     break;
  89.                 case 6:
  90.                     pDialogs->showMessages();
  91.                     break;
  92.                 case 7:
  93.                     pDialogs->showPrefs();
  94.                     break;
  95.                 case 8:
  96.                     pDialogs->showFileInfo();
  97.                     break;
  98.                case 11:
  99.                     pDialogs->showFile( false );
  100.                     break;
  101.                 case 12:
  102.                     pDialogs->showPlaylistLoad();
  103.                     break;
  104.                 case 13:
  105.                     pDialogs->showPlaylistSave();
  106.                     break;
  107.                 case 14:
  108.                     pDialogs->showDirectory( true );
  109.                     break;
  110.                 case 15:
  111.                     pDialogs->showStreamingWizard();
  112.                     break;
  113.                 case 18:
  114.                     pDialogs->showPlaylist();
  115.                     break;
  116.                 case 30:
  117.                     pDialogs->showPopupMenu( true, INTF_DIALOG_POPUPMENU );
  118.                     break;
  119.                 case 31:
  120.                     pDialogs->showPopupMenu( false, INTF_DIALOG_POPUPMENU );
  121.                     break;
  122.                 case 32:
  123.                     pDialogs->showPopupMenu( true, INTF_DIALOG_AUDIOPOPUPMENU );
  124.                     break;
  125.                 case 33:
  126.                     pDialogs->showPopupMenu( false,INTF_DIALOG_AUDIOPOPUPMENU );
  127.                     break;
  128.                 case 34:
  129.                     pDialogs->showPopupMenu( true, INTF_DIALOG_VIDEOPOPUPMENU );
  130.                     break;
  131.                 case 35:
  132.                     pDialogs->showPopupMenu( false,INTF_DIALOG_VIDEOPOPUPMENU );
  133.                     break;
  134.                  case 36:
  135.                     pDialogs->showPopupMenu( true, INTF_DIALOG_MISCPOPUPMENU );
  136.                     break;
  137.                 case 37:
  138.                     pDialogs->showPopupMenu( false,INTF_DIALOG_MISCPOPUPMENU );
  139.                     break;
  140.                 default:
  141.                     msg_Warn( getIntf(), "unknown dialog type" );
  142.                     break;
  143.             }
  144.         }
  145.         /// Return the type of the command
  146.         virtual string getType() const { return "dialog"; }
  147. };
  148. class CmdInteraction: public CmdGeneric
  149. {
  150.     public:
  151.         CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t *
  152.                         p_dialog ): CmdGeneric( pIntf ), m_pDialog( p_dialog )
  153.         {}
  154.         virtual ~CmdInteraction() {}
  155.         /// This method does the real job of the command
  156.         virtual void execute()
  157.         {
  158.             /// Get the dialogs provider
  159.             Dialogs *pDialogs = Dialogs::instance( getIntf() );
  160.             if( pDialogs == NULL )
  161.             {
  162.                 return;
  163.             }
  164.             pDialogs->showInteraction( m_pDialog );
  165.         }
  166.         virtual string getType() const { return "interaction"; }
  167.     private:
  168.         interaction_dialog_t *m_pDialog;
  169. };
  170. #endif