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 {
|
2015-06-10 18:39:43 +00:00
|
|
|
id: page
|
2015-06-09 19:20:44 +00:00
|
|
|
width: parent.width; height: parent.height
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: diveDelegate
|
2015-06-10 18:39:43 +00:00
|
|
|
|
2015-06-09 19:20:44 +00:00
|
|
|
Item {
|
2015-06-10 18:39:43 +00:00
|
|
|
id: dive
|
|
|
|
|
|
|
|
property real detailsOpacity : 0
|
|
|
|
|
|
|
|
width: diveListView.width
|
|
|
|
height: 70
|
|
|
|
|
|
|
|
//Bounded rect for the background
|
|
|
|
Rectangle {
|
|
|
|
id: background
|
|
|
|
x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2;
|
|
|
|
color: "ivory"
|
|
|
|
border.color: "orange"
|
|
|
|
radius: 5
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
|
|
|
|
2015-06-10 18:39:43 +00:00
|
|
|
//Mouse region: When clicked, the mode changes to details view
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: dive.state = 'Details'
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
2015-06-10 18:39:43 +00:00
|
|
|
|
|
|
|
//Layout of the page: (mini profile, dive no, date at the tio
|
|
|
|
//And other details at the bottom.
|
|
|
|
Row {
|
|
|
|
id: topLayout
|
2015-06-11 06:39:32 +00:00
|
|
|
x: 10; y: 10; height: 60; width: parent.width
|
2015-06-10 18:39:43 +00:00
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
Column {
|
2015-06-11 06:39:32 +00:00
|
|
|
width: background.width; height: 60
|
2015-06-10 18:39:43 +00:00
|
|
|
spacing: 5
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: diveNumber + ' (' + date + ')'
|
|
|
|
}
|
2015-06-11 06:39:32 +00:00
|
|
|
Text { text: location; width: details.width }
|
|
|
|
Text { text: '<b>Depth:</b> ' + depth + ' <b>Duration:</b>' + duration; width: details.width }
|
2015-06-10 18:39:43 +00:00
|
|
|
}
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
|
|
|
|
2015-06-10 18:39:43 +00:00
|
|
|
Item {
|
|
|
|
id: details
|
|
|
|
x: 10; width: parent.width - 20
|
|
|
|
anchors { top: topLayout.bottom; topMargin: 10; bottom:parent.bottom; bottomMargin: 10 }
|
|
|
|
opacity: dive.detailsOpacity
|
2015-06-09 19:20:44 +00:00
|
|
|
|
2015-06-10 18:39:43 +00:00
|
|
|
Text {
|
|
|
|
id: detailsTitle
|
|
|
|
anchors.top: parent.top
|
|
|
|
text: "Dive Details"
|
|
|
|
font.pointSize: 12; font.bold: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
id: flick
|
|
|
|
width: parent.width
|
|
|
|
anchors { top: detailsTitle.bottom; bottom: parent.bottom }
|
|
|
|
contentHeight: detailsView.height
|
|
|
|
clip: true
|
2015-06-11 06:39:32 +00:00
|
|
|
Row {
|
2015-06-18 06:13:30 +00:00
|
|
|
Text { text:
|
|
|
|
'<b>Location: </b>' + location +
|
|
|
|
'<br><b>Air temp: </b>' + airtemp + ' <b> Water temp: </b>' + watertemp +
|
|
|
|
'<br><b>Suit: </b>' + suit +
|
|
|
|
'<br><b>Buddy: </b>' + buddy +
|
|
|
|
'<br><b>Dive Master: </b>' + divemaster +
|
|
|
|
'<br/><b>Notes:</b><br/>' + notes; wrapMode: Text.WordWrap; width: details.width }
|
2015-06-10 18:39:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TextButton {
|
|
|
|
y: 10
|
|
|
|
anchors { right: background.right; rightMargin: 10 }
|
|
|
|
opacity: dive.detailsOpacity
|
|
|
|
text: "Close"
|
|
|
|
|
|
|
|
onClicked: dive.state = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
states: State {
|
|
|
|
name: "Details"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: background
|
|
|
|
color: "white"
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: dive
|
|
|
|
detailsOpacity: 1; x:0 //Make details visible
|
|
|
|
height: diveListView.height //Fill entire list area with the details
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move the list so that this item is at the top
|
|
|
|
PropertyChanges {
|
|
|
|
target: dive.ListView.view
|
|
|
|
explicit: true
|
|
|
|
contentY: dive.y
|
|
|
|
}
|
|
|
|
|
|
|
|
//Disable flicking while we are in detailed view
|
|
|
|
PropertyChanges {
|
|
|
|
target: dive.ListView.view
|
|
|
|
interactive: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
transitions: Transition {
|
|
|
|
//make the state changes smooth
|
|
|
|
ParallelAnimation {
|
|
|
|
ColorAnimation {
|
|
|
|
property: "color"
|
|
|
|
duration: 500
|
|
|
|
}
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 300
|
|
|
|
properties: "detailsOpacity,x,contentY,height,width"
|
|
|
|
}
|
|
|
|
}
|
2015-06-10 15:49:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-11 06:39:32 +00:00
|
|
|
Component {
|
|
|
|
id: tripHeading
|
|
|
|
Rectangle {
|
|
|
|
width: page.width
|
|
|
|
height: childrenRect.height
|
|
|
|
color: "lightsteelblue"
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: section
|
|
|
|
font.bold: true
|
|
|
|
font.pointSize: 16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-09 19:20:44 +00:00
|
|
|
ListView {
|
|
|
|
id: diveListView
|
|
|
|
anchors.fill: parent
|
|
|
|
model: diveModel
|
|
|
|
delegate: diveDelegate
|
|
|
|
focus: true
|
2015-06-11 06:39:32 +00:00
|
|
|
|
|
|
|
section.property: "trip"
|
|
|
|
section.criteria: ViewSection.FullString
|
|
|
|
section.delegate: tripHeading
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-27 10:34:55 +00:00
|
|
|
}
|