Commit 81a555cf authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Use internal mimetype for media drag&drop

parent 6d553d17
......@@ -64,8 +64,10 @@ void MediaListWidget::mouseMoveEvent( QMouseEvent* event )
< QApplication::startDragDistance() )
return;
ListViewMediaItem* item = static_cast<ListViewMediaItem*>( currentItem() );
QMimeData* mimeData = new QMimeData;
mimeData->setText( static_cast<ListViewMediaItem*>( currentItem() )->getClip()->getUuid() );
mimeData->setData( "vlmc/uuid", item->getClip()->getUuid().toString().toAscii() );
QDrag* drag = new QDrag( this );
drag->setMimeData( mimeData );
const QPixmap& dragPixmap = static_cast<ListViewMediaItem*>( currentItem() )->getClip()->getSnapshot();
......
......@@ -70,12 +70,13 @@ void PreviewWidget::changeEvent( QEvent *e )
void PreviewWidget::dragEnterEvent( QDragEnterEvent* event )
{
event->accept();
if ( event->mimeData()->hasFormat( "vlmc/uuid" ) )
event->acceptProposedAction();
}
void PreviewWidget::dropEvent( QDropEvent* event )
{
Clip* clip = Library::getInstance()->getClip( event->mimeData()->text() );
Clip* clip = Library::getInstance()->getClip( QUuid( (const QString& )event->mimeData()->data( "vlmc/uuid" ) ) );
clip->flushParameters();
m_mediaPlayer->setMedia( clip->getVLCMedia() );
......
......@@ -25,6 +25,7 @@
#include <QtGui/QDialog>
#include <QDragEnterEvent>
#include <QUuid>
#include "VLCMediaPlayer.h"
#include "VLCMediaList.h"
......
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