]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_dialogs.hpp
d3862b9b1f83d23e4a3761277322a327124d8534
[vlc] / modules / gui / skins2 / commands / cmd_dialogs.hpp
1 /*****************************************************************************
2  * cmd_dialogs.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef CMD_DIALOGS_HPP
26 #define CMD_DIALOGS_HPP
27
28 #include "cmd_generic.hpp"
29 #include "../src/dialogs.hpp"
30 #include "cmd_change_skin.hpp"
31
32
33 template<int TYPE = 0> class CmdDialogs;
34
35 // XXX use an enum instead
36 typedef CmdDialogs<1> CmdDlgChangeSkin;
37 typedef CmdDialogs<2> CmdDlgFileSimple;
38 typedef CmdDialogs<3> CmdDlgFile;
39 typedef CmdDialogs<4> CmdDlgDisc;
40 typedef CmdDialogs<5> CmdDlgNet;
41 typedef CmdDialogs<6> CmdDlgMessages;
42 typedef CmdDialogs<7> CmdDlgPrefs;
43 typedef CmdDialogs<8> CmdDlgFileInfo;
44 typedef CmdDialogs<9> CmdDlgShowPopupMenu;
45 typedef CmdDialogs<10> CmdDlgHidePopupMenu;
46 typedef CmdDialogs<11> CmdDlgAdd;
47 typedef CmdDialogs<12> CmdDlgPlaylistLoad;
48 typedef CmdDialogs<13> CmdDlgPlaylistSave;
49
50
51 /// Generic "Open dialog" command
52 template<int TYPE>
53 class CmdDialogs: public CmdGeneric
54 {
55     public:
56         CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
57         virtual ~CmdDialogs() {}
58
59         /// This method does the real job of the command
60         virtual void execute()
61         {
62             /// Get the dialogs provider
63             Dialogs *pDialogs = Dialogs::instance( getIntf() );
64             if( pDialogs == NULL )
65             {
66                 return;
67             }
68
69             switch( TYPE )
70             {
71                 case 1:
72                     pDialogs->showChangeSkin();
73                     break;
74                 case 2:
75                     pDialogs->showFileSimple( true );
76                     break;
77                 case 3:
78                     pDialogs->showFile( true );
79                     break;
80                 case 4:
81                     pDialogs->showDisc( true );
82                     break;
83                 case 5:
84                     pDialogs->showNet( true );
85                     break;
86                 case 6:
87                     pDialogs->showMessages();
88                     break;
89                 case 7:
90                     pDialogs->showPrefs();
91                     break;
92                 case 8:
93                     pDialogs->showFileInfo();
94                     break;
95                 case 9:
96                     pDialogs->showPopupMenu( true );
97                     break;
98                 case 10:
99                     pDialogs->showPopupMenu( false );
100                     break;
101                 case 11:
102                     pDialogs->showFile( false );
103                     break;
104                 case 12:
105                     pDialogs->showPlaylistLoad();
106                     break;
107                 case 13:
108                     pDialogs->showPlaylistSave();
109                     break;
110                 default:
111                     msg_Warn( getIntf(), "Unknown dialog type" );
112                     break;
113             }
114         }
115
116         /// Return the type of the command
117         virtual string getType() const { return "dialog"; }
118 };
119
120
121 #endif