ClipContextMenu.qml 2.29 KB
Newer Older
luyikei's avatar
luyikei committed
1 2
import QtQuick 2.0
import QtQuick.Controls 1.4
luyikei's avatar
luyikei committed
3
import QtQuick.Dialogs 1.2
luyikei's avatar
luyikei committed
4 5 6 7 8

Menu {
    id: clipContextMenu
    title: "Edit"

9
    property var clip
10
    property bool grouped
11
    property bool linked
luyikei's avatar
luyikei committed
12 13

    MenuItem {
14
        text: grouped ? "Ungroup" : "Group"
luyikei's avatar
luyikei committed
15

luyikei's avatar
luyikei committed
16 17 18
        onTriggered: {
            if ( selectedClips.length <= 1 )
                return;
luyikei's avatar
luyikei committed
19

20
            if ( grouped === true ) {
21
                removeGroup( clip.uuid );
luyikei's avatar
luyikei committed
22 23 24 25 26 27 28 29
            }
            else {
                var l = [];
                for ( var i = 0; i < selectedClips.length; ++i ) {
                    l.push( "" + selectedClips[i].uuid );
                }
                addGroup( l );
            }
luyikei's avatar
luyikei committed
30 31
        }
    }
32

33
    MenuItem {
34
        text: linked ? "Unlink" : "Link"
35 36

        onTriggered: {
37
            if ( linked === true ) {
38
                for ( var i = 0; i < selectedClips.length; ++i ) {
39 40 41 42 43 44 45 46 47 48 49
                    for ( var j = i + 1; j < selectedClips.length; ++j ) {
                        if ( selectedClips[i].linkedClips.indexOf( selectedClips[j].uuid ) !== -1 )
                            workflow.unlinkClips( selectedClips[i].uuid, selectedClips[j].uuid );
                    }
                }
            }
            else {
                for ( i = 0; i < selectedClips.length; ++i ) {
                    for ( j = i + 1; j < selectedClips.length; ++j ) {
                        if ( selectedClips[i].linkedClips.indexOf( selectedClips[j].uuid ) === -1 )
                            workflow.linkClips( selectedClips[i].uuid, selectedClips[j].uuid );
50 51 52
                    }
                }
            }
53 54 55
        }
    }

luyikei's avatar
luyikei committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    MenuSeparator { }

    MenuItem {
        text: "Delete"

        onTriggered: {
            removeClipDialog.visible = true;
        }
    }

    MessageDialog {
        id: removeClipDialog
        title: "VLMC"
        text: qsTr( "Do you really want to remove the clip?" )
        icon: StandardIcon.Question
        standardButtons: StandardButton.Yes | StandardButton.No
        onYes: {
            workflow.removeClip( clip.uuid );
        }
    }

77
    onAboutToShow: {
78
        linked = clip.linked();
79
        grouped = findGroup( clip.uuid );
80
    }
81 82 83 84 85 86 87

    MenuSeparator { }

    MenuItem {
        text: "Effects"

        onTriggered: {
88
            workflow.showEffectStack( clip.uuid );
89 90
        }
    }
luyikei's avatar
luyikei committed
91
}