| 1 |
import QtQuick 2.4 |
| 2 |
import FlightGear.Launcher 1.0 |
| 3 |
import FlightGear 1.0 |
| 4 |
|
| 5 |
Item { |
| 6 |
id: root |
| 7 |
|
| 8 |
signal select(var uri); |
| 9 |
signal showDetails(var uri) |
| 10 |
|
| 11 |
readonly property bool __isSelected: (_launcher.selectedAircraft === model.uri) |
| 12 |
|
| 13 |
Rectangle { |
| 14 |
anchors.centerIn: parent |
| 15 |
width: parent.width - 4 |
| 16 |
height: parent.height - 4 |
| 17 |
color: "transparent" |
| 18 |
border.width: 1 |
| 19 |
border.color: Style.minorFrameColor |
| 20 |
} |
| 21 |
|
| 22 |
MouseArea { |
| 23 |
id: mouse |
| 24 |
anchors.fill: parent |
| 25 |
onClicked: { |
| 26 |
if (__isSelected) { |
| 27 |
root.showDetails(model.uri) |
| 28 |
} else { |
| 29 |
root.select(model.uri) |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
Column { |
| 35 |
id: contentBox |
| 36 |
width: parent.width |
| 37 |
y: Style.margin |
| 38 |
spacing: 2 // |
| 39 |
|
| 40 |
Item { |
| 41 |
id: thumbnailBox |
| 42 |
width: 172 |
| 43 |
height: 128 |
| 44 |
anchors.horizontalCenter: parent.horizontalCenter |
| 45 |
|
| 46 |
Rectangle { |
| 47 |
anchors.centerIn: parent |
| 48 |
border.width: 1 |
| 49 |
border.color: Style.minorFrameColor |
| 50 |
width: thumbnail.width |
| 51 |
height: thumbnail.height |
| 52 |
|
| 53 |
ThumbnailImage { |
| 54 |
id: thumbnail |
| 55 |
aircraftUri: model.uri |
| 56 |
maximumSize.width: 172 |
| 57 |
maximumSize.height: 128 |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
Button { |
| 62 |
visible: hover.containsMouse && (model.packageStatus === LocalAircraftCache.PackageNotInstalled) |
| 63 |
text: qsTr("Install") |
| 64 |
onClicked: { |
| 65 |
// drill down and also start the install |
| 66 |
_launcher.requestInstallUpdate(model.uri) |
| 67 |
root.showDetails(model.uri) |
| 68 |
} |
| 69 |
anchors { |
| 70 |
horizontalCenter: parent.horizontalCenter |
| 71 |
bottom: parent.bottom |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
AircraftVariantChoice { |
| 77 |
id: titleBox |
| 78 |
|
| 79 |
width: parent.width |
| 80 |
popupFontPixelSize: Style.baseFontPixelSize |
| 81 |
aircraft: model.uri; |
| 82 |
currentIndex: model.activeVariant |
| 83 |
onSelected: { |
| 84 |
model.activeVariant = index |
| 85 |
root.select(model.uri) |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
FavouriteToggleButton { |
| 91 |
id: favourite |
| 92 |
anchors { |
| 93 |
left: parent.left |
| 94 |
top: parent.top |
| 95 |
margins: Style.margin |
| 96 |
} |
| 97 |
|
| 98 |
visible: hover.containsMouse || model.favourite |
| 99 |
checked: model.favourite |
| 100 |
onToggle: { model.favourite = on; } |
| 101 |
} |
| 102 |
|
| 103 |
HoverArea { |
| 104 |
id: hover |
| 105 |
anchors.fill: parent |
| 106 |
} |
| 107 |
} // of root item |