aboutsummaryrefslogtreecommitdiffstats
path: root/qml/Viper/OpenMpd.qml
blob: d821f0728affbe86ca840b1183c47c99e5303e61 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import QtQuick 2.5
import QtQuick.Extras 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import "utils.js" as Utils
Rectangle {
    signal closeOpenMpd
    signal saveAndPlayMpd(string newOpenMpd)

    id: root
    color: "#88445566"

    opacity: 0
    radius: Utils.scaled(10)
    height: Utils.scaled(100)
    width: Utils.scaled(300)
    enabled: false;
    GridLayout {
        id : grid
        z: parent.z + 1
        anchors.fill: parent
        rows    : 2
        columns : 2
        anchors.leftMargin: Utils.scaled(12)

        anchors.rightMargin: Utils.scaled(12)
        anchors.topMargin: Utils.scaled(12)
        anchors.bottomMargin: Utils.scaled(12)
        property double colMulti : grid.width / grid.columns
        property double rowMulti : grid.height / grid.rows

        function prefWidth(item)
        {
            return colMulti * item.Layout.columnSpan
        }

        function prefHeight(item)
        {
            return rowMulti * item.Layout.rowSpan
        }

        ComboBox {
            z: parent.z + 1
            id: comboBoxList
            Layout.rowSpan : 1
            Layout.columnSpan : 2
            Layout.preferredWidth  : parent.colMulti * 2 + Utils.scaled(5) //grid.prefWidth(this)
            Layout.preferredHeight : parent.rowMulti//grid.prefHeight(this)

            onCurrentIndexChanged: {
            }

            model: ListModel {
                id: mpdItems
                ListElement { text: "gastown"; }
                ListElement { text: "sintel"; }
            }
            currentIndex: find(lastPlayed)
        }

        Button {
            id: cancelBtn
            z: parent.z + 1

            text: "Cancel"
            Layout.rowSpan   : 1
            Layout.columnSpan: 1
            Layout.preferredWidth  : grid.prefWidth(this)
            Layout.preferredHeight : grid.prefHeight(this)
            onClicked: {

                closeOpenMpd();
            }
        }

        Button {
            id: downloadBtn
            z: parent.z + 1
            Layout.rowSpan   : 1
            Layout.columnSpan: 1
            Layout.preferredWidth  : grid.prefWidth(this)
            Layout.preferredHeight : grid.prefHeight(this)
            text: "Download"
            onClicked: {
                saveAndPlayMpd(mpdItems.get(comboBoxList.currentIndex).text)
                closeOpenMpd();
            }


        }



    }

}