Move Dive class from qthelper.h/cpp to it's own file

and rename it to DiveObjectHelper, since it should be an QObject
based class to make it easier on the QML, grantlee and widgets
side to display the dive's internal data.

each Q_PROPERTY defined in the DiveObjectHelper.h file
can be acessed directly via it's name.

So, if you are on a model that  returns a dive, acess it's name
by dive.name

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-01-07 16:01:24 -02:00 committed by Dirk Hohndel
parent c022f5c4f7
commit 25aa80846b
10 changed files with 403 additions and 564 deletions

View file

@ -14,7 +14,6 @@ MobileComponents.Page {
Component {
id: diveDelegate
MobileComponents.ListItem {
id: dive
enabled: true
checked: diveListView.currentIndex == model.index
width: parent.width
@ -27,22 +26,22 @@ MobileComponents.Page {
onClicked: {
diveListView.currentIndex = model.index
detailsWindow.width = parent.width
detailsWindow.location = location
detailsWindow.gps = gps
detailsWindow.dive_id = id
detailsWindow.diveNumber = diveNumber
detailsWindow.duration = duration
detailsWindow.depth = depth
detailsWindow.rating = rating
detailsWindow.buddy = buddy
detailsWindow.suit = suit
detailsWindow.airtemp = airtemp
detailsWindow.watertemp = watertemp
detailsWindow.divemaster = divemaster
detailsWindow.notes = notes
detailsWindow.number = diveNumber
detailsWindow.date = date
detailsWindow.weight = weight
detailsWindow.location = dive.location
detailsWindow.gps = dive.gps
detailsWindow.dive_id = dive.id
detailsWindow.diveNumber = dive.number
detailsWindow.duration = dive.duration
detailsWindow.depth = dive.depth
detailsWindow.rating = dive.rating
detailsWindow.buddy = dive.buddy
detailsWindow.suit = dive.suit
detailsWindow.airtemp = dive.airTemp
detailsWindow.watertemp = dive.waterTemp
detailsWindow.divemaster = dive.divemaster
detailsWindow.notes = dive.notes
detailsWindow.number = dive.number
detailsWindow.date = dive.date
// detailsWindow.weight = dive.weights
stackView.push(detailsWindow)
}
@ -52,7 +51,7 @@ MobileComponents.Page {
MobileComponents.Label {
id: locationText
text: location
text: dive.location
font.weight: Font.Light
elide: Text.ElideRight
maximumLineCount: 1 // needed for elide to work at all
@ -65,7 +64,7 @@ MobileComponents.Page {
}
MobileComponents.Label {
id: dateLabel
text: date
text: dive.date
opacity: 0.6
font.pointSize: subsurfaceTheme.smallPointSize
anchors {
@ -87,7 +86,7 @@ MobileComponents.Page {
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
text: depth
text: dive.depth
width: Math.max(MobileComponents.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
font.pointSize: subsurfaceTheme.smallPointSize
}
@ -97,13 +96,13 @@ MobileComponents.Page {
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
text: duration
text: dive.duration
font.pointSize: subsurfaceTheme.smallPointSize
}
}
MobileComponents.Label {
id: numberText
text: "#" + diveNumber
text: "#" + dive.location
color: MobileComponents.Theme.textColor
font.pointSize: subsurfaceTheme.smallPointSize
opacity: 0.6