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

@ -7,23 +7,23 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import org.subsurfacedivelog.mobile 1.0
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.kde.kirigami 1.0 as Kirigami
Item {
id: detailsView
property real gridWidth: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
property real gridWidth: subsurfaceTheme.columnWidth - 2 * Kirigami.Units.gridUnit
property real col1Width: gridWidth * 0.23
property real col2Width: gridWidth * 0.37
property real col3Width: gridWidth * 0.20
property real col4Width: gridWidth * 0.20
width: SubsurfaceTheme.columnWidth
height: mainLayout.implicitHeight + bottomLayout.implicitHeight + MobileComponents.Units.iconSizes.large
height: mainLayout.implicitHeight + bottomLayout.implicitHeight + Kirigami.Units.iconSizes.large
Rectangle {
z: 99
color: MobileComponents.Theme.textColor
color: Kirigami.Theme.textColor
opacity: 0.3
width: MobileComponents.Units.smallSpacing/4
width: Kirigami.Units.smallSpacing/4
anchors {
right: parent.right
top: parent.top
@ -36,13 +36,13 @@ Item {
top: parent.top
left: parent.left
right: parent.right
margins: Math.round(MobileComponents.Units.gridUnit / 2)
margins: Math.round(Kirigami.Units.gridUnit / 2)
}
columns: 4
rowSpacing: MobileComponents.Units.smallSpacing * 2
columnSpacing: MobileComponents.Units.smallSpacing
rowSpacing: Kirigami.Units.smallSpacing * 2
columnSpacing: Kirigami.Units.smallSpacing
MobileComponents.Heading {
Kirigami.Heading {
id: detailsViewHeading
Layout.fillWidth: true
text: dive.location
@ -57,41 +57,41 @@ Item {
}
}
}
MobileComponents.Label {
Kirigami.Label {
id: dateLabel
text: "Date: "
opacity: 0.6
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
text: dive.date + " " + dive.time
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
Layout.columnSpan: 2
}
MobileComponents.Label {
Kirigami.Label {
id: numberText
text: "#" + dive.number
color: MobileComponents.Theme.textColor
color: Kirigami.Theme.textColor
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
}
MobileComponents.Label {
Kirigami.Label {
id: depthLabel
text: "Depth: "
opacity: 0.6
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
text: dive.depth
Layout.fillWidth: true
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
}
MobileComponents.Label {
Kirigami.Label {
text: "Duration: "
opacity: 0.6
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
text: dive.duration
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
}
@ -104,21 +104,21 @@ Item {
Layout.minimumHeight: width * 0.75
Layout.columnSpan: 4
clip: false
devicePixelRatio: MobileComponents.Units.devicePixelRatio
devicePixelRatio: Kirigami.Units.devicePixelRatio
Rectangle {
color: "transparent"
opacity: 0.6
border.width: 1
border.color: MobileComponents.Theme.textColor;
border.color: Kirigami.Theme.textColor;
anchors.fill: parent
}
}
MobileComponents.Label {
Kirigami.Label {
id: noProfile
visible: dive.noDive
Layout.fillWidth: true
Layout.columnSpan: 4
Layout.margins: MobileComponents.Units.gridUnit
Layout.margins: Kirigami.Units.gridUnit
horizontalAlignment: Text.AlignHCenter
text: "No profile to show"
}
@ -129,13 +129,13 @@ Item {
top: mainLayout.bottom
left: parent.left
right: parent.right
margins: Math.round(MobileComponents.Units.gridUnit / 2)
margins: Math.round(Kirigami.Units.gridUnit / 2)
}
columns: 4
rowSpacing: MobileComponents.Units.smallSpacing * 2
columnSpacing: MobileComponents.Units.smallSpacing
rowSpacing: Kirigami.Units.smallSpacing * 2
columnSpacing: Kirigami.Units.smallSpacing
MobileComponents.Heading {
Kirigami.Heading {
Layout.fillWidth: true
level: 3
text: "Dive Details"
@ -143,7 +143,7 @@ Item {
}
// first row - here we set up the column widths - total is 90% of width
MobileComponents.Label {
Kirigami.Label {
text: "Suit:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -151,7 +151,7 @@ Item {
Layout.preferredWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtSuit
text: dive.suit
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -159,7 +159,7 @@ Item {
Layout.preferredWidth: detailsView.col2Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Air Temp:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -167,7 +167,7 @@ Item {
Layout.preferredWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtAirTemp
text: dive.airTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -175,7 +175,7 @@ Item {
Layout.preferredWidth: detailsView.col4Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Cylinder:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -183,7 +183,7 @@ Item {
Layout.preferredWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtCylinder
text: dive.getCylinder
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -191,7 +191,7 @@ Item {
Layout.preferredWidth: detailsView.col2Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Water Temp:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -199,7 +199,7 @@ Item {
Layout.preferredWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtWaterTemp
text: dive.waterTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -207,7 +207,7 @@ Item {
Layout.preferredWidth: detailsView.col4Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Dive Master:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -215,7 +215,7 @@ Item {
Layout.preferredWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtDiveMaster
text: dive.divemaster
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -223,7 +223,7 @@ Item {
Layout.preferredWidth: detailsView.col2Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Weight:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -231,7 +231,7 @@ Item {
Layout.preferredWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtWeight
text: dive.sumWeight
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
@ -239,7 +239,7 @@ Item {
Layout.preferredWidth: detailsView.col4Width
}
MobileComponents.Label {
Kirigami.Label {
text: "Buddy:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
@ -247,7 +247,7 @@ Item {
Layout.preferredWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
Kirigami.Label {
id: txtBuddy
text: dive.buddy
Layout.columnSpan: 3
@ -256,7 +256,7 @@ Item {
Layout.preferredWidth: detailsView.col2Width + detailsView.col3Width + detailsView.col4Width
}
MobileComponents.Heading {
Kirigami.Heading {
Layout.fillWidth: true
level: 3
text: "Notes"
@ -264,7 +264,7 @@ Item {
Layout.columnSpan: 4
}
MobileComponents.Label {
Kirigami.Label {
id: txtNotes
text: dive.notes
focus: true
@ -277,10 +277,10 @@ Item {
Item {
Layout.columnSpan: 4
Layout.fillWidth: true
Layout.minimumHeight: MobileComponents.Units.gridUnit * 3
Layout.minimumHeight: Kirigami.Units.gridUnit * 3
}
Component.onCompleted: {
qmlProfile.setMargin(MobileComponents.Units.smallSpacing)
qmlProfile.setMargin(Kirigami.Units.smallSpacing)
qmlProfile.diveId = model.dive.id;
qmlProfile.update();
}