effectList.qml 6.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/***************************************************************************
 *   Copyright (C) 2017 by Nicolas Carion                                  *
 *   This file is part of Kdenlive. See www.kdenlive.org.                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) version 3 or any later version accepted by the       *
 *   membership of KDE e.V. (or its successor approved  by the membership  *
 *   of KDE e.V.), which shall act as a proxy defined in Section 14 of     *
 *   version 3 of the license.                                             *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/

import QtQuick 2.4
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
Nicolas Carion's avatar
Nicolas Carion committed
26
import QtQuick.Layouts 1.3
Nicolas Carion's avatar
Nicolas Carion committed
27
import QtQml.Models 2.2
28 29 30

Rectangle {
    id: listRoot
31 32
    SystemPalette { id: activePalette }
    color: activePalette.window
Nicolas Carion's avatar
Nicolas Carion committed
33
    ColumnLayout {
34
        anchors.fill: parent
35
        spacing: 2
Nicolas Carion's avatar
Nicolas Carion committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49
        RowLayout {
            Layout.fillWidth: true
            Layout.fillHeight: false
            spacing: 6
            ExclusiveGroup { id: filterGroup}
            ToolButton {
                id: showAll
                implicitWidth: 40
                implicitHeight: 40
                iconName: "show-all-effects"
                onClicked: console.log("show dshow-all-effects")
                checkable:true
                exclusiveGroup: filterGroup
                tooltip: i18n('Show all effects')
50
            }
Nicolas Carion's avatar
Nicolas Carion committed
51 52 53 54 55 56 57 58 59 60
            ToolButton {
                id: showVideo
                implicitWidth: 40
                implicitHeight: 40
                iconName: "kdenlive-show-video"
                iconSource: 'qrc:///pics/kdenlive-show-video.svgz'
                onClicked: console.log("show dshow video")
                checkable:true
                exclusiveGroup: filterGroup
                tooltip: i18n('Show all video effects')
61
            }
Nicolas Carion's avatar
Nicolas Carion committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
            ToolButton {
                id: showAudio
                implicitWidth: 40
                implicitHeight: 40
                iconName: "kdenlive-show-audio"
                iconSource: 'qrc:///pics/kdenlive-show-audio.svgz'
                onClicked: console.log("show dshow audio")
                checkable:true
                exclusiveGroup: filterGroup
                tooltip: i18n('Show all audio effects')
            }
            Rectangle {
                //This is a spacer
                Layout.fillHeight: true
                Layout.fillWidth: true
77
                color: "transparent"
Nicolas Carion's avatar
Nicolas Carion committed
78 79 80 81 82 83 84 85 86 87 88 89
            }
            ToolButton {
                id: showDescription
                implicitWidth: 40
                implicitHeight: 40
                iconName: "help-about"
                onClicked: console.log("show description")
                checkable:true
                tooltip: i18n('Show/hide description of the effects')
            }

        }
90 91 92
        TextField {
            id: searchInput
            Layout.fillWidth:true
Nicolas Carion's avatar
Nicolas Carion committed
93 94
            Image {
                id: clear
95
                source: 'image://icon/edit-clear'
Nicolas Carion's avatar
Nicolas Carion committed
96 97 98 99
                anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
                opacity: 0
                MouseArea {
                    anchors.fill: parent
100
                    onClicked: { searchInput.text = ''; searchInput.focus = true;  }
Nicolas Carion's avatar
Nicolas Carion committed
101 102 103
                }
            }
            states: State {
104
                name: "hasText"; when: searchInput.text != ''
Nicolas Carion's avatar
Nicolas Carion committed
105 106 107 108 109 110
                PropertyChanges { target: clear; opacity: 1 }
            }

            transitions: [
                Transition {
                    from: ""; to: "hasText"
111
                    NumberAnimation { properties: "opacity" }
Nicolas Carion's avatar
Nicolas Carion committed
112 113 114 115 116 117
                },
                Transition {
                    from: "hasText"; to: ""
                    NumberAnimation { properties: "opacity" }
                }
            ]
Nicolas Carion's avatar
Nicolas Carion committed
118 119 120 121 122 123 124
            onTextChanged: {
                effectlist.setFilterName(text)
            }
        }
        ItemSelectionModel {
            id: sel
            model: effectListModel
125
        }
Nicolas Carion's avatar
Nicolas Carion committed
126

Nicolas Carion's avatar
Nicolas Carion committed
127
        TreeView {
128
            id: treeView
Nicolas Carion's avatar
Nicolas Carion committed
129 130 131 132
            Layout.fillHeight: true
            Layout.fillWidth: true
            alternatingRowColors: false
            headerVisible: false
133
            backgroundVisible:false
Nicolas Carion's avatar
Nicolas Carion committed
134 135 136 137 138
            itemDelegate: RowLayout {
                Image{
                    visible: styleData.value != "root"
                    source: 'image://effecticon/' + styleData.value
                }
139
                Label{
Nicolas Carion's avatar
Nicolas Carion committed
140 141 142
                    text: effectlist.getName(styleData.index)
                }
            }
143

Nicolas Carion's avatar
Nicolas Carion committed
144 145
            TableViewColumn { role: "id"; title: "Name"; width: 200 }
            model: effectListModel
Nicolas Carion's avatar
Nicolas Carion committed
146
            selection: sel
147 148 149 150 151 152 153 154 155 156 157 158 159 160
            onClicked:{
                effectDescription.text = effectlist.getDescription(index)
            }
        }
        TextArea {
            id: effectDescription
            text: ""
            visible: false
            Layout.fillWidth: true
            states: State {
                name: "hasDescription"; when: effectDescription.text != ''
                PropertyChanges { target: effectDescription; visible: true }
            }

161 162
        }
    }
Nicolas Carion's avatar
Nicolas Carion committed
163

164
}