CMenu * PortPopup::PortMenu(bool isInput) { CMenu *deviceMenu = new CMenu; CMenu *midiMenu = MidiMenu(isInput); CMenu *audio1Menu = AudioMenu(isInput, 1); CMenu *audio2Menu = AudioMenu(isInput, 2); CMenu *audio4Menu = AudioMenu(isInput, 4); CMenu *joyMenu = JoyMenu(isInput); deviceMenu->CreatePopupMenu(); if (isInput) { // audioPSMenu->AppendMenu(MF_STRING, WM_MDS_AUDIO_DEVICE_PAIR, "pair mono audio dev"); // joyMenu->AppendMenu(MF_STRING, WM_MDS_JOYSTICK_DEVICE, "joystick dev"); deviceMenu->AppendMenu(MF_POPUP, (UINT) midiMenu->m_hMenu, "midi input"); deviceMenu->AppendMenu(MF_POPUP, (UINT) audio1Menu->m_hMenu, "audio 1ch input"); deviceMenu->AppendMenu(MF_POPUP, (UINT) audio2Menu->m_hMenu, "audio 2ch input"); deviceMenu->AppendMenu(MF_POPUP, (UINT) joyMenu->m_hMenu, "joy input"); } else { // channelStreamMenu->AppendMenu(MF_STRING, WM_MDS_CHANNEL_STREAM, "stream to channel X"); // channelAudioMenu->AppendMenu(MF_STRING, WM_MDS_CHANNEL_AUDIO, "audio to channe X"); // parallelMenu->AppendMenu(MF_STRING, WM_MDS_MIDI_DEVICE, "parallel dev"); CMenu *channelAudioMenu = ChannelMenu(isInput); CMenu *channelStreamMenu = ChannelMenu(isInput); // channelStreamMenu->AppendMenu(MF_STRING, 2, "stream to channel X"); // joyMenu->AppendMenu(MF_POPUP, (UINT)channelStreamMenu->m_hMenu, "test"); deviceMenu->AppendMenu(MF_POPUP, (UINT) midiMenu->m_hMenu, "midi output"); deviceMenu->AppendMenu(MF_POPUP, (UINT) audio1Menu->m_hMenu, "audio 1ch output"); deviceMenu->AppendMenu(MF_POPUP, (UINT) audio2Menu->m_hMenu, "audio 2ch output"); deviceMenu->AppendMenu(MF_POPUP, (UINT) joyMenu->m_hMenu, "joy output"); deviceMenu->AppendMenu(MF_POPUP, (UINT) channelStreamMenu->m_hMenu, "channel stream output"); deviceMenu->AppendMenu(MF_POPUP, (UINT) channelAudioMenu->m_hMenu, "channel audio output"); } MENUINFO menuInfo; menuInfo.fMask = MIM_APPLYTOSUBMENUS|MIM_STYLE; menuInfo.dwStyle = MNS_MODELESS |MNS_AUTODISMISS // MNS_NOTIFYBYPOS ; deviceMenu->SetMenuInfo(&menuInfo); return deviceMenu; // Remove and destroy old menu //SetMenu(NULL); //CMenu* old_menu = CMenu::FromHandle(m_hMenuDefault); //old_menu->DestroyMenu(); // Add new menu. //SetMenu(&m_NewMenu); // Assign default menu //m_hMenuDefault = m_NewMenu.m_hMenu; }
/** * Main Menu Bar Creation **/ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf ) { /* QMainWindows->menuBar() gives the QProcess::destroyed timeout issue on Cleanlooks style with setDesktopAware set to false */ QMenuBar *bar = mi->menuBar(); BAR_ADD( FileMenu( p_intf, bar ), qtr( "&Media" ) ); /* Dynamic menus, rebuilt before being showed */ BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 ); BAR_DADD( AudioMenu( p_intf, bar ), qtr( "&Audio" ), 1 ); BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 ); BAR_ADD( ToolsMenu( bar ), qtr( "&Tools" ) ); BAR_ADD( ViewMenu( p_intf, mi ), qtr( "V&iew" ) ); BAR_ADD( HelpMenu( bar ), qtr( "&Help" ) ); }
/* Main Menu that sticks everything together */ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) { /* Delete old popup if there is one */ if( p_intf->p_sys->p_popup_menu ) delete p_intf->p_sys->p_popup_menu; if( !show ) { p_intf->p_sys->p_popup_menu = NULL; return; } /* */ QMenu *menu = new QMenu(); QAction *action; bool b_isFullscreen = false; MainInterface *mi = p_intf->p_sys->p_mi; POPUP_BOILERPLATE; PopupPlayEntries( menu, p_intf, p_input ); PopupMenuPlaylistControlEntries( menu, p_intf ); menu->addSeparator(); if( p_input ) { QMenu *submenu; vout_thread_t *p_vout = THEMIM->getVout(); /* Add a fullscreen switch button, since it is the most used function */ if( p_vout ) { vlc_value_t val; var_Get( p_vout, "fullscreen", &val ); b_isFullscreen = !( !val.b_bool ); if( b_isFullscreen ) CreateAndConnect( menu, "fullscreen", qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL, VLC_OBJECT(p_vout), val, VLC_VAR_BOOL, b_isFullscreen ); vlc_object_release( p_vout ); menu->addSeparator(); } /* Input menu */ InputAutoMenuBuilder( p_input, objects, varnames ); /* Audio menu */ submenu = new QMenu( menu ); action = menu->addMenu( AudioMenu( p_intf, submenu ) ); action->setText( qtr( "&Audio" ) ); if( action->menu()->isEmpty() ) action->setEnabled( false ); /* Video menu */ submenu = new QMenu( menu ); action = menu->addMenu( VideoMenu( p_intf, submenu ) ); action->setText( qtr( "&Video" ) ); if( action->menu()->isEmpty() ) action->setEnabled( false ); /* Playback menu for chapters */ submenu = new QMenu( menu ); action = menu->addMenu( NavigMenu( p_intf, submenu ) ); action->setText( qtr( "&Playback" ) ); if( action->menu()->isEmpty() ) action->setEnabled( false ); } menu->addSeparator(); /* Add some special entries for windowed mode: Interface Menu */ if( !b_isFullscreen ) { QMenu *submenu = new QMenu( qtr( "Interface" ), menu ); QMenu *tools = ToolsMenu( submenu ); submenu->addSeparator(); /* In skins interface, append some items */ if( !mi ) { vlc_object_t *p_object = ( vlc_object_t* ) vlc_object_find_name( p_intf, "skins2", FIND_PARENT ); if( p_object ) { objects.clear(); varnames.clear(); objects.push_back( p_object ); varnames.push_back( "intf-skins" ); Populate( p_intf, submenu, varnames, objects ); objects.clear(); varnames.clear(); objects.push_back( p_object ); varnames.push_back( "intf-skins-interactive" ); Populate( p_intf, submenu, varnames, objects ); vlc_object_release( p_object ); } else msg_Warn( p_intf, "could not find parent interface" ); } else menu->addMenu( ViewMenu( p_intf, mi, false )); menu->addMenu( submenu ); } /* Static entries for ending, like open */ PopupMenuStaticEntries( menu ); p_intf->p_sys->p_popup_menu = menu; p_intf->p_sys->p_popup_menu->popup( QCursor::pos() ); }
QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QWidget *parent ) { return AudioMenu( p_intf, new QMenu( parent ) ); }