Skip to content
Snippets Groups Projects
Commit 02ac6014 authored by luyikei's avatar luyikei
Browse files

Add ClipLibraryView.qml

parent c7f74856
No related branches found
No related tags found
No related merge requests found
import QtQuick 2.0
import QtQuick.Controls 1.4
Rectangle {
id: clipLibraryView
anchors.fill: parent
color: "#999999"
property var clipItems: []
property int currentMediaId: -1
ListModel {
id: clips
}
ListModel {
id: subClips
}
ScrollView {
id: sView
height: parent.height
width: parent.width
ListView {
id: clipListView
width: sView.viewport.width
model: clips
focus: true
delegate: ClipItem {
uuid: model.uuid
isBaseClip: model.isBaseClip
duration: model.duration
thumbnailPath: model.thumbnailPath
mediaId: model.mediaId
onTimeline: model.onTimeline
title: model.title
width: parent.width
}
}
}
Connections {
target: view
onClipAdded: {
var clip = view.clip( uuid );
clips.append( clip );
if ( !clip.isBaseClip ) {
for ( var i = 0; i < clipItems.length; ++i ) {
if ( clipItems[i].mediaId === clip.mediaId && clipItems[i].isBaseClip ) {
clipItems[i].addSubClip( uuid );
break;
}
}
}
}
onClipOnTimelineChanged: {
for ( var i = 0; i < clipItems.length; ++i ) {
if ( clipItems[i].uuid === uuid ) {
clipItems[i].onTimeline = onTimeline;
break;
}
}
}
onClipRemoved: {
var clip = view.clip( uuid );
if ( clip.isBaseClip === false ) {
for ( var i = 0; i < clipItems.length; ++i ) {
if ( clipItems[i].mediaId === clip.mediaId && clipItems[i].isBaseClip ) {
clipItems[i].removeSubClip( uuid );
break;
}
}
}
for ( var i = 0; i < clips.count; ++i ) {
if ( clips[i].uuid === uuid ) {
clips.remove( i );
break;
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment