Commit 984527e5 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Workspace: Don't copy the media by default.

Adding a contextual menu to the MediaCellView so the action can be
triggered manually.
parent 9a3bda6a
......@@ -30,7 +30,9 @@
#include "Media.h"
#include "MetaDataManager.h"
#include "MainWorkflow.h"
#include "Workspace.h"
#include <QMenu>
#include <QMessageBox>
#include <QTime>
......@@ -261,3 +263,22 @@ MediaCellView::clip() const
{
return m_clip;
}
void
MediaCellView::contextMenuEvent( QContextMenuEvent *event )
{
QMenu menu( this );
//For now, as we only have the copy to workspace option, don't do anything if the clip
//is not the root clip. Obviously, this will have to be removed if other actions are to be added.
if ( m_clip->isRootClip() == false )
return ;
QAction* copyInWorkspace = menu.addAction( "Copy in workspace" );
QAction* selectedAction = menu.exec( event->globalPos() );
if ( selectedAction == NULL )
return ;
if ( copyInWorkspace == selectedAction )
Workspace::getInstance()->copyToWorkspace( m_clip->getMedia() );
}
......@@ -66,6 +66,7 @@ protected:
void mouseDoubleClickEvent( QMouseEvent* );
void mousePressEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* );
void contextMenuEvent( QContextMenuEvent * );
public slots:
void deleteButtonClicked( QWidget *sender, QMouseEvent *event );
......
......@@ -34,8 +34,8 @@ const QString Workspace::workspacePrefix = "workspace://";
Workspace::Workspace()
{
connect( Library::getInstance(), SIGNAL( newClipLoaded( Clip* ) ),
this, SLOT( clipLoaded( Clip* ) ) );
// connect( Library::getInstance(), SIGNAL( newClipLoaded( Clip* ) ),
// this, SLOT( clipLoaded( Clip* ) ) );
}
void
......
......@@ -38,11 +38,12 @@ class Workspace : public QObject, public Singleton<Workspace>
static bool isInProjectDir( const Media* media );
static QString pathInProjectDir( const Media* media );
void copyToWorkspace( Media* media );
private:
Workspace();
~Workspace(){}
void copyToWorkspace( Media* media );
public slots:
void clipLoaded( Clip* clip );
private slots:
......
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