[vlmc-devel] commit: TracksView: Merging m_actionResize and m_actionMove in one m_action attribute. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Sun Aug 29 17:07:06 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Aug 29 17:06:36 2010 +0200| [90c22bc895e0e8e22381233a7039fc9976c4e34e] | committer: Hugo Beauzée-Luyssen
TracksView: Merging m_actionResize and m_actionMove in one m_action attribute.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=90c22bc895e0e8e22381233a7039fc9976c4e34e
---
src/Gui/timeline/TracksView.cpp | 19 ++++++++-----------
src/Gui/timeline/TracksView.h | 10 ++++++++--
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 423b4d9..a9aad0a 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -62,8 +62,7 @@ TracksView::TracksView( QGraphicsScene *scene, MainWorkflow *mainWorkflow,
m_dragVideoItem = NULL;
m_dragAudioItem = NULL;
m_lastKnownTrack = NULL;
- m_actionMove = false;
- m_actionResize = false;
+ m_action = None;
m_actionRelativeX = -1;
m_actionItem = NULL;
m_tool = TOOL_DEFAULT;
@@ -776,7 +775,7 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
{
if ( event->modifiers() == Qt::NoModifier &&
event->buttons() == Qt::LeftButton &&
- m_actionMove == true )
+ m_action == TracksView::Move )
{
//Moving item.
m_actionItem->setOpacity( 0.6 );
@@ -786,7 +785,7 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
}
else if ( event->modifiers() == Qt::NoModifier &&
event->buttons() == Qt::LeftButton &&
- m_actionResize == true )
+ m_action == TracksView::Resize )
{
QPointF itemPos = m_actionItem->mapToScene( 0, 0 );
QPointF itemNewSize = mapToScene( event->pos() ) - itemPos;
@@ -865,14 +864,14 @@ TracksView::mousePressEvent( QMouseEvent *event )
m_actionResizeType = AbstractGraphicsMediaItem::END;
else
m_actionResizeType = AbstractGraphicsMediaItem::BEGINNING;
- m_actionResize = true;
+ m_action = TracksView::Resize;
m_actionResizeOldBegin = item->pos().x();
m_actionResizeNewBegin = m_actionResizeOldBegin;
m_actionItem = item;
}
else if ( item->moveable() )
{
- m_actionMove = true;
+ m_action = Move;
m_actionItem = item;
}
scene()->clearSelection();
@@ -915,7 +914,7 @@ TracksView::mousePressEvent( QMouseEvent *event )
void
TracksView::mouseReleaseEvent( QMouseEvent *event )
{
- if ( m_actionMove )
+ if ( m_action == TracksView::Move )
{
Q_ASSERT( m_actionItem );
m_actionItem->setOpacity( 1.0 );
@@ -959,7 +958,7 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
m_actionItem = NULL;
m_lastKnownTrack = NULL;
}
- else if ( m_actionResize )
+ else if ( m_action == TracksView::Resize )
{
ClipHelper *ch = m_actionItem->clipHelper();
qint64 newBegin;
@@ -980,9 +979,7 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
updateDuration();
}
- m_actionMove = false;
- m_actionResize = false;
-
+ m_action = TracksView::None;
//setDragMode( QGraphicsView::NoDrag );
QGraphicsView::mouseReleaseEvent( event );
}
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index c1ab22d..392fdee 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -95,6 +95,13 @@ class TracksView : public QGraphicsView
Q_OBJECT
public:
+ enum Action
+ {
+ None,
+ Move,
+ Resize,
+ };
+
TracksView( QGraphicsScene *scene, MainWorkflow *mainWorkflow, WorkflowRenderer *renderer, QWidget *parent = 0 );
/**
* \brief Set the duration of the project.
@@ -325,8 +332,7 @@ private:
WorkflowRenderer *m_renderer;
// Mouse actions on Medias
- bool m_actionMove;
- bool m_actionResize;
+ Action m_action;
qint64 m_actionResizeOldBegin;
qint64 m_actionResizeNewBegin;
qint64 m_actionResizeSize;
More information about the Vlmc-devel
mailing list