Debian Codegraph @

src/app/qml/components/HeaderRow.qml

raw
1 /*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This file is part of Lomiri Weather App
5 *
6 * Lomiri Weather App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * Lomiri Weather App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 import QtQuick 2.12
20 import QtQuick.Layouts 1.1 as QL
21 import Lomiri.Components 1.3 as UC
22 import QtQuick.Controls 2.2 as QC
23
24 QL.RowLayout {
25 id: headerRow
26
27 property alias locationName: locationNameLabel.text
28
29 width: parent.width
30
31 UC.Label {
32 objectName: 'headerLabel'
33 id: locationNameLabel
34 color: theme.palette.normal.baseText
35 elide: Text.ElideRight
36 font.weight: Font.Normal
37 fontSize: "large"
38 height: settingsButton.height
39 QL.Layout.fillWidth: true
40 verticalAlignment: Text.AlignVCenter
41 }
42
43 QC.AbstractButton {
44 id: networkErrorButton
45 height: width
46 width: units.gu(4)
47 QL.Layout.alignment: Qt.AlignRight
48 visible: networkError
49
50 onClicked: {mainPageStack.push(Qt.resolvedUrl("../components/NetworkErrorStateComponent.qml"));}
51
52 Rectangle {
53 anchors.fill: parent
54 color: Theme.palette.selected.background
55 visible: parent.pressed
56 }
57
58 UC.Icon {
59 anchors.centerIn: parent
60 color: theme.palette.normal.baseText
61 height: width
62 name: "sync-error"
63 width: units.gu(2.5)
64 }
65 }
66
67 QC.AbstractButton {
68 id: onlineMapButton
69 height: width
70 width: units.gu(4)
71 QL.Layout.alignment: Qt.AlignRight
72 visible: !networkError
73
74 onClicked: {mainPageStack.push(Qt.resolvedUrl("../components/OnlineMap.qml"));}
75
76 Rectangle {
77 anchors.fill: parent
78 color: Theme.palette.selected.background
79 visible: parent.pressed
80 }
81
82 UC.Icon {
83 anchors.centerIn: parent
84 color: theme.palette.normal.baseText
85 height: width
86 source: "qrc:/rain-radar.svg"
87 width: units.gu(2.5)
88 }
89 }
90
91 SettingsButton {
92 id: settingsButton
93 QL.Layout.alignment: Qt.AlignRight
94 }
95 }