]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_vars.hpp
Fix unprotected access of input item (skins2).
[vlc] / modules / gui / skins2 / commands / cmd_vars.hpp
1 /*****************************************************************************
2  * cmd_vars.hpp
3  *****************************************************************************
4  * Copyright (C) 2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef CMD_VARS_HPP
25 #define CMD_VARS_HPP
26
27 #include "cmd_generic.hpp"
28 #include "../utils/ustring.hpp"
29
30 class EqualizerBands;
31 class EqualizerPreamp;
32 class VarText;
33
34 /// Command to notify the playlist of a change
35 DEFINE_COMMAND( NotifyPlaylist, "notify playlist" )
36
37 /// Command to notify the playlist of a change
38 DEFINE_COMMAND( PlaytreeChanged, "playtree changed" )
39
40 /// Command to notify the playtree of an item update
41 class CmdPlaytreeUpdate: public CmdGeneric
42 {
43     public:
44         CmdPlaytreeUpdate( intf_thread_t *pIntf, int id ):
45             CmdGeneric( pIntf ), m_id( id ) {}
46         virtual ~CmdPlaytreeUpdate() {}
47
48         /// This method does the real job of the command
49         virtual void execute();
50
51         /// Return the type of the command
52         virtual string getType() const { return "playtree update"; }
53
54         /// Only accept removal of command if they concern the same item
55         virtual bool checkRemove( CmdGeneric * ) const;
56
57     private:
58         /// Playlist item ID
59         int m_id;
60 };
61
62 /// Command to notify the playtree of an item append
63 class CmdPlaytreeAppend: public CmdGeneric
64 {
65     public:
66         CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ) :
67             CmdGeneric( pIntf ), m_pAdd( p_add ) {}
68         virtual ~CmdPlaytreeAppend() {}
69
70         /// This method does the real job of the command
71         virtual void execute();
72
73         /// Return the type of the command
74         virtual string getType() const { return "playtree append"; }
75
76     private:
77         playlist_add_t * m_pAdd;
78 };
79
80 /// Command to notify the playtree of an item deletion
81 class CmdPlaytreeDelete: public CmdGeneric
82 {
83     public:
84         CmdPlaytreeDelete( intf_thread_t *pIntf, int i_id ) :
85             CmdGeneric( pIntf ), m_id( i_id ) {}
86         virtual ~CmdPlaytreeDelete() {}
87
88         /// This method does the real job of the command
89         virtual void execute();
90
91         /// Return the type of the command
92         virtual string getType() const { return "playtree append"; }
93
94     private:
95         int m_id;
96 };
97
98
99
100
101 /// Command to set a text variable
102 class CmdSetText: public CmdGeneric
103 {
104     public:
105         CmdSetText( intf_thread_t *pIntf, VarText &rText,
106                     const UString &rValue ):
107             CmdGeneric( pIntf ), m_rText( rText ), m_value( rValue ) {}
108         virtual ~CmdSetText() {}
109
110         /// This method does the real job of the command
111         virtual void execute();
112
113         /// Return the type of the command
114         virtual string getType() const { return "set text"; }
115
116     private:
117         /// Text variable to set
118         VarText &m_rText;
119         /// Value to set
120         const UString m_value;
121 };
122
123
124 /// Command to set the equalizer preamp
125 class CmdSetEqPreamp: public CmdGeneric
126 {
127     public:
128         CmdSetEqPreamp( intf_thread_t *pIntf, EqualizerPreamp &rPreamp,
129                        float value ):
130             CmdGeneric( pIntf ), m_rPreamp( rPreamp ), m_value( value ) {}
131         virtual ~CmdSetEqPreamp() {}
132
133         /// This method does the real job of the command
134         virtual void execute();
135
136         /// Return the type of the command
137         virtual string getType() const { return "set equalizer preamp"; }
138
139     private:
140         /// Preamp variable to set
141         EqualizerPreamp &m_rPreamp;
142         /// Value to set
143         float m_value;
144 };
145
146
147 /// Command to set the equalizerbands
148 class CmdSetEqBands: public CmdGeneric
149 {
150     public:
151         CmdSetEqBands( intf_thread_t *pIntf, EqualizerBands &rEqBands,
152                        const string &rValue ):
153             CmdGeneric( pIntf ), m_rEqBands( rEqBands ), m_value( rValue ) {}
154         virtual ~CmdSetEqBands() {}
155
156         /// This method does the real job of the command
157         virtual void execute();
158
159         /// Return the type of the command
160         virtual string getType() const { return "set equalizer bands"; }
161
162     private:
163         /// Equalizer variable to set
164         EqualizerBands &m_rEqBands;
165         /// Value to set
166         const string m_value;
167 };
168
169
170 #endif