2015-05-27 10:34:55 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Controls 1.2
|
|
|
|
import QtQuick.Window 2.2
|
2015-06-04 08:27:38 +00:00
|
|
|
import QtQuick.Dialogs 1.2
|
2015-06-04 10:36:36 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2015-05-27 10:34:55 +00:00
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
title: qsTr("Subsurface")
|
|
|
|
width: 500;
|
|
|
|
height: 700
|
2015-06-04 08:27:38 +00:00
|
|
|
|
|
|
|
FileDialog {
|
|
|
|
id: fileOpen
|
|
|
|
selectExisting: true
|
|
|
|
selectMultiple: true
|
2015-06-04 10:36:36 +00:00
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
manager.setFilename(fileUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QMLManager {
|
|
|
|
id: manager
|
2015-06-04 08:27:38 +00:00
|
|
|
}
|
|
|
|
|
2015-05-27 10:34:55 +00:00
|
|
|
menuBar: MenuBar {
|
|
|
|
Menu {
|
|
|
|
title: qsTr("File")
|
2015-06-04 08:27:38 +00:00
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Open")
|
|
|
|
onTriggered: fileOpen.open()
|
|
|
|
}
|
|
|
|
|
2015-05-27 10:34:55 +00:00
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Exit")
|
|
|
|
onTriggered: Qt.quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 19:20:44 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
width: parent.width; height: parent.height
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: diveDelegate
|
|
|
|
Item {
|
|
|
|
id: wrapper
|
|
|
|
width: parent.width; height: 55
|
|
|
|
Column {
|
2015-06-10 15:49:55 +00:00
|
|
|
Text { text: '#:' + diveNumber + "(" + date + ")" }
|
|
|
|
Text { text: 'Duration: ' + duration }
|
|
|
|
Text { text: 'Depth: ' + depth }
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
|
|
|
MouseArea { anchors.fill: parent; onClicked: diveListView.currentIndex = index }
|
|
|
|
|
|
|
|
states: State {
|
|
|
|
name: "Current"
|
|
|
|
when: wrapper.ListView.isCurrentItem
|
|
|
|
PropertyChanges { target: wrapper; x:20 }
|
|
|
|
}
|
|
|
|
transitions: Transition {
|
|
|
|
NumberAnimation { properties: "x"; duration: 200 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: highlightBar
|
|
|
|
Rectangle {
|
|
|
|
width: parent.width; height: 50
|
2015-06-10 15:19:19 +00:00
|
|
|
color: "lightsteelblue"
|
|
|
|
radius: 5
|
2015-06-09 19:20:44 +00:00
|
|
|
y: diveListView.currentItem.y;
|
|
|
|
Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-10 15:49:55 +00:00
|
|
|
Component {
|
|
|
|
id: tripHeading
|
|
|
|
Rectangle {
|
|
|
|
width: container.width
|
|
|
|
height: childrenRect.height
|
|
|
|
color: "lightgreen"
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: section
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-09 19:20:44 +00:00
|
|
|
ListView {
|
|
|
|
id: diveListView
|
|
|
|
width: parent.width; height: parent.height
|
|
|
|
anchors.fill: parent
|
|
|
|
model: diveModel
|
|
|
|
delegate: diveDelegate
|
|
|
|
focus: true
|
|
|
|
highlight: highlightBar
|
|
|
|
highlightFollowsCurrentItem: false
|
2015-06-10 15:49:55 +00:00
|
|
|
|
|
|
|
section.property: "location"
|
|
|
|
section.criteria: ViewSection.FullString
|
|
|
|
section.delegate: tripHeading
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-27 10:34:55 +00:00
|
|
|
}
|