#include "menus.hpp"
#include "recents.hpp"
#include "util/qt_dirs.hpp"
+#include "main_interface.hpp"
/* The dialogs */
#include "dialogs/playlist.hpp"
#include <QSignalMapper>
#include <QFileDialog>
+#define I_OP_DIR_WINTITLE I_DIR_OR_FOLDER( N_("Open Directory"), \
+ N_("Open Folder") )
DialogsProvider* DialogsProvider::instance = NULL;
UpdateDialog::killInstance();
#endif
PluginDialog::killInstance();
- PodcastConfigDialog::killInstance();
- EpgDialog::killInstance();
- ErrorsDialog::killInstance();
delete menusMapper;
delete menusUpdateMapper;
delete SDMapper;
+
+ QVLCMenu::PopupMenu( p_intf, false );
+ QVLCMenu::AudioPopupMenu( p_intf, false );
+ QVLCMenu::VideoPopupMenu( p_intf, false );
+ QVLCMenu::MiscPopupMenu( p_intf, false );
}
void DialogsProvider::quit()
case INTF_DIALOG_POPUPMENU:
QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_AUDIOPOPUPMENU:
- QVLCMenu::AudioPopupMenu( p_intf ); break;
+ QVLCMenu::AudioPopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_VIDEOPOPUPMENU:
- QVLCMenu::VideoPopupMenu( p_intf ); break;
+ QVLCMenu::VideoPopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_MISCPOPUPMENU:
- QVLCMenu::MiscPopupMenu( p_intf ); break;
+ QVLCMenu::MiscPopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_WIZARD:
case INTF_DIALOG_STREAMWIZARD:
openAndStreamingDialogs(); break;
void DialogsProvider::addFromSimple( bool pl, bool go)
{
QStringList files = DialogsProvider::showSimpleOpen();
- int i = 0;
+ int mode = go ? PLAYLIST_GO : PLAYLIST_PREPARSE;
+
files.sort();
foreach( const QString &file, files )
{
- char* psz_uri = make_URI( qtu( toNativeSeparators(file) ) );
- playlist_Add( THEPL, psz_uri, NULL,
- go ? ( PLAYLIST_APPEND | ( i ? PLAYLIST_PREPARSE : PLAYLIST_GO ) )
- : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
+ QString url = toURI( file );
+ playlist_Add( THEPL, qtu( url ), NULL, PLAYLIST_APPEND | mode,
PLAYLIST_END, pl, pl_Unlocked );
- free( psz_uri );
- RecentsMRL::getInstance( p_intf )->addRecent(
- toNativeSeparators( file ) );
- i++;
+ RecentsMRL::getInstance( p_intf )->addRecent( url );
+ mode = PLAYLIST_PREPARSE;
}
}
**/
static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
{
- QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory"), p_intf->p_sys->filepath );
+ QString dir = QFileDialog::getExistingDirectory( NULL, qtr( I_OP_DIR_WINTITLE ), p_intf->p_sys->filepath );
- if (!dir.isEmpty() )
- {
- QString mrl = (dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
- "dvd://" : "directory://")
- + toNativeSeparators( dir );
- input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
+ if( dir.isEmpty() )
+ return;
- /* FIXME: playlist_AddInput() can fail */
- playlist_AddInput( THEPL, p_input,
- go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
+ const char *scheme = "directory";
+ if( dir.endsWith( "/VIDEO_TS", Qt::CaseInsensitive ) )
+ scheme = "dvd";
+
+ char *uri = make_URI( qtu( toNativeSeparators( dir ) ), scheme );
+ if( unlikely(uri == NULL) )
+ return;
+
+ RecentsMRL::getInstance( p_intf )->addRecent( qfu(uri) );
+
+ input_item_t *p_input = input_item_New( THEPL, uri, NULL );
+ free( uri );
+ if( unlikely( p_input == NULL ) )
+ return;
+
+ /* FIXME: playlist_AddInput() can fail */
+ playlist_AddInput( THEPL, p_input,
+ go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
PLAYLIST_END, pl, pl_Unlocked );
- RecentsMRL::getInstance( p_intf )->addRecent( mrl );
- if( !go )
- input_Read( THEPL, p_input );
- vlc_gc_decref( p_input );
- }
+ if( !go )
+ input_Read( THEPL, p_input );
+ vlc_gc_decref( p_input );
}
void DialogsProvider::PLOpenDir()
**/
void DialogsProvider::playMRL( const QString &mrl )
{
- char* psz_uri = make_URI( qtu(mrl) );
- playlist_Add( THEPL, psz_uri, NULL,
+ playlist_Add( THEPL, qtu(mrl), NULL,
PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
- free( psz_uri );
-
RecentsMRL::getInstance( p_intf )->addRecent( mrl );
}