port to Kirigami imports and new api

first quick and dirty port of the imports to Kirigami 1.0
(using system installed for now) adapt to api changes and
try out some of the proposed ui changes from the HIG

Signed-off-by: Marco Martin <notmart@gmail.com>
This commit is contained in:
Marco Martin 2016-03-08 21:26:54 +01:00
parent c6c3967dd9
commit c780cfd7ce
15 changed files with 403 additions and 401 deletions

View file

@ -6,13 +6,14 @@ import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import org.subsurfacedivelog.mobile 1.0
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.kde.kirigami 1.0 as Kirigami
MobileComponents.Page {
Kirigami.ScrollablePage {
id: gpsListWindow
width: parent.width - MobileComponents.Units.gridUnit
anchors.margins: MobileComponents.Units.gridUnit / 2
width: parent.width - Kirigami.Units.gridUnit
anchors.margins: Kirigami.Units.gridUnit / 2
objectName: "gpsList"
title: "GPS Fixes"
/* this can be done by hitting the back key
contextualActions: [
@ -28,15 +29,16 @@ MobileComponents.Page {
*/
Component {
id: gpsDelegate
MobileComponents.ListItemWithActions {
Kirigami.ActionsForListItem {
id: gpsFix
enabled: true
width: parent.width
property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
Item {
width: parent.width - MobileComponents.Units.gridUnit
height: childrenRect.height - MobileComponents.Units.smallSpacing
Kirigami.BasicListItem {
supportsMouseEvents: true
width: parent.width - Kirigami.Units.gridUnit
height: childrenRect.height - Kirigami.Units.smallSpacing
GridLayout {
columns: 4
id: timeAndName
@ -46,55 +48,55 @@ MobileComponents.Page {
right: parent.right
rightMargin: horizontalPadding
}
MobileComponents.Label {
Kirigami.Label {
text: 'Date: '
opacity: 0.6
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: date
Layout.preferredWidth: Math.max(parent.width / 5, paintedWidth)
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: 'Name: '
opacity: 0.6
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: name
Layout.preferredWidth: Math.max(parent.width / 5, paintedWidth)
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: 'Latitude: '
opacity: 0.6
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: latitude
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: 'Longitude: '
opacity: 0.6
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
Kirigami.Label {
text: longitude
font.pointSize: subsurfaceTheme.smallPointSize
}
}
}
actions: [
Action {
Kirigami.Action {
iconName: "trash-empty"
onTriggered: {
print("delete this!")
manager.deleteGpsFix(when)
}
},
Action {
Kirigami.Action {
iconName: "gps"
onTriggered: {
print("show map")
@ -106,25 +108,22 @@ MobileComponents.Page {
}
}
ScrollView {
ListView {
id: gpsListView
anchors.fill: parent
ListView {
id: gpsListView
anchors.fill: parent
model: gpsModel
currentIndex: -1
delegate: gpsDelegate
boundsBehavior: Flickable.StopAtBounds
maximumFlickVelocity: parent.height * 5
cacheBuffer: Math.max(5000, parent.height * 5)
focus: true
clip: true
header: MobileComponents.Heading {
x: MobileComponents.Units.gridUnit / 2
height: paintedHeight + MobileComponents.Units.gridUnit / 2
verticalAlignment: Text.AlignBottom
text: "List of stored GPS fixes"
}
model: gpsModel
currentIndex: -1
delegate: gpsDelegate
boundsBehavior: Flickable.StopAtBounds
maximumFlickVelocity: parent.height * 5
cacheBuffer: Math.max(5000, parent.height * 5)
focus: true
clip: true
header: Kirigami.Heading {
x: Kirigami.Units.gridUnit / 2
height: paintedHeight + Kirigami.Units.gridUnit / 2
verticalAlignment: Text.AlignBottom
text: "List of stored GPS fixes"
}
}
}