| 1 |
/* |
| 2 |
* Copyright (C) 2014 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.9 |
| 18 |
import Lomiri.Components |
| 19 |
import Lomiri.Components.ListItems as ListItem |
| 20 |
|
| 21 |
Column { |
| 22 |
id: bar |
| 23 |
property list<Action> toolActions |
| 24 |
property list<Action> filterActions |
| 25 |
property bool enabled |
| 26 |
|
| 27 |
height: (filtersBar.visible) ? units.gu(20) : units.gu(6) |
| 28 |
|
| 29 |
Item { |
| 30 |
anchors.left: parent.left |
| 31 |
anchors.right: parent.right |
| 32 |
height: units.gu(6) |
| 33 |
|
| 34 |
Rectangle { |
| 35 |
anchors.fill: parent |
| 36 |
color: "black" |
| 37 |
opacity: 0.6 |
| 38 |
} |
| 39 |
|
| 40 |
ListView { |
| 41 |
id: toolsBar |
| 42 |
anchors.fill: parent |
| 43 |
orientation: ListView.Horizontal |
| 44 |
model: toolActions |
| 45 |
|
| 46 |
delegate: AbstractButton { |
| 47 |
width: units.gu(8) |
| 48 |
anchors.top: parent.top |
| 49 |
anchors.bottom: parent.bottom |
| 50 |
action: modelData |
| 51 |
enabled: bar.enabled |
| 52 |
|
| 53 |
Icon { |
| 54 |
anchors.centerIn: parent |
| 55 |
name: modelData.iconName |
| 56 |
source: modelData.iconSource |
| 57 |
width: units.gu(3) |
| 58 |
height: units.gu(3) |
| 59 |
opacity: modelData.enabled && parent.enabled ? 1.0 : 0.5 |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
Rectangle { |
| 66 |
anchors.left: parent.left |
| 67 |
anchors.right: parent.right |
| 68 |
height: units.gu(14) |
| 69 |
color: "black" |
| 70 |
|
| 71 |
ListView { |
| 72 |
id: filtersBar |
| 73 |
objectName: "filtersBar" |
| 74 |
visible: filterActions.length > 0 |
| 75 |
|
| 76 |
orientation: ListView.Horizontal |
| 77 |
model: filterActions |
| 78 |
|
| 79 |
delegate: ListItem.Standard { |
| 80 |
width: parent.height |
| 81 |
anchors.top: parent.top |
| 82 |
anchors.bottom: parent.bottom |
| 83 |
action: modelData |
| 84 |
iconFrame: false |
| 85 |
enabled: bar.enabled |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
} |