Fix scrolling of aircraft details view
This commit is contained in:
parent
865e72f204
commit
9dc1c1bbcf
2 changed files with 179 additions and 148 deletions
|
@ -4,9 +4,8 @@ import "."
|
|||
|
||||
Rectangle {
|
||||
id: root
|
||||
property alias aircraftURI: aircraft.uri
|
||||
|
||||
color: "white"
|
||||
property alias aircraftURI: aircraft.uri
|
||||
|
||||
MouseArea {
|
||||
// consume all mouse-clicks on the detail view
|
||||
|
@ -18,166 +17,194 @@ Rectangle {
|
|||
id: aircraft
|
||||
}
|
||||
|
||||
Column {
|
||||
width: root.width - (Style.margin * 2)
|
||||
spacing: Style.margin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
Flickable
|
||||
{
|
||||
id: flickable
|
||||
|
||||
AircraftVariantChoice {
|
||||
id: headingBox
|
||||
fontPixelSize: 30
|
||||
popupFontPixelSize: 18
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
contentHeight: content.childrenRect.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
anchors {
|
||||
margins: Style.strutSize * 2 // space for back button
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
aircraft: aircraftURI
|
||||
currentIndex: aircraft.variant
|
||||
|
||||
onSelected: {
|
||||
aircraft.variant = index
|
||||
_launcher.selectedAircraft = aircraft.uri;
|
||||
}
|
||||
}
|
||||
|
||||
// this element normally hides itself unless needed
|
||||
AircraftWarningPanel {
|
||||
id: warningBox
|
||||
aircraftStatus: aircraft.status
|
||||
requiredFGVersion: aircraft.minimumFGVersion
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
// thumbnails + description + authors container
|
||||
Item {
|
||||
width: parent.width
|
||||
id: content
|
||||
width: root.width - scrollbar.width
|
||||
height: childrenRect.height
|
||||
|
||||
Rectangle {
|
||||
id: thumbnailBox
|
||||
// thumbnail border
|
||||
|
||||
border.width: 1
|
||||
border.color: "#7f7f7f"
|
||||
|
||||
width: thumbnail.width
|
||||
height: thumbnail.height
|
||||
|
||||
ThumbnailImage {
|
||||
id: thumbnail
|
||||
|
||||
aircraftUri: root.aircraftURI
|
||||
maximumSize.width: 172
|
||||
maximumSize.height: 128
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.left: thumbnailBox.right
|
||||
anchors.leftMargin: Style.margin
|
||||
anchors.right: parent.right
|
||||
width: content.width - (Style.margin * 2)
|
||||
spacing: Style.margin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Text {
|
||||
id: aircraftDescription
|
||||
text: aircraft.description
|
||||
AircraftVariantChoice {
|
||||
id: headingBox
|
||||
fontPixelSize: 30
|
||||
popupFontPixelSize: 18
|
||||
|
||||
anchors {
|
||||
margins: Style.strutSize * 2 // space for back button
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
aircraft: aircraftURI
|
||||
currentIndex: aircraft.variant
|
||||
|
||||
onSelected: {
|
||||
aircraft.variant = index
|
||||
_launcher.selectedAircraft = aircraft.uri;
|
||||
}
|
||||
}
|
||||
|
||||
// this element normally hides itself unless needed
|
||||
AircraftWarningPanel {
|
||||
id: warningBox
|
||||
aircraftStatus: aircraft.status
|
||||
requiredFGVersion: aircraft.minimumFGVersion
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
visible: aircraft.description != ""
|
||||
font.pixelSize: 14
|
||||
}
|
||||
|
||||
// thumbnails + description + authors container
|
||||
Item {
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
Rectangle {
|
||||
id: thumbnailBox
|
||||
// thumbnail border
|
||||
|
||||
border.width: 1
|
||||
border.color: "#7f7f7f"
|
||||
|
||||
width: thumbnail.width
|
||||
height: thumbnail.height
|
||||
|
||||
ThumbnailImage {
|
||||
id: thumbnail
|
||||
|
||||
aircraftUri: root.aircraftURI
|
||||
maximumSize.width: 172
|
||||
maximumSize.height: 128
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.left: thumbnailBox.right
|
||||
anchors.leftMargin: Style.margin
|
||||
anchors.right: parent.right
|
||||
spacing: Style.margin
|
||||
|
||||
Text {
|
||||
id: aircraftDescription
|
||||
text: aircraft.description
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
visible: aircraft.description != ""
|
||||
font.pixelSize: 14
|
||||
}
|
||||
|
||||
Text {
|
||||
id: aircraftAuthors
|
||||
text: qsTr("by %1").arg(aircraft.authors)
|
||||
width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
wrapMode: Text.WordWrap
|
||||
visible: (aircraft.authors != undefined)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AircraftDownloadPanel {
|
||||
visible: aircraft.isPackaged
|
||||
width: parent.width
|
||||
uri: aircraft.uri
|
||||
installStatus: aircraft.installStatus
|
||||
packageSize: aircraft.packageSize
|
||||
downloadedBytes: aircraft.downloadedBytes
|
||||
}
|
||||
|
||||
AircraftPreviewPanel {
|
||||
id: previews
|
||||
width: parent.width
|
||||
previews: aircraft.previews
|
||||
visible: aircraft.previews.length > 0
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: ratingGrid
|
||||
anchors.left: parent.left
|
||||
|
||||
visible: aircraft.ratings != undefined
|
||||
|
||||
rows: 2
|
||||
columns: 3
|
||||
rowSpacing: Style.margin
|
||||
columnSpacing: Style.margin
|
||||
|
||||
Text {
|
||||
id: ratingsLabel
|
||||
text: qsTr("Ratings:")
|
||||
}
|
||||
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Flight model")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[0]
|
||||
}
|
||||
}
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Systems")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[1]
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: ratingsLabel.width
|
||||
height: 1
|
||||
} // placeholder
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Cockpit")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[2]
|
||||
}
|
||||
}
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Exterior")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: aircraftAuthors
|
||||
text: qsTr("by %1").arg(aircraft.authors)
|
||||
text: qsTr("Local file location: %1").arg(aircraft.pathOnDisk);
|
||||
width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
wrapMode: Text.WordWrap
|
||||
visible: (aircraft.authors != undefined)
|
||||
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
visible: aircraft.pathOnDisk != undefined
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // main layout column
|
||||
} // of main item
|
||||
|
||||
AircraftDownloadPanel {
|
||||
visible: aircraft.isPackaged
|
||||
width: parent.width
|
||||
uri: aircraft.uri
|
||||
installStatus: aircraft.installStatus
|
||||
packageSize: aircraft.packageSize
|
||||
downloadedBytes: aircraft.downloadedBytes
|
||||
}
|
||||
} // of Flickable
|
||||
|
||||
AircraftPreviewPanel {
|
||||
id: previews
|
||||
width: parent.width
|
||||
previews: aircraft.previews
|
||||
visible: aircraft.previews.length > 0
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: ratingGrid
|
||||
anchors.left: parent.left
|
||||
|
||||
visible: aircraft.ratings != undefined
|
||||
|
||||
rows: 2
|
||||
columns: 3
|
||||
rowSpacing: Style.margin
|
||||
columnSpacing: Style.margin
|
||||
|
||||
Text {
|
||||
id: ratingsLabel
|
||||
text: qsTr("Ratings:")
|
||||
}
|
||||
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Flight model")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[0]
|
||||
}
|
||||
}
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Systems")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[1]
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: ratingsLabel.width
|
||||
height: 1
|
||||
} // placeholder
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Cockpit")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[2]
|
||||
}
|
||||
}
|
||||
|
||||
AircraftRating {
|
||||
title: qsTr("Exterior")
|
||||
Binding on value {
|
||||
when: aircraft.ratings != undefined
|
||||
value: aircraft.ratings[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Local file location: %1").arg(aircraft.pathOnDisk);
|
||||
visible: aircraft.pathOnDisk != undefined
|
||||
}
|
||||
|
||||
} // main layout column
|
||||
}
|
||||
Scrollbar {
|
||||
id: scrollbar
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: parent.height
|
||||
flickable: flickable
|
||||
visible: flickable.visibleArea.heightRatio < 1.0
|
||||
}
|
||||
} // of Rect
|
||||
|
|
|
@ -121,6 +121,10 @@ Item
|
|||
|
||||
clip: true
|
||||
|
||||
// prevent mouse wheel interactions when the details view is
|
||||
// visible, since it has its own flickable
|
||||
enabled: !detailsView.visible
|
||||
|
||||
highlight: highlight
|
||||
highlightMoveDuration: 100
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue