1 /*****************************************************************************
2 * dialogs_provider.cpp : Dialog Provider
3 *****************************************************************************
4 * Copyright (C) 2006-2009 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
29 #include <vlc_intf_strings.h>
32 #include "dialogs_provider.hpp"
33 #include "input_manager.hpp" /* Load Subtitles */
35 #include "recents.hpp"
36 #include "util/qt_dirs.hpp"
37 #include "util/customwidgets.hpp" /* VLCKeyToString() */
38 #include "main_interface.hpp"
41 #include "dialogs/playlist.hpp"
42 #include "dialogs/bookmarks.hpp"
43 #include "dialogs/preferences.hpp"
44 #include "dialogs/mediainfo.hpp"
45 #include "dialogs/messages.hpp"
46 #include "dialogs/extended.hpp"
47 #include "dialogs/vlm.hpp"
48 #include "dialogs/sout.hpp"
49 #include "dialogs/convert.hpp"
50 #include "dialogs/open.hpp"
51 #include "dialogs/openurl.hpp"
52 #include "dialogs/help.hpp"
53 #include "dialogs/gototime.hpp"
54 #include "dialogs/podcast_configuration.hpp"
55 #include "dialogs/toolbar.hpp"
56 #include "dialogs/plugins.hpp"
57 #include "dialogs/external.hpp"
58 #include "dialogs/epg.hpp"
59 #include "dialogs/errors.hpp"
62 #include <QApplication>
63 #include <QSignalMapper>
64 #include <QFileDialog>
67 #define I_OP_DIR_WINTITLE I_DIR_OR_FOLDER( N_("Open Directory"), \
70 DialogsProvider
* DialogsProvider::instance
= NULL
;
72 DialogsProvider::DialogsProvider( intf_thread_t
*_p_intf
) :
73 QObject( NULL
), p_intf( _p_intf
),
75 videoPopupMenu( NULL
),
76 audioPopupMenu( NULL
),
81 /* Various signal mappers for the menus */
82 menusMapper
= new QSignalMapper();
83 CONNECT( menusMapper
, mapped(QObject
*), this, menuAction( QObject
*) );
85 menusUpdateMapper
= new QSignalMapper();
86 CONNECT( menusUpdateMapper
, mapped(QObject
*),
87 this, menuUpdateAction( QObject
*) );
89 new DialogHandler (p_intf
, this );
92 DialogsProvider::~DialogsProvider()
94 PlaylistDialog::killInstance();
95 MediaInfoDialog::killInstance();
96 MessagesDialog::killInstance();
97 BookmarksDialog::killInstance();
99 VLMDialog::killInstance();
101 HelpDialog::killInstance();
103 UpdateDialog::killInstance();
105 PluginDialog::killInstance();
106 EpgDialog::killInstance();
109 delete menusUpdateMapper
;
112 delete videoPopupMenu
;
113 delete audioPopupMenu
;
114 delete miscPopupMenu
;
117 QStringList
DialogsProvider::getOpenURL( QWidget
*parent
,
118 const QString
&caption
,
120 const QString
&filter
,
121 QString
*selectedFilter
)
124 QList
<QUrl
> urls
= QFileDialog::getOpenFileUrls( parent
, caption
, dir
, filter
, selectedFilter
);
126 foreach( const QUrl
& url
, urls
)
127 res
.append( url
.toEncoded() );
132 QString
DialogsProvider::getSaveFileName( QWidget
*parent
,
133 const QString
&caption
,
135 const QString
&filter
,
136 QString
*selectedFilter
)
138 const QStringList schemes
= QStringList(QStringLiteral("file"));
139 return QFileDialog::getSaveFileUrl( parent
, caption
, dir
, filter
, selectedFilter
, QFileDialog::Options(), schemes
).toLocalFile();
142 void DialogsProvider::quit()
145 libvlc_Quit( p_intf
->obj
.libvlc
);
148 void DialogsProvider::customEvent( QEvent
*event
)
150 if( event
->type() == DialogEvent::DialogEvent_Type
)
152 DialogEvent
*de
= static_cast<DialogEvent
*>(event
);
153 switch( de
->i_dialog
)
155 case INTF_DIALOG_FILE_SIMPLE
:
156 case INTF_DIALOG_FILE
:
158 case INTF_DIALOG_FILE_GENERIC
:
159 openFileGenericDialog( de
->p_arg
); break;
160 case INTF_DIALOG_DISC
:
161 openDiscDialog(); break;
162 case INTF_DIALOG_NET
:
163 openNetDialog(); break;
164 case INTF_DIALOG_SAT
:
165 case INTF_DIALOG_CAPTURE
:
166 openCaptureDialog(); break;
167 case INTF_DIALOG_DIRECTORY
:
168 PLAppendDir(); break;
169 case INTF_DIALOG_PLAYLIST
:
170 playlistDialog(); break;
171 case INTF_DIALOG_MESSAGES
:
172 messagesDialog(); break;
173 case INTF_DIALOG_FILEINFO
:
174 mediaInfoDialog(); break;
175 case INTF_DIALOG_PREFS
:
176 prefsDialog(); break;
177 case INTF_DIALOG_BOOKMARKS
:
178 bookmarksDialog(); break;
179 case INTF_DIALOG_EXTENDED
:
180 extendedDialog(); break;
181 case INTF_DIALOG_SENDKEY
:
182 sendKey( de
->i_arg
); break;
184 case INTF_DIALOG_VLM
:
187 case INTF_DIALOG_POPUPMENU
:
189 delete popupMenu
; popupMenu
= NULL
;
190 bool show
= (de
->i_arg
!= 0);
193 //popping a QMenu prevents mouse release events to be received,
194 //this ensures the coherency of the vout mouse state.
195 emit
releaseMouseEvents();
196 popupMenu
= VLCMenuBar::PopupMenu( p_intf
, show
);
200 case INTF_DIALOG_AUDIOPOPUPMENU
:
202 delete audioPopupMenu
; audioPopupMenu
= NULL
;
203 bool show
= (de
->i_arg
!= 0);
205 audioPopupMenu
= VLCMenuBar::AudioPopupMenu( p_intf
, show
);
208 case INTF_DIALOG_VIDEOPOPUPMENU
:
210 delete videoPopupMenu
; videoPopupMenu
= NULL
;
211 bool show
= (de
->i_arg
!= 0);
213 videoPopupMenu
= VLCMenuBar::VideoPopupMenu( p_intf
, show
);
216 case INTF_DIALOG_MISCPOPUPMENU
:
218 delete miscPopupMenu
; miscPopupMenu
= NULL
;
219 bool show
= (de
->i_arg
!= 0);
221 miscPopupMenu
= VLCMenuBar::MiscPopupMenu( p_intf
, show
);
224 case INTF_DIALOG_WIZARD
:
225 case INTF_DIALOG_STREAMWIZARD
:
226 openAndStreamingDialogs(); break;
228 case INTF_DIALOG_UPDATEVLC
:
229 updateDialog(); break;
231 case INTF_DIALOG_EXIT
:
234 msg_Warn( p_intf
, "unimplemented dialog" );
239 /****************************************************************************
240 * Individual simple dialogs
241 ****************************************************************************/
242 const QEvent::Type
DialogEvent::DialogEvent_Type
=
243 (QEvent::Type
)QEvent::registerEventType();
245 void DialogsProvider::playlistDialog()
247 PlaylistDialog::getInstance( p_intf
)->toggleVisible();
250 void DialogsProvider::prefsDialog()
252 PrefsDialog
*p
= new PrefsDialog( (QWidget
*)p_intf
->p_sys
->p_mi
, p_intf
);
256 void DialogsProvider::extendedDialog()
258 ExtendedDialog
*extDialog
= ExtendedDialog::getInstance(p_intf
);
260 if( !extDialog
->isVisible() || /* Hidden */
261 extDialog
->currentTab() != 0 ) /* wrong tab */
262 extDialog
->showTab( 0 );
267 void DialogsProvider::synchroDialog()
269 ExtendedDialog
*extDialog
= ExtendedDialog::getInstance(p_intf
);
271 if( !extDialog
->isVisible() || /* Hidden */
272 extDialog
->currentTab() != 2 ) /* wrong tab */
273 extDialog
->showTab( 2 );
278 void DialogsProvider::messagesDialog()
280 MessagesDialog::getInstance( p_intf
)->toggleVisible();
283 void DialogsProvider::gotoTimeDialog()
285 GotoTimeDialog::getInstance( p_intf
)->toggleVisible();
289 void DialogsProvider::vlmDialog()
291 VLMDialog::getInstance( p_intf
)->toggleVisible();
295 void DialogsProvider::helpDialog()
297 HelpDialog::getInstance( p_intf
)->toggleVisible();
301 void DialogsProvider::updateDialog()
303 UpdateDialog::getInstance( p_intf
)->toggleVisible();
307 void DialogsProvider::aboutDialog()
309 AboutDialog::getInstance( p_intf
)->toggleVisible();
312 void DialogsProvider::mediaInfoDialog()
314 MediaInfoDialog
*dialog
= MediaInfoDialog::getInstance( p_intf
);
315 if( !dialog
->isVisible() || dialog
->currentTab() != MediaInfoDialog::META_PANEL
)
316 dialog
->showTab( MediaInfoDialog::META_PANEL
);
321 void DialogsProvider::mediaCodecDialog()
323 MediaInfoDialog
*dialog
= MediaInfoDialog::getInstance( p_intf
);
324 if( !dialog
->isVisible() || dialog
->currentTab() != MediaInfoDialog::INFO_PANEL
)
325 dialog
->showTab( MediaInfoDialog::INFO_PANEL
);
330 void DialogsProvider::bookmarksDialog()
332 BookmarksDialog::getInstance( p_intf
)->toggleVisible();
335 void DialogsProvider::podcastConfigureDialog()
337 PodcastConfigDialog::getInstance( p_intf
)->toggleVisible();
340 void DialogsProvider::toolbarDialog()
342 ToolbarEditDialog
*toolbarEditor
= new ToolbarEditDialog( (QWidget
*)p_intf
->p_sys
->p_mi
, p_intf
);
343 if( toolbarEditor
->exec() == QDialog::Accepted
)
344 emit
toolBarConfUpdated();
347 void DialogsProvider::pluginDialog()
349 PluginDialog::getInstance( p_intf
)->toggleVisible();
352 void DialogsProvider::epgDialog()
354 EpgDialog::getInstance( p_intf
)->toggleVisible();
357 void DialogsProvider::setPopupMenu()
360 popupMenu
= VLCMenuBar::PopupMenu( p_intf
, true );
363 void DialogsProvider::destroyPopupMenu()
369 /* Generic open file */
370 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t
*p_arg
)
374 msg_Warn( p_intf
, "openFileGenericDialog() called with NULL arg" );
378 /* Replace the extensions to a Qt format */
380 QString extensions
= qfu( p_arg
->psz_extensions
);
381 while ( ( i
= extensions
.indexOf( "|", i
) ) != -1 )
383 if( ( extensions
.count( "|" ) % 2 ) == 0 )
384 extensions
.replace( i
, 1, ");;" );
386 extensions
.replace( i
, 1, "(" );
388 extensions
.replace( ";*", " *" );
389 extensions
.append( ")" );
394 QString file
= getSaveFileName( NULL
,
395 qfu( p_arg
->psz_title
),
396 p_intf
->p_sys
->filepath
, extensions
);
397 if( !file
.isEmpty() )
399 p_arg
->i_results
= 1;
400 p_arg
->psz_results
= (char **)vlc_alloc( p_arg
->i_results
, sizeof( char * ) );
401 p_arg
->psz_results
[0] = strdup( qtu( toNativeSepNoSlash( file
) ) );
404 p_arg
->i_results
= 0;
406 else /* non-save mode */
408 QStringList urls
= getOpenURL( NULL
, qfu( p_arg
->psz_title
),
409 p_intf
->p_sys
->filepath
, extensions
);
410 p_arg
->i_results
= urls
.count();
411 p_arg
->psz_results
= (char **)vlc_alloc( p_arg
->i_results
, sizeof( char * ) );
413 foreach( const QString
&uri
, urls
)
414 p_arg
->psz_results
[i
++] = strdup( qtu( uri
) );
416 p_intf
->p_sys
->filepath
= "";
418 p_intf
->p_sys
->filepath
= QUrl::fromEncoded(p_arg
->psz_results
[i
-1]);
422 if( p_arg
->pf_callback
)
423 p_arg
->pf_callback( p_arg
);
425 /* Clean afterwards */
426 if( p_arg
->psz_results
)
428 for( i
= 0; i
< p_arg
->i_results
; i
++ )
429 free( p_arg
->psz_results
[i
] );
430 free( p_arg
->psz_results
);
432 free( p_arg
->psz_title
);
433 free( p_arg
->psz_extensions
);
436 /****************************************************************************
437 * All the open/add stuff
438 * Open Dialog first - Simple Open then
439 ****************************************************************************/
441 void DialogsProvider::openDialog( int i_tab
)
443 OpenDialog::getInstance( p_intf
->p_sys
->p_mi
, p_intf
)->showTab( i_tab
);
445 void DialogsProvider::openDialog()
447 openDialog( OPEN_FILE_TAB
);
449 void DialogsProvider::openFileDialog()
451 openDialog( OPEN_FILE_TAB
);
453 void DialogsProvider::openDiscDialog()
455 openDialog( OPEN_DISC_TAB
);
457 void DialogsProvider::openNetDialog()
459 openDialog( OPEN_NETWORK_TAB
);
461 void DialogsProvider::openCaptureDialog()
463 openDialog( OPEN_CAPTURE_TAB
);
466 /* Same as the open one, but force the enqueue */
467 void DialogsProvider::PLAppendDialog( int tab
)
469 OpenDialog::getInstance( p_intf
->p_sys
->p_mi
, p_intf
, false,
470 OPEN_AND_ENQUEUE
)->showTab( tab
);
473 void DialogsProvider::MLAppendDialog( int tab
)
475 OpenDialog::getInstance( p_intf
->p_sys
->p_mi
, p_intf
, false,
476 OPEN_AND_ENQUEUE
, false, false )
483 QStringList
DialogsProvider::showSimpleOpen( const QString
& help
,
487 QString fileTypes
= "";
488 if( filters
& EXT_FILTER_MEDIA
) {
489 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_MEDIA
);
491 if( filters
& EXT_FILTER_VIDEO
) {
492 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_VIDEO
);
494 if( filters
& EXT_FILTER_AUDIO
) {
495 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_AUDIO
);
497 if( filters
& EXT_FILTER_PLAYLIST
) {
498 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_PLAYLIST
);
500 if( filters
& EXT_FILTER_SUBTITLE
) {
501 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_SUBTITLE
);
503 ADD_EXT_FILTER( fileTypes
, EXTENSIONS_ALL
);
504 fileTypes
.replace( ";*", " *");
505 fileTypes
.chop(2); //remove trailling ";;"
507 QStringList urls
= getOpenURL( NULL
,
508 help
.isEmpty() ? qtr(I_OP_SEL_FILES
) : help
,
509 path
.isEmpty() ? p_intf
->p_sys
->filepath
: path
,
512 if( !urls
.isEmpty() )
513 p_intf
->p_sys
->filepath
= QUrl( urls
.last() );
520 * pl helps you to choose from playlist or media library,
521 * go to start or enqueue
523 void DialogsProvider::addFromSimple( bool pl
, bool go
)
525 QStringList urls
= DialogsProvider::showSimpleOpen();
529 foreach( const QString
&url
, urls
)
531 Open::openMRL( p_intf
, url
, first
, pl
);
536 void DialogsProvider::simpleOpenDialog()
538 addFromSimple( true, true ); /* Playlist and Go */
541 /* Url & Clipboard */
544 * If the clipboard contains URLs, the first is automatically 'preselected'.
546 void DialogsProvider::openUrlDialog()
548 OpenUrlDialog
oud( p_intf
);
549 if( oud
.exec() != QDialog::Accepted
)
552 QString url
= oud
.url();
556 if( !url
.contains( qfu( "://" ) ) )
558 char *uri
= vlc_path2uri( qtu( url
), NULL
);
565 Open::openMRL( p_intf
, qtu(url
), !oud
.shouldEnqueue() );
571 * pl helps you to choose from playlist or media library,
572 * go to start or enqueue
574 static void openDirectory( intf_thread_t
*p_intf
, bool pl
, bool go
)
576 QString uri
= DialogsProvider::getDirectoryDialog( p_intf
);
578 Open::openMRL( p_intf
, uri
, go
, pl
);
581 QString
DialogsProvider::getDirectoryDialog( intf_thread_t
*p_intf
)
583 const QStringList schemes
= QStringList(QStringLiteral("file"));
584 QString dir
= QFileDialog::getExistingDirectoryUrl( NULL
,
585 qtr( I_OP_DIR_WINTITLE
), p_intf
->p_sys
->filepath
,
586 QFileDialog::ShowDirsOnly
, schemes
).toLocalFile();
588 if( dir
.isEmpty() ) return QString();
590 p_intf
->p_sys
->filepath
= dir
;
592 const char *scheme
= "directory";
593 if( dir
.endsWith( DIR_SEP
"VIDEO_TS", Qt::CaseInsensitive
) )
595 else if( dir
.endsWith( DIR_SEP
"BDMV", Qt::CaseInsensitive
) )
598 dir
.remove( "BDMV" );
601 char *uri
= vlc_path2uri( qtu( toNativeSeparators( dir
) ), scheme
);
602 if( unlikely(uri
== NULL
) )
608 RecentsMRL::getInstance( p_intf
)->addRecent( dir
);
613 void DialogsProvider::PLOpenDir()
615 openDirectory( p_intf
, true, true );
618 void DialogsProvider::PLAppendDir()
620 openDirectory( p_intf
, true, false );
626 void DialogsProvider::openAPlaylist()
628 QStringList urls
= showSimpleOpen( qtr( "Open playlist..." ),
629 EXT_FILTER_PLAYLIST
);
630 foreach( const QString
&url
, urls
)
632 char* psz_path
= vlc_uri2path(qtu( url
));
635 msg_Warn( p_intf
, "unable to load playlist '%s'", qtu( url
) );
638 playlist_Import( THEPL
, psz_path
);
643 void DialogsProvider::savePlayingToPlaylist()
647 char filter_name
[14];
648 char filter_patterns
[5];
651 { N_("XSPF playlist"), "xspf", "export-xspf", },
652 { N_("M3U playlist"), "m3u", "export-m3u", },
653 { N_("M3U8 playlist"), "m3u8", "export-m3u8", },
654 { N_("HTML playlist"), "html", "export-html", },
658 QString ext
= getSettings()->value( "last-playlist-ext" ).toString();
660 for( size_t i
= 0; i
< sizeof (types
) / sizeof (types
[0]); i
++ )
662 QString tmp
= qfu( vlc_gettext( types
[i
].filter_name
) ) + " (*." + types
[i
].filter_patterns
+ ")";
663 if( ext
== qfu( types
[i
].filter_patterns
) )
664 filters
.insert( 0, tmp
);
666 filters
.append( tmp
);
670 QString file
= getSaveFileName( NULL
,
671 qtr( "Save playlist as..." ),
672 p_intf
->p_sys
->filepath
, filters
.join( ";;" ),
674 const char *psz_selected_module
= NULL
;
675 const char *psz_last_playlist_ext
= NULL
;
680 /* First test if the file extension is set, and different to selected filter */
681 for( size_t i
= 0; i
< sizeof (types
) / sizeof (types
[0]); i
++)
683 if ( file
.endsWith( QString( "." ) + qfu( types
[i
].filter_patterns
) ) )
685 psz_selected_module
= types
[i
].module
;
686 psz_last_playlist_ext
= types
[i
].filter_patterns
;
691 /* otherwise apply the selected extension */
692 if ( !psz_last_playlist_ext
)
694 for( size_t i
= 0; i
< sizeof (types
) / sizeof (types
[0]); i
++)
696 if ( selected
.startsWith( qfu( vlc_gettext( types
[i
].filter_name
) ) ) )
698 psz_selected_module
= types
[i
].module
;
699 psz_last_playlist_ext
= types
[i
].filter_patterns
;
700 /* Fix file extension */
701 file
= file
.append( QString( "." ) + qfu( psz_last_playlist_ext
) );
707 if ( psz_selected_module
)
709 playlist_Export( THEPL
, qtu( toNativeSeparators( file
) ),
710 true, psz_selected_module
);
711 getSettings()->setValue( "last-playlist-ext", psz_last_playlist_ext
);
715 /****************************************************************************
717 ****************************************************************************/
719 void DialogsProvider::streamingDialog( QWidget
*parent
,
720 const QStringList
& mrls
,
721 bool b_transcode_only
,
722 QStringList options
)
724 QStringList outputMRLs
;
727 // Does streaming multiple files make sense? I suppose so, just stream one
728 // after the other, but not at the moment.
729 if( !b_transcode_only
)
731 SoutDialog
*s
= new SoutDialog( parent
, p_intf
, mrls
[0] );
732 s
->setAttribute( Qt::WA_QuitOnClose
, false ); // See #4883
733 if( s
->exec() == QDialog::Accepted
)
735 outputMRLs
.append(s
->getMrl());
744 ConvertDialog
*s
= new ConvertDialog( parent
, p_intf
, mrls
);
745 s
->setAttribute( Qt::WA_QuitOnClose
, false ); // See #4883
746 if( s
->exec() == QDialog::Accepted
)
748 /* Clear the playlist. This is because we're going to be populating
750 playlist_Clear( THEPL
, pl_Unlocked
);
752 outputMRLs
= s
->getMrls();
762 if( !outputMRLs
.isEmpty() )
764 /* For all of our MRLs */
765 for(int i
= 0; i
< outputMRLs
.length(); i
++)
768 /* Duplicate the options list. This is because we need to have a
769 copy for every file we add to the playlist.*/
770 QStringList optionsCopy
;
771 for(int j
= 0; j
< options
.length(); j
++)
773 optionsCopy
.append(options
[j
]);
776 optionsCopy
+= outputMRLs
[i
].split( " :");
777 QString title
= "Converting " + mrls
[i
];
779 /* Add each file to convert to our playlist, making sure to not attempt to start playing it.*/
780 Open::openMRLwithOptions( p_intf
, mrls
[i
], &optionsCopy
, false, true, qtu( title
) );
783 /* Start the playlist from the beginning */
784 playlist_Control(THEPL
,PLAYLIST_PLAY
,pl_Unlocked
);
788 void DialogsProvider::openAndStreamingDialogs()
790 OpenDialog::getInstance( p_intf
->p_sys
->p_mi
, p_intf
, false, OPEN_AND_STREAM
)
791 ->showTab( OPEN_FILE_TAB
);
794 void DialogsProvider::openAndTranscodingDialogs()
796 OpenDialog::getInstance( p_intf
->p_sys
->p_mi
, p_intf
, false, OPEN_AND_SAVE
)
797 ->showTab( OPEN_FILE_TAB
);
800 void DialogsProvider::loadSubtitlesFile()
802 input_thread_t
*p_input
= THEMIM
->getInput();
803 if( !p_input
) return;
805 input_item_t
*p_item
= input_GetItem( p_input
);
806 if( !p_item
) return;
808 char *path
= input_item_GetURI( p_item
);
812 path2
= vlc_uri2path( path
);
816 char *sep
= strrchr( path2
, DIR_SEP_CHAR
);
817 if( sep
) *sep
= '\0';
821 QStringList qsl
= showSimpleOpen( qtr( "Open subtitles..." ),
825 foreach( const QString
&qsUrl
, qsl
)
827 if( input_AddSlave( p_input
, SLAVE_TYPE_SPU
, qtu( qsUrl
), true, true, false ) )
828 msg_Warn( p_intf
, "unable to load subtitles from '%s'",
834 /****************************************************************************
836 ****************************************************************************/
838 void DialogsProvider::menuAction( QObject
*data
)
840 VLCMenuBar::DoAction( data
);
843 void DialogsProvider::menuUpdateAction( QObject
*data
)
845 MenuFunc
*func
= qobject_cast
<MenuFunc
*>(data
);
847 func
->doFunc( p_intf
);
850 void DialogsProvider::sendKey( int key
)
852 // translate from a vlc keycode into a Qt sequence
853 QKeySequence
kseq0( VLCKeyToString( key
, true ) );
855 if( popupMenu
== NULL
)
857 // make sure at least a non visible popupmenu is available
858 popupMenu
= VLCMenuBar::PopupMenu( p_intf
, false );
859 if( unlikely( popupMenu
== NULL
) )
863 // test against key accelerators from the popupmenu
864 QList
<QAction
*> actions
= popupMenu
->findChildren
<QAction
*>();
865 for( int i
= 0; i
< actions
.size(); i
++ )
867 QAction
* action
= actions
.at(i
);
868 QKeySequence kseq
= action
->shortcut();
876 // forward key to vlc core when not a key accelerator
877 var_SetInteger( p_intf
->obj
.libvlc
, "key-pressed", key
);