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 @@
#include "../utils/ustring.hpp"
#include <vlc_keys.h>
#include <vlc_input.h>
#include <vlc_url.h>
#include <list>
......@@ -277,7 +279,21 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop )
}
else
{
input_thread_t *pInput = getIntf()->p_sys->p_input;
bool is_subtitle = false;
list<string> files = rEvtDragDrop.getFiles();
if( files.size() == 1 && pInput != NULL )
{
list<string>::const_iterator it = files.begin();
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 )
{
......@@ -285,6 +301,7 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop )
CmdAddItem( getIntf(), it->c_str(), playOnDrop ).execute();
}
}
}
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