2018-03-19 22:32:23 +00:00
|
|
|
import QtQuick 2.4
|
2017-10-13 15:48:24 +00:00
|
|
|
import FlightGear.Launcher 1.0
|
2020-04-01 09:47:29 +00:00
|
|
|
import FlightGear 1.0
|
|
|
|
|
2018-01-12 19:11:00 +00:00
|
|
|
import "."
|
2017-10-13 15:48:24 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
signal select(var uri);
|
|
|
|
signal showDetails(var uri)
|
|
|
|
|
2017-12-05 20:53:47 +00:00
|
|
|
implicitHeight: Math.max(contentBox.childrenRect.height, thumbnailBox.height) +
|
|
|
|
footer.height
|
2017-10-13 15:48:24 +00:00
|
|
|
implicitWidth: ListView.view.width
|
|
|
|
|
2018-04-09 18:41:44 +00:00
|
|
|
readonly property bool __isSelected: (_launcher.selectedAircraft === model.uri)
|
2017-10-13 15:48:24 +00:00
|
|
|
|
2018-01-30 18:40:21 +00:00
|
|
|
property bool __showAlternateText: false
|
|
|
|
|
|
|
|
function cycleTextDisplay()
|
|
|
|
{
|
|
|
|
__showAlternateText = !__showAlternateText;
|
|
|
|
}
|
|
|
|
|
|
|
|
function alternateText()
|
|
|
|
{
|
|
|
|
return qsTr("URI: %1\nLocal path: %2").arg(model.uri).arg(titleBox.pathOnDisk);
|
|
|
|
}
|
|
|
|
|
2017-10-13 15:48:24 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2018-01-30 18:40:21 +00:00
|
|
|
|
2017-10-13 15:48:24 +00:00
|
|
|
onClicked: {
|
2018-01-30 18:40:21 +00:00
|
|
|
if (mouse.modifiers & Qt.ShiftModifier ) {
|
|
|
|
root.cycleTextDisplay();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-13 15:48:24 +00:00
|
|
|
if (__isSelected) {
|
|
|
|
root.showDetails(model.uri)
|
|
|
|
} else {
|
|
|
|
root.select(model.uri)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-27 14:23:14 +00:00
|
|
|
Item {
|
2017-10-13 15:48:24 +00:00
|
|
|
id: thumbnailBox
|
2018-09-27 14:23:14 +00:00
|
|
|
width: 172
|
|
|
|
height: 128
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
border.width: 1
|
|
|
|
border.color: "#7f7f7f"
|
|
|
|
width: thumbnail.width
|
|
|
|
height: thumbnail.height
|
|
|
|
|
|
|
|
ThumbnailImage {
|
|
|
|
id: thumbnail
|
|
|
|
aircraftUri: model.uri
|
|
|
|
maximumSize.width: 172
|
|
|
|
maximumSize.height: 128
|
|
|
|
}
|
2017-10-13 15:48:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: contentBox
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
left: thumbnailBox.right
|
|
|
|
right: parent.right
|
2017-12-12 11:55:28 +00:00
|
|
|
leftMargin: Style.margin
|
|
|
|
rightMargin: Style.margin
|
2017-10-13 15:48:24 +00:00
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
|
2017-12-05 20:53:47 +00:00
|
|
|
spacing: Style.margin
|
2017-10-13 15:48:24 +00:00
|
|
|
|
2020-04-01 09:47:29 +00:00
|
|
|
Item {
|
|
|
|
height: titleBox.height
|
2017-10-13 15:48:24 +00:00
|
|
|
width: parent.width
|
|
|
|
|
2020-04-01 09:47:29 +00:00
|
|
|
FavouriteToggleButton {
|
|
|
|
id: favourite
|
|
|
|
checked: model.favourite
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onToggle: {
|
|
|
|
model.favourite = on;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AircraftVariantChoice {
|
|
|
|
id: titleBox
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
left: favourite.right
|
|
|
|
leftMargin: Style.margin
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
aircraft: model.uri;
|
|
|
|
currentIndex: model.activeVariant
|
|
|
|
onSelected: {
|
|
|
|
model.activeVariant = index
|
|
|
|
root.select(model.uri)
|
|
|
|
}
|
2017-10-13 15:48:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 09:47:29 +00:00
|
|
|
|
|
|
|
|
2018-06-21 21:54:21 +00:00
|
|
|
StyledText {
|
2017-10-13 15:48:24 +00:00
|
|
|
id: description
|
|
|
|
width: parent.width
|
2018-01-30 18:40:21 +00:00
|
|
|
text: root.__showAlternateText ? root.alternateText()
|
|
|
|
: model.description
|
2017-10-13 15:48:24 +00:00
|
|
|
maximumLineCount: 3
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
height: implicitHeight
|
2018-04-09 18:41:44 +00:00
|
|
|
visible: (model.description !== "") || root.__showAlternateText
|
2017-10-13 15:48:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AircraftDownloadPanel
|
|
|
|
{
|
|
|
|
id: downloadPanel
|
2018-04-09 18:41:44 +00:00
|
|
|
visible: (model.package !== undefined)
|
2017-10-13 15:48:24 +00:00
|
|
|
packageSize: model.packageSizeBytes
|
|
|
|
installStatus: model.packageStatus
|
|
|
|
downloadedBytes: model.downloadedBytes
|
|
|
|
uri: model.uri
|
|
|
|
width: parent.width
|
|
|
|
compact: true
|
|
|
|
}
|
|
|
|
|
|
|
|
} // of content column
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: footer
|
2017-12-05 20:53:47 +00:00
|
|
|
height: Style.margin
|
2017-10-13 15:48:24 +00:00
|
|
|
width: parent.width
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
|
|
|
Rectangle {
|
2017-12-05 20:53:47 +00:00
|
|
|
color: Style.frameColor
|
2017-10-13 15:48:24 +00:00
|
|
|
height: 1
|
2017-12-05 20:53:47 +00:00
|
|
|
width: parent.width - Style.strutSize
|
2017-10-13 15:48:24 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // of root item
|