]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_dialogs.hpp
d01de3da5c8df198fa93229b9e32a9e5861c97db
[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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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 #include <vlc_interface.h>
33
34 template<int TYPE = 0> class CmdDialogs;
35
36 // XXX use an enum instead
37 typedef CmdDialogs<1> CmdDlgChangeSkin;
38 typedef CmdDialogs<2> CmdDlgFileSimple;
39 typedef CmdDialogs<3> CmdDlgFile;
40 typedef CmdDialogs<4> CmdDlgDisc;
41 typedef CmdDialogs<5> CmdDlgNet;
42 typedef CmdDialogs<6> CmdDlgMessages;
43 typedef CmdDialogs<7> CmdDlgPrefs;
44 typedef CmdDialogs<8> CmdDlgFileInfo;
45
46 typedef CmdDialogs<11> CmdDlgAdd;
47 typedef CmdDialogs<12> CmdDlgPlaylistLoad;
48 typedef CmdDialogs<13> CmdDlgPlaylistSave;
49 typedef CmdDialogs<14> CmdDlgDirectory;
50 typedef CmdDialogs<15> CmdDlgStreamingWizard;
51 typedef CmdDialogs<16> CmdDlgPlaytreeLoad;
52 typedef CmdDialogs<17> CmdDlgPlaytreeSave;
53 typedef CmdDialogs<18> CmdDlgPlaylist;
54
55 typedef CmdDialogs<30> CmdDlgShowPopupMenu;
56 typedef CmdDialogs<31> CmdDlgHidePopupMenu;
57 typedef CmdDialogs<32> CmdDlgShowAudioPopupMenu;
58 typedef CmdDialogs<33> CmdDlgHideAudioPopupMenu;
59 typedef CmdDialogs<34> CmdDlgShowVideoPopupMenu;
60 typedef CmdDialogs<35> CmdDlgHideVideoPopupMenu;
61 typedef CmdDialogs<36> CmdDlgShowMiscPopupMenu;
62 typedef CmdDialogs<37> CmdDlgHideMiscPopupMenu;
63
64
65 /// Generic "Open dialog" command
66 template<int TYPE>
67 class CmdDialogs: public CmdGeneric
68 {
69     public:
70         CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
71         virtual ~CmdDialogs() {}
72
73         /// This method does the real job of the command
74         virtual void execute()
75         {
76             /// Get the dialogs provider
77             Dialogs *pDialogs = Dialogs::instance( getIntf() );
78             if( pDialogs == NULL )
79             {
80                 return;
81             }
82
83             switch( TYPE )
84             {
85                 case 1:
86                     pDialogs->showChangeSkin();
87                     break;
88                 case 2:
89                     pDialogs->showFileSimple( true );
90                     break;
91                 case 3:
92                     pDialogs->showFile( true );
93                     break;
94                 case 4:
95                     pDialogs->showDisc( true );
96                     break;
97                 case 5:
98                     pDialogs->showNet( true );
99                     break;
100                 case 6:
101                     pDialogs->showMessages();
102                     break;
103                 case 7:
104                     pDialogs->showPrefs();
105                     break;
106                 case 8:
107                     pDialogs->showFileInfo();
108                     break;
109                case 11:
110                     pDialogs->showFile( false );
111                     break;
112                 case 12:
113                     pDialogs->showPlaylistLoad();
114                     break;
115                 case 13:
116                     pDialogs->showPlaylistSave();
117                     break;
118                 case 14:
119                     pDialogs->showDirectory( true );
120                     break;
121                 case 15:
122                     pDialogs->showStreamingWizard();
123                     break;
124                 case 18:
125                     pDialogs->showPlaylist();
126                     break;
127                 case 30:
128                     pDialogs->showPopupMenu( true, INTF_DIALOG_POPUPMENU );
129                     break;
130                 case 31:
131                     pDialogs->showPopupMenu( false, INTF_DIALOG_POPUPMENU );
132                     break;
133                 case 32:
134                     pDialogs->showPopupMenu( true, INTF_DIALOG_AUDIOPOPUPMENU );
135                     break;
136                 case 33:
137                     pDialogs->showPopupMenu( false,INTF_DIALOG_AUDIOPOPUPMENU );
138                     break;
139                 case 34:
140                     pDialogs->showPopupMenu( true, INTF_DIALOG_VIDEOPOPUPMENU );
141                     break;
142                 case 35:
143                     pDialogs->showPopupMenu( false,INTF_DIALOG_VIDEOPOPUPMENU );
144                     break;
145                  case 36:
146                     pDialogs->showPopupMenu( true, INTF_DIALOG_MISCPOPUPMENU );
147                     break;
148                 case 37:
149                     pDialogs->showPopupMenu( false,INTF_DIALOG_MISCPOPUPMENU );
150                     break;
151                 default:
152                     msg_Warn( getIntf(), "unknown dialog type" );
153                     break;
154             }
155         }
156
157         /// Return the type of the command
158         virtual string getType() const { return "dialog"; }
159 };
160
161 class CmdInteraction: public CmdGeneric
162 {
163     public:
164         CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t *
165                         p_dialog ): CmdGeneric( pIntf ), m_pDialog( p_dialog )
166         {}
167         virtual ~CmdInteraction() {}
168
169         /// This method does the real job of the command
170         virtual void execute()
171         {
172             /// Get the dialogs provider
173             Dialogs *pDialogs = Dialogs::instance( getIntf() );
174             if( pDialogs == NULL )
175             {
176                 return;
177             }
178             pDialogs->showInteraction( m_pDialog );
179         }
180
181         virtual string getType() const { return "interaction"; }
182     private:
183         interaction_dialog_t *m_pDialog;
184 };
185
186 #endif