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,9 +6,9 @@ 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.ApplicationWindow {
Kirigami.ApplicationWindow {
id: rootItem
title: qsTr("Subsurface-mobile")
property bool fullscreen: true
@ -37,20 +37,20 @@ MobileComponents.ApplicationWindow {
detailsWindow.endEditMode()
}
globalDrawer: MobileComponents.GlobalDrawer {
globalDrawer: Kirigami.GlobalDrawer {
title: "Subsurface"
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
bannerImageSource: "dive.jpg"
actions: [
Action {
Kirigami.Action {
text: "Dive list"
onTriggered: {
returnTopPage()
globalDrawer.close()
}
},
Action {
Kirigami.Action {
text: "Cloud credentials"
onTriggered: {
returnTopPage()
@ -64,7 +64,7 @@ MobileComponents.ApplicationWindow {
manager.credentialStatus = QMLManager.UNKNOWN
}
},
MobileComponents.ActionGroup {
Kirigami.Action {
text: "Manage dives"
enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL
/*
@ -77,7 +77,7 @@ MobileComponents.ApplicationWindow {
}
}
*/
Action {
Kirigami.Action {
text: "Add dive manually"
onTriggered: {
detailsWindow.state = "add"
@ -100,7 +100,7 @@ MobileComponents.ApplicationWindow {
stackView.push(detailsWindow)
}
}
Action {
Kirigami.Action {
text: "Refresh"
onTriggered: {
detailsWindow.endEditMode()
@ -116,31 +116,31 @@ MobileComponents.ApplicationWindow {
}
},
MobileComponents.ActionGroup {
Kirigami.Action {
text: "GPS"
enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL
Action {
Kirigami.Action {
text: "GPS-tag dives"
onTriggered: {
manager.applyGpsData();
}
}
Action {
Kirigami.Action {
text: "Upload GPS data"
onTriggered: {
manager.sendGpsData();
}
}
Action {
Kirigami.Action {
text: "Download GPS data"
onTriggered: {
manager.downloadGpsData();
}
}
Action {
Kirigami.Action {
text: "Show GPS fixes"
onTriggered: {
manager.populateGpsData();
@ -148,13 +148,13 @@ MobileComponents.ApplicationWindow {
}
}
Action {
Kirigami.Action {
text: "Clear GPS cache"
onTriggered: {
manager.clearGpsData();
}
}
Action {
Kirigami.Action {
text: "Preferences"
onTriggered: {
stackView.push(prefsWindow)
@ -163,22 +163,22 @@ MobileComponents.ApplicationWindow {
}
},
MobileComponents.ActionGroup {
Kirigami.Action {
text: "Developer"
Action {
Kirigami.Action {
text: "App log"
onTriggered: {
stackView.push(logWindow)
}
}
Action {
Kirigami.Action {
text: "Theme information"
onTriggered: {
stackView.push(themetest)
}
}
Action {
Kirigami.Action {
checkable: true
checked: manager.verboseEnabled
text: checked ? "Disable verbose (for adb logcat)" : "Enable verbose (for adb logcat)"
@ -187,7 +187,7 @@ MobileComponents.ApplicationWindow {
}
}
},
Action {
Kirigami.Action {
text: "About"
onTriggered: {
stackView.push(aboutWindow)
@ -198,7 +198,7 @@ MobileComponents.ApplicationWindow {
MouseArea {
height: childrenRect.height
width: MobileComponents.Units.gridUnit * 10
width: Kirigami.Units.gridUnit * 10
CheckBox {
//text: "Run location service"
id: locationCheckbox
@ -211,8 +211,8 @@ MobileComponents.ApplicationWindow {
manager.locationServiceEnabled = checked;
}
}
MobileComponents.Label {
x: MobileComponents.Units.gridUnit * 1.5
Kirigami.Label {
x: Kirigami.Units.gridUnit * 1.5
anchors {
left: locationCheckbox.right
//leftMargin: units.smallSpacing
@ -227,7 +227,7 @@ MobileComponents.ApplicationWindow {
}
}
contextDrawer: MobileComponents.ContextDrawer {
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
actions: rootItem.pageStack.currentPage ? rootItem.pageStack.currentPage.contextualActions : null
title: "Actions"
@ -240,16 +240,11 @@ MobileComponents.ApplicationWindow {
property color accentColor: "#2d5b9a"
property color shadedColor: "#132744"
property color accentTextColor: "#ececec"
property int columnWidth: Math.round(rootItem.width/(MobileComponents.Units.gridUnit*30)) > 0 ? Math.round(rootItem.width / Math.round(rootItem.width/(MobileComponents.Units.gridUnit*30))) : rootItem.width
}
toolBar: TopBar {
width: parent.width
height: Layout.minimumHeight
property int columnWidth: Math.round(rootItem.width/(Kirigami.Units.gridUnit*30)) > 0 ? Math.round(rootItem.width / Math.round(rootItem.width/(Kirigami.Units.gridUnit*30))) : rootItem.width
}
property Item stackView: pageStack
initialPage: DiveList {
pageStack.initialPage: DiveList {
anchors.fill: detailsPage
id: diveList
opacity: 0
@ -295,6 +290,7 @@ MobileComponents.ApplicationWindow {
GpsList {
id: gpsWindow
visible: false
}
ThemeTest {
@ -303,6 +299,7 @@ MobileComponents.ApplicationWindow {
}
Component.onCompleted: {
Kirigami.Theme.highlightColor = subsurfaceTheme.accentColor
manager.finishSetup();
rootItem.visible = true
diveList.opacity = 1