1 /*****************************************************************************
2 * menus.hpp : Menus handling
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
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.
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.
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. *****************************************************************************/
35 class MenuItemData : public QObject
38 MenuItemData( int i_id, int _i_type, vlc_value_t _val, const char *_var )
43 psz_var = strdup( _var );
45 virtual ~MenuItemData()
47 if( psz_var ) free( psz_var );
48 if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
49 && val.psz_string ) free( val.psz_string );
57 class QVLCMenu : public QObject
61 static void createMenuBar( MainInterface *mi, intf_thread_t *, bool, bool, bool );
64 static QMenu *FileMenu();
65 static QMenu *SDMenu( intf_thread_t * );
66 static QMenu *PlaylistMenu( MainInterface *, intf_thread_t *);
67 static QMenu *ToolsMenu( intf_thread_t *, MainInterface *, bool, bool,
69 static QMenu *NavigMenu( intf_thread_t * , QMenu * );
70 static QMenu *VideoMenu( intf_thread_t * , QMenu * );
71 static QMenu *AudioMenu( intf_thread_t * , QMenu * );
72 static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
73 static QMenu *HelpMenu();
76 static void AudioPopupMenu( intf_thread_t * );
77 static void VideoPopupMenu( intf_thread_t * );
78 static void MiscPopupMenu( intf_thread_t * );
79 static void PopupMenu( intf_thread_t * );
81 static void DoAction( intf_thread_t *, QObject * );
83 /* Generic automenu methods */
84 static QMenu * Populate( intf_thread_t *, QMenu *current,
85 vector<const char*>&, vector<int>&,
86 bool append = false );
88 static void CreateAndConnect( QMenu *, const char *, QString, QString,
89 int, int, vlc_value_t, int, bool c = false );
90 static void CreateItem( QMenu *, const char *, vlc_object_t *, bool );
91 static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool );
95 class MenuFunc : public QObject
98 MenuFunc( QMenu *_menu, int _id ) { menu = _menu; id = _id; };
99 void doFunc( intf_thread_t *p_intf)
103 case 1: QVLCMenu::VideoMenu( p_intf, menu ); break;
104 case 2: QVLCMenu::AudioMenu( p_intf, menu ); break;
105 case 3: QVLCMenu::NavigMenu( p_intf, menu ); break;
106 case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break;