X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fmenus.cpp;h=04aaad4b7fb158f31983b216e433e833cbede270;hb=47e69cf6132dfd1daa1ef8fb17fa6b2af5c16e18;hp=5962c192d2c540098a64a7b7da9dcb7b78501a8d;hpb=223419069363b3eab712cff2d0ac671a94d8fc65;p=vlc diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 5962c192d2..04aaad4b7f 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -72,6 +72,10 @@ enum static QActionGroup *currentGroup; +/* HACK for minimalView to go around a Qt bug/feature + * that doesn't update the QAction checked state when QMenu is hidden */ +QAction *QVLCMenu::minimalViewAction = NULL; + // Add static entries to menus void addDPStaticEntry( QMenu *menu, const QString text, @@ -213,7 +217,6 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object, PUSH_INPUTVAR( "audio-es" ); PUSH_VAR( "audio-device" ); PUSH_VAR( "audio-channels" ); - PUSH_VAR( "equalizer" ); PUSH_VAR( "visual" ); return VLC_SUCCESS; } @@ -275,7 +278,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi, qtr( "&Tools" ) ); BAR_DADD( AudioMenu( p_intf, NULL ), qtr( "&Audio" ), 1 ); BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 ); - BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "&Playback" ), 3 ); + BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "P&layback" ), 3 ); BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) ); } #undef BAR_ADD @@ -290,27 +293,27 @@ QMenu *QVLCMenu::FileMenu() QMenu *menu = new QMenu(); addDPStaticEntry( menu, qtr( "&Open File..." ), "", - ":/pixmaps/file-asym_16px.png", SLOT( openFileDialog() ), "Ctrl+O" ); + ":/file-asym", SLOT( openFileDialog() ), "Ctrl+O" ); addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "", - ":/pixmaps/folder-grey_16px.png", SLOT( PLAppendDir() ), "Ctrl+F" ); + ":/folder-grey", SLOT( PLAppendDir() ), "Ctrl+F" ); addDPStaticEntry( menu, qtr( "Open &Disc..." ), "", - ":/pixmaps/disc_16px.png", SLOT( openDiscDialog() ), "Ctrl+D" ); + ":/disc", SLOT( openDiscDialog() ), "Ctrl+D" ); addDPStaticEntry( menu, qtr( "Open &Network..." ), "", - ":/pixmaps/network_16px.png", SLOT( openNetDialog() ), "Ctrl+N" ); + ":/network", SLOT( openNetDialog() ), "Ctrl+N" ); addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "", - ":/pixmaps/capture-card_16px.png", SLOT( openCaptureDialog() ), + ":/capture-card", SLOT( openCaptureDialog() ), "Ctrl+C" ); menu->addSeparator(); addDPStaticEntry( menu, qtr( "&Streaming..." ), "", - ":/pixmaps/menus_stream_16px.png", SLOT( openThenStreamingDialogs() ), + ":/stream", SLOT( openThenStreamingDialogs() ), "Ctrl+S" ); addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "", SLOT( openThenTranscodingDialogs() ), "Ctrl+R" ); menu->addSeparator(); addDPStaticEntry( menu, qtr( "&Quit" ) , "", - ":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "Ctrl+Q" ); + ":/quit", SLOT( quit() ), "Ctrl+Q" ); return menu; } @@ -319,17 +322,17 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi ) { QMenu *menu = new QMenu(); menu->addMenu( SDMenu( p_intf ) ); - menu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ), - qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) ); + menu->addAction( QIcon( ":/playlist_menu" ), + qtr( "Show P&laylist" ), mi, SLOT( togglePlaylist() ) ); menu->addSeparator(); addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ), "Ctrl+X" ); addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ), "Ctrl+Y" ); - menu->addSeparator(); + /*menu->addSeparator(); menu->addAction( qtr( "Undock from Interface" ), mi, - SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) ); + SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/ return menu; } @@ -348,43 +351,46 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, QMenu *menu = new QMenu( current ); if( mi ) { - menu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ), - qtr( "Playlist..." ), mi, SLOT( togglePlaylist() ), - qtr( "Ctrl+L" ) ); + QAction *act= + menu->addAction( QIcon( ":/playlist_menu" ), qtr( "Play&list..." ), + mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) ); + act->setData( "_static_" ); } - addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", - ":/pixmaps/menus_settings_16px.png", SLOT( extendedDialog() ), - "Ctrl+E" ); + addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings", + SLOT( extendedDialog() ), "Ctrl+E" ); menu->addSeparator(); if( with_intf ) { QMenu *intfmenu = InterfacesMenu( p_intf, menu ); - intfmenu->setTitle( qtr( "Add Interfaces" ) ); MenuFunc *f = new MenuFunc( intfmenu, 4 ); CONNECT( intfmenu, aboutToShow(), THEDP->menusUpdateMapper, map() ); THEDP->menusUpdateMapper->setMapping( intfmenu, f ); - menu->addMenu( intfmenu ); menu->addSeparator(); } if( mi ) { /* Minimal View */ - QAction *action = menu->addAction( qtr( "Minimal View..." ), mi, + QAction *action = menu->addAction( qtr( "Mi&nimal View..." ), mi, SLOT( toggleMinimalView() ), qtr( "Ctrl+H" ) ); action->setCheckable( true ); + action->setData( "_static_" ); if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE ) action->setChecked( true ); + minimalViewAction = action; /* HACK for minimalView */ /* FullScreen View */ - action = menu->addAction( qtr( "Toggle Fullscreen Interface" ), mi, + action = menu->addAction( qtr( "&Fullscreen Interface" ), mi, SLOT( toggleFullScreen() ), QString( "F11" ) ); + action->setCheckable( true ); + action->setData( "_static_" ); /* Advanced Controls */ - action = menu->addAction( qtr( "Advanced Controls" ), mi, + action = menu->addAction( qtr( "&Advanced Controls" ), mi, SLOT( toggleAdvanced() ) ); action->setCheckable( true ); + action->setData( "_static_" ); if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED ) action->setChecked( true ); #if 0 /* For Visualisations. Not yet working */ @@ -398,12 +404,12 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, menu->addSeparator(); addDPStaticEntry( menu, qtr( I_MENU_MSG ), "", - ":/pixmaps/menus_messages_16px.png", SLOT( messagesDialog() ), + ":/messages", SLOT( messagesDialog() ), "Ctrl+M" ); - addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", "", + addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", ":/info", SLOT( mediaInfoDialog() ), "Ctrl+I" ); addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "", - ":/pixmaps/menus_info_16px.png", SLOT( mediaCodecDialog() ), "Ctrl+J" ); + ":/info", SLOT( mediaCodecDialog() ), "Ctrl+J" ); addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","", SLOT( bookmarksDialog() ), "Ctrl+B" ); #ifdef ENABLE_VLM @@ -412,8 +418,8 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, #endif menu->addSeparator(); - addDPStaticEntry( menu, qtr( "Preferences..." ), "", - ":/pixmaps/menus_preferences_16px.png", SLOT( prefsDialog() ), "Ctrl+P" ); + addDPStaticEntry( menu, qtr( "&Preferences..." ), "", + ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" ); return menu; } @@ -428,10 +434,7 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current ) varnames.push_back( "intf-add" ); objects.push_back( p_intf->i_object_id ); - QMenu *submenu = new QMenu( current ); - QMenu *menu = Populate( p_intf, submenu, varnames, objects ); - - return menu; + return Populate( p_intf, current, varnames, objects ); } /** @@ -451,7 +454,6 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current ) ACT_ADD( current, "audio-es", qtr( "Audio &Track" ) ); ACT_ADD( current, "audio-device", qtr( "Audio &Device" ) ); ACT_ADD( current, "audio-channels", qtr( "Audio &Channels" ) ); - ACT_ADD( current, "equalizer", qtr( "&Equalizer" ) ); current->addSeparator(); ACT_ADD( current, "visual", qtr( "&Visualizations" ) ); } @@ -498,14 +500,14 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current ) SLOT( loadSubtitlesFile() ) ); submenu->addSeparator(); - ACT_ADD( current, "fullscreen", qtr( "Toggle &Fullscreen" ) ); + ACT_ADD( current, "fullscreen", qtr( "&Fullscreen" ) ); ACT_ADD( current, "zoom", qtr( "&Zoom" ) ); ACT_ADD( current, "deinterlace", qtr( "&Deinterlace" ) ); ACT_ADD( current, "aspect-ratio", qtr( "&Aspect Ratio" ) ); ACT_ADD( current, "crop", qtr( "&Crop" ) ); ACT_ADD( current, "video-on-top", qtr( "Always &On Top" ) ); /* ACT_ADD( current, "directx-wallpaper", qtr( "DirectX Wallpaper" ) ); */ - ACT_ADD( current, "video-snapshot", qtr( "Snapshot" ) ); + ACT_ADD( current, "video-snapshot", qtr( "Sna&pshot" ) ); /* ACT_ADD( current, "ffmpeg-pp-q", qtr( "Decoder" ) ); */ } @@ -544,7 +546,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) menu->addSeparator(); ACT_ADD( menu, "bookmark", qtr( "&Bookmarks" ) ); - ACT_ADD( menu, "title", qtr( "&Title" ) ); + ACT_ADD( menu, "title", qtr( "T&itle" ) ); ACT_ADD( menu, "chapter", qtr( "&Chapter" ) ); ACT_ADD( menu, "program", qtr( "&Program" ) ); ACT_ADD( menu, "navigation", qtr( "&Navigation" ) ); @@ -591,7 +593,7 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf ) if( !strcmp( *ppsz_name, "podcast" ) ) { - QAction *b = new QAction( qfu( "Configure podcasts..." ), menu ); + QAction *b = new QAction( qtr( "Configure podcasts..." ), menu ); //b->setEnabled( a->isChecked() ); menu->addAction( b ); CONNECT( b, triggered(), THEDP, podcastConfigureDialog() ); @@ -609,15 +611,15 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf ) QMenu *QVLCMenu::HelpMenu( QMenu *current ) { QMenu *menu = new QMenu( current ); - addDPStaticEntry( menu, qtr( "Help..." ) , "", - ":/pixmaps/menus_help_16px.png", SLOT( helpDialog() ), "F1" ); + addDPStaticEntry( menu, qtr( "&Help..." ) , "", + ":/help", SLOT( helpDialog() ), "F1" ); #ifdef UPDATE_CHECK - addDPStaticEntry( menu, qtr( "Check for Updates..." ) , "", "", + addDPStaticEntry( menu, qtr( "Check for &Updates..." ) , "", "", SLOT( updateDialog() ), ""); #endif menu->addSeparator(); - addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", "", SLOT( aboutDialog() ), - "Ctrl+F1" ); + addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", ":/info", + SLOT( aboutDialog() ), "Ctrl+F1" ); return menu; } @@ -647,24 +649,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, var_Get( p_input, "state", &val ); if( val.i_int == PLAYING_S ) addMIMStaticEntry( p_intf, menu, qtr( "Pause" ), "", - ":/pixmaps/pause_16px.png", SLOT( togglePlayPause() ) ); + ":/pause", SLOT( togglePlayPause() ) ); else addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", - ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) ); + ":/play", SLOT( togglePlayPause() ) ); } else if( THEPL->items.i_size ) addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", - ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) ); + ":/play", SLOT( togglePlayPause() ) ); else addDPStaticEntry( menu, qtr( "Play" ), "", - ":/pixmaps/play_16px.png", SLOT( openDialog() ) ); + ":/play", SLOT( openDialog() ) ); addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), "", - ":/pixmaps/stop_16px.png", SLOT( stop() ) ); + ":/stop", SLOT( stop() ) ); addMIMStaticEntry( p_intf, menu, qtr( "Previous" ), "", - ":/pixmaps/previous_16px.png", SLOT( prev() ) ); + ":/previous", SLOT( prev() ) ); addMIMStaticEntry( p_intf, menu, qtr( "Next" ), "", - ":/pixmaps/next_16px.png", SLOT( next() ) ); + ":/next", SLOT( next() ) ); } void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) @@ -677,15 +679,15 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) QMenu *openmenu = new QMenu( qtr( "Open" ), menu ); addDPStaticEntry( openmenu, qtr( "&Open File..." ), "", - ":/pixmaps/file-asym_16px.png", SLOT( openFileDialog() ) ); + ":/file-asym", SLOT( openFileDialog() ) ); addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ), "", - ":/pixmaps/folder-grey_16px.png", SLOT( PLAppendDir() ) ); + ":/folder-grey", SLOT( PLAppendDir() ) ); addDPStaticEntry( openmenu, qtr( "Open &Disc..." ), "", - ":/pixmaps/disc_16px.png", SLOT( openDiscDialog() ) ); + ":/disc", SLOT( openDiscDialog() ) ); addDPStaticEntry( openmenu, qtr( "Open &Network..." ), "", - ":/pixmaps/network_16px.png", SLOT( openNetDialog() ) ); + ":/network", SLOT( openNetDialog() ) ); addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ), "", - ":/pixmaps/capture-card_16px.png", SLOT( openCaptureDialog() ) ); + ":/capture-card", SLOT( openCaptureDialog() ) ); menu->addMenu( openmenu ); menu->addSeparator(); @@ -695,7 +697,7 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) menu->addMenu( helpmenu ); #endif - addDPStaticEntry( menu, qtr( "Quit" ), "", ":/pixmaps/menus_quit_16px.png", + addDPStaticEntry( menu, qtr( "Quit" ), "", ":/quit", SLOT( quit() ), "Ctrl+Q" ); } @@ -835,10 +837,10 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) if( !b_isFullscreen ) { submenu = new QMenu( qtr( "Interface" ), menu ); - submenu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ), + submenu->addAction( QIcon( ":/playlist" ), qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) ); addDPStaticEntry( submenu, qtr( I_MENU_EXT ), "", - ":/pixmaps/menus_settings_16px.png", SLOT( extendedDialog() ) ); + ":/settings", SLOT( extendedDialog() ) ); action = submenu->addAction( QIcon( "" ), qtr( "Minimal View..." ), mi, SLOT( toggleMinimalView() ) ); action->setCheckable( true ); @@ -900,9 +902,9 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, sysMenu->addSeparator(); addDPStaticEntry( sysMenu, qtr( "&Open Media" ), "", - ":/pixmaps/file-wide_16px.png", SLOT( openFileDialog() ), "" ); + ":/file-wide", SLOT( openFileDialog() ), "" ); addDPStaticEntry( sysMenu, qtr( "&Quit" ) , "", - ":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "" ); + ":/quit", SLOT( quit() ), "" ); /* Set the menu */ mi->getSysTray()->setContextMenu( sysMenu ); @@ -958,11 +960,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, } } - /* Ugly specific stuff */ - if( strstr( varnames[i], "intf-add" ) ) - UpdateItem( p_intf, menu, varnames[i], p_object, false ); - else - UpdateItem( p_intf, menu, varnames[i], p_object, true ); + UpdateItem( p_intf, menu, varnames[i], p_object, true ); if( p_object ) vlc_object_release( p_object ); } @@ -1241,7 +1239,7 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var, } } - action->setText( text ); + /* FIXME action->setText( text ); */ action->setToolTip( help ); action->setEnabled( i_object_id != 0 );