Commit c45edd56 authored by Erwan Tulou's avatar Erwan Tulou

skins2: add support for subtitle drag'n'drop

This patch copies the Qt interface implementation wrt file dropping, namely:
- first try it as a subtitle file if it is relevant
- second, try it as an item to be added to the playlist if not a subtitle
parent 2633178f
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "../utils/ustring.hpp" #include "../utils/ustring.hpp"
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_input.h>
#include <vlc_url.h>
#include <list> #include <list>
...@@ -277,12 +279,27 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop ) ...@@ -277,12 +279,27 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop )
} }
else else
{ {
input_thread_t *pInput = getIntf()->p_sys->p_input;
bool is_subtitle = false;
list<string> files = rEvtDragDrop.getFiles(); list<string> files = rEvtDragDrop.getFiles();
list<string>::const_iterator it = files.begin(); if( files.size() == 1 && pInput != NULL )
for( bool first = true; it != files.end(); ++it, first = false )
{ {
bool playOnDrop = m_playOnDrop && first; list<string>::const_iterator it = files.begin();
CmdAddItem( getIntf(), it->c_str(), playOnDrop ).execute(); char* psz_file = make_path( it->c_str() );
if( psz_file )
{
is_subtitle = !input_AddSubtitle( pInput, psz_file, true );
free( psz_file );
}
}
if( !is_subtitle )
{
list<string>::const_iterator it = files.begin();
for( bool first = true; it != files.end(); ++it, first = false )
{
bool playOnDrop = m_playOnDrop && first;
CmdAddItem( getIntf(), it->c_str(), playOnDrop ).execute();
}
} }
} }
m_pDragControl = NULL; m_pDragControl = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment