Unity 8
MediaServicesHeader.qml
1 /*
2  * Copyright (C) 2016 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 as published by
6  * the Free Software Foundation; version 3.
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.12
18 import QtQuick.Layouts 1.1
19 import Ubuntu.Components 1.3
20 
21 Item {
22  id: root
23 
24  property alias title: titleLabel.text
25  property alias component: loader.sourceComponent
26  property alias iconColor: titleLabel.color
27 
28  signal goPrevious
29 
30  RowLayout {
31  id: row
32  anchors {
33  left: parent.left
34  right: parent.right
35  verticalCenter: parent.verticalCenter
36  margins: units.gu(2)
37  }
38  spacing: units.gu(2)
39 
40  AbstractButton {
41  id: navigationButton
42  objectName: "navigationButton"
43  Layout.preferredWidth: units.gu(3)
44  Layout.preferredHeight: units.gu(3)
45  Layout.alignment: Qt.AlignVCenter
46 
47  Icon {
48  anchors.fill: parent
49  name: "go-previous"
50  color: titleLabel.color
51  }
52 
53  onTriggered: {
54  root.goPrevious();
55  }
56  }
57 
58  Label {
59  id: titleLabel
60  Layout.fillWidth: true
61  Layout.alignment: Qt.AlignVCenter
62  elide: Text.ElideRight
63  }
64 
65  Loader {
66  id: loader
67  Layout.alignment: Qt.AlignVCenter
68  Layout.preferredHeight: units.gu(3)
69  }
70  }
71 }