SelectionBarMenu.qml 4.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils"
import ".."
import "../utils/Help.js" as H
import "../utils/Player.js" as Player
import "../view_models"

11
import org.kde.kirigami 2.7 as Kirigami
12 13
import org.kde.mauikit 1.0 as Maui

camilo higuita's avatar
camilo higuita committed
14
Menu
15 16
{
    id: control
17
    width: Maui.Style.unit * 200
18 19 20

    property int rate : 0
    property string starColor : "#FFC107"
21
    property string starReg : Kirigami.Theme.textColor
22 23 24 25 26
    property string starIcon: "draw-star"

    signal rateClicked(int rate)


camilo higuita's avatar
camilo higuita committed
27
    MenuItem
28 29 30 31 32 33
    {
        text: qsTr("Play...")
        onTriggered:
        {
            mainPlaylist.list.clear()

34
            var tracks = _selectionBar.selectedItems
35 36 37 38 39 40 41
            for(var i in tracks)
                Player.appendTrack(tracks[i])

            Player.playAll()
        }
    }

camilo higuita's avatar
camilo higuita committed
42
    MenuItem
43 44
    {
        text: qsTr("Append...")
45
        onTriggered: Player.appendAll(_selectionBar.selectedItems)
46 47
    }

camilo higuita's avatar
camilo higuita committed
48
    MenuItem
49 50 51 52
    {
        text: qsTr("Queue")
        onTriggered:
        {
53
            Player.queueTracks(_selectionBar.selectedItems)
54 55 56 57
            close()
        }
    }

58
//    MenuSeparator {}
59 60


61 62 63 64 65 66 67
//    MenuItem
//    {
//        text: qsTr("Fav/UnFav them")
//        onTriggered:
//        {
//            for(var i= 0; i < _selectionBar.count; i++)
//                _selectionBarModelList.fav(i, !(_selectionBarModelList.get(i).fav == "1"))
68

69 70
//        }
//    }
71 72


camilo higuita's avatar
camilo higuita committed
73
    MenuItem
74 75 76 77 78 79 80 81 82 83 84 85
    {
        text: qsTr("Add to...")
        onTriggered:
        {
            playlistDialog.tracks = _selectionBar.selectedPaths
            playlistDialog.open()
            close()
        }
    }

    MenuSeparator {}

camilo higuita's avatar
camilo higuita committed
86
    MenuItem
87 88 89 90 91 92 93 94 95 96 97 98
    {
        text: qsTr("Share...")
        onTriggered:
        {
            isAndroid ? Maui.Android.shareDialog(_selectionBar.selectedPaths) :
                        shareDialog.show(_selectionBar.selectedPaths)
            close()
        }
    }

    MenuSeparator {}

camilo higuita's avatar
camilo higuita committed
99
    MenuItem
100 101
    {
        text: qsTr("Remove")
camilo higuita's avatar
camilo higuita committed
102
        Kirigami.Theme.textColor: Kirigami.Theme.negativeTextColor
103 104 105 106 107 108
        onTriggered:
        {
            close()
        }
    }

109 110 111 112 113 114
//    MenuSeparator {}

//    MenuItem
//    {
//        id: starsRow
//        width: parent.width
115
//        height: Maui.Style.iconSizes.medium + Maui.Style.space.small
116 117 118 119 120 121 122 123 124 125

//        RowLayout
//        {
//            anchors.fill: parent

//            ToolButton
//            {
//                Layout.fillWidth: true
//                Layout.fillHeight: true
//                icon.name: starIcon
126
//                icon.width: Maui.Style.iconSizes.medium
127 128 129 130 131 132 133 134 135 136 137
//                icon.color: rate >= 1 ? starColor :starReg
//                onClicked:
//                {
//                    rate = 1
//                }
//            }

//            ToolButton
//            {
//                Layout.fillWidth: true
//                Layout.fillHeight: true
138
//                icon.width: Maui.Style.iconSizes.medium
139 140 141 142 143 144 145 146 147 148 149 150
//                icon.name: starIcon
//                icon.color: rate >= 2 ? starColor :starReg
//                onClicked:
//                {
//                    rate = 2
//                }
//            }

//            ToolButton
//            {
//                Layout.fillWidth: true
//                Layout.fillHeight: true
151
//                icon.width: Maui.Style.iconSizes.medium
152 153 154 155 156 157 158 159 160 161 162 163
//                icon.name: starIcon
//                icon.color: rate >= 3 ? starColor :starReg
//                onClicked:
//                {
//                    rate = 3
//                }
//            }

//            ToolButton
//            {
//                Layout.fillWidth: true
//                Layout.fillHeight: true
164
//                icon.width: Maui.Style.iconSizes.medium
165 166 167 168 169 170 171 172 173 174 175 176
//                icon.name: starIcon
//                icon.color: rate >= 4 ? starColor :starReg
//                onClicked:
//                {
//                    rate = 4
//                }
//            }

//            ToolButton
//            {
//                Layout.fillWidth: true
//                Layout.fillHeight: true
177
//                icon.width: Maui.Style.iconSizes.medium
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
//                icon.name: starIcon
//                icon.color: rate >= 5 ? starColor :starReg
//                onClicked:
//                {
//                    rate = 5
//                }
//            }
//        }
//    }

//    onRateChanged:
//    {
//        close()
//        for(var i= 0; i < _selectionBar.count; i++)
//            _selectionBarModelList.rate(i, control.rate)


//    }

//    MenuItem
//    {
//        id: colorsRow
//        width: parent.width
201
//        height:  Maui.Style.iconSizes.medium + Maui.Style.space.small
202 203 204 205 206 207 208 209 210 211 212 213

//        ColorTagsBar
//        {
//            anchors.fill: parent
//            onColorClicked:
//            {
//                for(var i= 0; i < _selectionBar.count; i++)
//                    _selectionBarModelList.color(i, color)
//                control.close()
//            }
//        }
//    }
214
}