X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fmenus.cpp;h=e6cef1905a331ac58de6b5d436c035e1e514e383;hb=1ad23782dd12171220d956b8ab5db1ebb67b7790;hp=be893ae40d31b960cfbb0af6018886b094c8ab51;hpb=01e4e9dc97e0868f481e798cc14f526dcef44ad0;p=vlc diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index be893ae40d..e6cef1905a 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -154,7 +154,7 @@ void EnableStaticEntries( QMenu *menu, bool enable = true ) if( !menu ) return; QList< QAction* > actions = menu->actions(); - for( int i = 0; i < actions.size(); ++i ) + for( int i = 0; i < actions.count(); ++i ) { actions[i]->setEnabled( actions[i]->data().toString() == ENTRY_ALWAYS_ENABLED || @@ -173,7 +173,7 @@ inline int DeleteNonStaticEntries( QMenu *menu ) int i_ret = 0; QList< QAction* > actions = menu->actions(); - for( int i = 0; i < actions.size(); ++i ) + for( int i = 0; i < actions.count(); ++i ) { if( actions[i]->data().toString() != STATIC_ENTRY ) delete actions[i]; @@ -189,7 +189,7 @@ inline int DeleteNonStaticEntries( QMenu *menu ) static QAction * FindActionWithVar( QMenu *menu, const char *psz_var ) { QList< QAction* > actions = menu->actions(); - for( int i = 0; i < actions.size(); ++i ) + for( int i = 0; i < actions.count(); ++i ) { if( actions[i]->data().toString() == psz_var ) return actions[i]; @@ -200,15 +200,15 @@ static QAction * FindActionWithVar( QMenu *menu, const char *psz_var ) /***************************************************************************** * Definitions of variables for the dynamic menus *****************************************************************************/ -#define PUSH_VAR( var ) varnames.push_back( var ); \ - objects.push_back( VLC_OBJECT(p_object) ) +#define PUSH_VAR( var ) varnames.append( var ); \ + objects.append( VLC_OBJECT(p_object) ) -#define PUSH_INPUTVAR( var ) varnames.push_back( var ); \ - objects.push_back( VLC_OBJECT(p_input) ); +#define PUSH_INPUTVAR( var ) varnames.append( var ); \ + objects.append( VLC_OBJECT(p_input) ); static int InputAutoMenuBuilder( input_thread_t *p_object, - vector &objects, - vector &varnames ) + QVector &objects, + QVector &varnames ) { PUSH_VAR( "bookmark" ); PUSH_VAR( "title" ); @@ -220,8 +220,8 @@ static int InputAutoMenuBuilder( input_thread_t *p_object, static int VideoAutoMenuBuilder( vout_thread_t *p_object, input_thread_t *p_input, - vector &objects, - vector &varnames ) + QVector &objects, + QVector &varnames ) { PUSH_INPUTVAR( "video-es" ); PUSH_INPUTVAR( "spu-es" ); @@ -243,10 +243,10 @@ static int VideoAutoMenuBuilder( vout_thread_t *p_object, return VLC_SUCCESS; } -static int AudioAutoMenuBuilder( aout_instance_t *p_object, +static int AudioAutoMenuBuilder( audio_output_t *p_object, input_thread_t *p_input, - vector &objects, - vector &varnames ) + QVector &objects, + QVector &varnames ) { PUSH_INPUTVAR( "audio-es" ); PUSH_VAR( "audio-channels" ); @@ -281,11 +281,13 @@ static inline void addAction( QMenu *_menu, QVariant val, QString title ) { } // Add an action with a submenu -static inline void addActionWithSubmenu( QMenu *_menu, QVariant val, QString title ) { +static inline QMenu *addActionWithSubmenu( QMenu *_menu, QVariant val, QString title ) { QAction *_action = new QAction( title, _menu ); + QMenu *_submenu = new QMenu( _menu ); _action->setData( val ); - _action->setMenu( new QMenu( _menu ) ); + _action->setMenu( _submenu ); _menu->addAction( _action ); + return _submenu; } // Add an action that is a checkbox @@ -526,10 +528,10 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface **/ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current ) { - vector objects; - vector varnames; - varnames.push_back( "intf-add" ); - objects.push_back( VLC_OBJECT(p_intf) ); + QVector objects; + QVector varnames; + varnames.append( "intf-add" ); + objects.append( VLC_OBJECT(p_intf) ); return Populate( p_intf, current, varnames, objects ); } @@ -563,9 +565,9 @@ void QVLCMenu::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu ) **/ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current ) { - vector objects; - vector varnames; - aout_instance_t *p_aout; + QVector objects; + QVector varnames; + audio_output_t *p_aout; input_thread_t *p_input; if( current->isEmpty() ) @@ -622,8 +624,8 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtit { vout_thread_t *p_vout; input_thread_t *p_input; - vector objects; - vector varnames; + QVector objects; + QVector varnames; if( current->isEmpty() ) { @@ -632,25 +634,32 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtit SubtitleMenu( current ); current->addSeparator(); - + /* Surface modifiers */ addActionWithCheckbox( current, "fullscreen", qtr( "&Fullscreen" ) ); addActionWithCheckbox( current, "autoscale", qtr( "Always Fit &Window" ) ); addActionWithCheckbox( current, "video-on-top", qtr( "Always &on Top" ) ); #ifdef WIN32 addActionWithCheckbox( current, "direct3d-desktop", qtr( "Display on &Desktop" ) ); #endif - addAction( current, "video-snapshot", qtr( "Take &Snapshot" ) ); + #ifdef WIN32 addActionWithCheckbox( current, "video-wallpaper", qtr( "Set as Wall&paper" ) ); #endif current->addSeparator(); - + /* Size modifiers */ addActionWithSubmenu( current, "zoom", qtr( "&Zoom" ) ); addActionWithSubmenu( current, "aspect-ratio", qtr( "&Aspect Ratio" ) ); addActionWithSubmenu( current, "crop", qtr( "&Crop" ) ); + + current->addSeparator(); + /* Rendering modifiers */ addActionWithSubmenu( current, "deinterlace", qtr( "&Deinterlace" ) ); addActionWithSubmenu( current, "deinterlace-mode", qtr( "&Deinterlace mode" ) ); addActionWithSubmenu( current, "postprocess", qtr( "&Post processing" ) ); + + current->addSeparator(); + /* Other actions */ + addAction( current, "video-snapshot", qtr( "Take &Snapshot" ) ); } p_input = THEMIM->getInput(); @@ -671,14 +680,17 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtit QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) { QAction *action; + QMenu *submenu; addActionWithSubmenu( menu, "title", qtr( "T&itle" ) ); addActionWithSubmenu( menu, "chapter", qtr( "&Chapter" ) ); - addActionWithSubmenu( menu, "navigation", qtr( "&Navigation" ) ); + submenu = addActionWithSubmenu( menu, "navigation", qtr( "&Navigation" ) ); + submenu->setTearOffEnabled( true ); addActionWithSubmenu( menu, "program", qtr( "&Program" ) ); /* FixMe: sync I_MENU_BOOKMARK string */ - QMenu *submenu = new QMenu( qtr( "Custom &Bookmarks" ), menu ); + submenu = new QMenu( qtr( "Custom &Bookmarks" ), menu ); + submenu->setTearOffEnabled( true ); addDPStaticEntry( submenu, qtr( "&Manage" ), "", SLOT( bookmarksDialog() ), "Ctrl+B" ); submenu->addSeparator(); @@ -697,8 +709,8 @@ QMenu *QVLCMenu::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu ) { /* */ input_thread_t *p_object; - vector objects; - vector varnames; + QVector objects; + QVector varnames; /* Get the input and hold it */ p_object = THEMIM->getInput(); @@ -743,8 +755,8 @@ QMenu *QVLCMenu::HelpMenu( QWidget *parent ) delete menu; menu = NULL; \ if( !show ) \ return; \ - vector objects; \ - vector varnames; \ + QVector objects; \ + QVector varnames; \ input_thread_t *p_input = THEMIM->getInput(); #define CREATE_POPUP \ @@ -782,7 +794,7 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(), SLOT( faster() ) ); #ifndef __APPLE__ /* No icons in menus in Mac */ - action->setIcon( QIcon( ":/toolbar/faster") ); + action->setIcon( QIcon( ":/toolbar/faster2") ); #endif action->setData( STATIC_ENTRY ); @@ -801,7 +813,7 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(), SLOT( slower() ) ); #ifndef __APPLE__ /* No icons in menus in Mac */ - action->setIcon( QIcon( ":/toolbar/slower") ); + action->setIcon( QIcon( ":/toolbar/slower2") ); #endif action->setData( STATIC_ENTRY ); @@ -894,7 +906,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf, bool show ) POPUP_BOILERPLATE if( p_input ) { - aout_instance_t *p_aout = THEMIM->getAout(); + audio_output_t *p_aout = THEMIM->getAout(); AudioAutoMenuBuilder( p_aout, p_input, objects, varnames ); if( p_aout ) vlc_object_release( p_aout ); @@ -909,7 +921,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf, bool show ) if( p_input ) { - varnames.push_back( "audio-es" ); + varnames.append( "audio-es" ); InputAutoMenuBuilder( p_input, objects, varnames ); menu->addSeparator(); } @@ -1015,13 +1027,13 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) vlc_object_t* p_object = p_intf->p_parent; objects.clear(); varnames.clear(); - objects.push_back( p_object ); - varnames.push_back( "intf-skins" ); + objects.append( p_object ); + varnames.append( "intf-skins" ); Populate( p_intf, submenu, varnames, objects ); objects.clear(); varnames.clear(); - objects.push_back( p_object ); - varnames.push_back( "intf-skins-interactive" ); + objects.append( p_object ); + varnames.append( "intf-skins-interactive" ); Populate( p_intf, submenu, varnames, objects ); } else @@ -1100,15 +1112,15 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, *************************************************************************/ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current, - vector< const char *> & varnames, - vector & objects ) + QVector< const char *> & varnames, + QVector & objects ) { QMenu *menu = current; assert( menu ); currentGroup = NULL; - for( int i = 0; i < (int)objects.size() ; i++ ) + for( int i = 0; i < (int)objects.count() ; i++ ) { if( !varnames[i] || !*varnames[i] ) { @@ -1473,14 +1485,14 @@ void QVLCMenu::updateRecents( intf_thread_t *p_intf ) recentsMenu->clear(); - if( !l.size() ) + if( !l.count() ) { action = recentsMenu->addAction( qtr(" - Empty - ") ); action->setEnabled( false ); } else { - for( int i = 0; i < l.size(); ++i ) + for( int i = 0; i < l.count(); ++i ) { char *psz_temp = decode_URI_duplicate( qtu( l.at( i ) ) );