Commit 476aad5d authored by Ludovic Fauvet's avatar Ludovic Fauvet

Add grouping feature to GraphicsMedia items

parent 36086d8e
......@@ -23,7 +23,7 @@
#include "AbstractGraphicsMediaItem.h"
AbstractGraphicsMediaItem::AbstractGraphicsMediaItem() :
oldTrackNumber( -1 ), oldPosition( -1 ), m_tracksView( NULL )
oldTrackNumber( -1 ), oldPosition( -1 ), m_tracksView( NULL ), m_group( NULL )
{
}
......@@ -43,3 +43,24 @@ quint32 AbstractGraphicsMediaItem::trackNumber()
}
return -1;
}
void AbstractGraphicsMediaItem::group( AbstractGraphicsMediaItem* item )
{
Q_ASSERT( item );
if ( m_group )
ungroup();
item->m_group = this;
m_group = item;
}
void AbstractGraphicsMediaItem::ungroup()
{
if ( !m_group ) return;
m_group->m_group = NULL;
m_group = NULL;
}
AbstractGraphicsMediaItem* AbstractGraphicsMediaItem::groupItem()
{
return m_group;
}
......@@ -50,6 +50,12 @@ public:
/// Should return the unique uid of the contained media.
virtual const QUuid& uuid() const = 0;
/// Group two items together
void group( AbstractGraphicsMediaItem* item );
/// Ungroup two items
void ungroup();
/// Return the current track of the item
quint32 trackNumber();
......@@ -69,10 +75,19 @@ protected:
*/
qint64 oldPosition;
/**
* Pointer to the linked item
* or NULL if it isn't.
*/
AbstractGraphicsMediaItem* groupItem();
private:
/// This pointer will be set when inserted in the tracksView.
TracksView* m_tracksView;
/// Pointer used to save the address of a linked item.
AbstractGraphicsMediaItem* m_group;
};
#endif // ABSTRACTGRAPHICSMEDIAITEM_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