| 1 |
import QtQuick 2.4 |
| 2 |
import QtQuick.Controls 2.2 |
| 3 |
import FlightGear.Launcher 1.0 |
| 4 |
import FlightGear 1.0 |
| 5 |
|
| 6 |
Rectangle { |
| 7 |
id: root |
| 8 |
color: Style.backgroundColor |
| 9 |
|
| 10 |
property alias aircraftURI: aircraft.uri |
| 11 |
|
| 12 |
MouseArea { |
| 13 |
// consume all mouse-clicks on the detail view |
| 14 |
anchors.fill: parent |
| 15 |
} |
| 16 |
|
| 17 |
AircraftInfo |
| 18 |
{ |
| 19 |
id: aircraft |
| 20 |
} |
| 21 |
|
| 22 |
Flickable |
| 23 |
{ |
| 24 |
id: flickable |
| 25 |
|
| 26 |
anchors.fill: parent |
| 27 |
contentWidth: parent.width |
| 28 |
contentHeight: content.height |
| 29 |
boundsBehavior: Flickable.StopAtBounds |
| 30 |
ScrollBar.vertical: ScrollBar {} |
| 31 |
|
| 32 |
Item { |
| 33 |
id: content |
| 34 |
|
| 35 |
width: root.width |
| 36 |
height: childrenRect.height |
| 37 |
|
| 38 |
GettingStartedScope.controller: tipsLayer.controller |
| 39 |
|
| 40 |
Column { |
| 41 |
id: contentColumn |
| 42 |
width: content.width - (Style.margin * 2) |
| 43 |
spacing: Style.margin |
| 44 |
anchors.horizontalCenter: parent.horizontalCenter |
| 45 |
|
| 46 |
Item { // top padding |
| 47 |
width: parent.width |
| 48 |
height: Style.margin |
| 49 |
} |
| 50 |
|
| 51 |
AircraftVariantChoice { |
| 52 |
id: headingBox |
| 53 |
fontPixelSize: Style.headingFontPixelSize * 2 |
| 54 |
popupFontPixelSize: Style.headingFontPixelSize |
| 55 |
|
| 56 |
anchors { |
| 57 |
margins: Style.strutSize * 2 // space for back button |
| 58 |
left: parent.left |
| 59 |
right: parent.right |
| 60 |
} |
| 61 |
|
| 62 |
aircraft: aircraftURI |
| 63 |
currentIndex: aircraft.variant |
| 64 |
|
| 65 |
onSelected: { |
| 66 |
aircraft.variant = index |
| 67 |
_launcher.selectedAircraft = aircraft.uri; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
// this element normally hides itself unless needed |
| 72 |
AircraftWarningPanel { |
| 73 |
id: warningBox |
| 74 |
aircraftStatus: aircraft.status |
| 75 |
requiredFGVersion: aircraft.minimumFGVersion |
| 76 |
width: parent.width |
| 77 |
} |
| 78 |
|
| 79 |
// thumbnails + description + authors container |
| 80 |
Item { |
| 81 |
width: parent.width |
| 82 |
height: childrenRect.height |
| 83 |
|
| 84 |
Rectangle { |
| 85 |
id: thumbnailBox |
| 86 |
// thumbnail border |
| 87 |
|
| 88 |
border.width: 1 |
| 89 |
border.color: Style.minorFrameColor |
| 90 |
|
| 91 |
width: thumbnail.width |
| 92 |
height: thumbnail.height |
| 93 |
|
| 94 |
ThumbnailImage { |
| 95 |
id: thumbnail |
| 96 |
|
| 97 |
aircraftUri: root.aircraftURI |
| 98 |
maximumSize.width: 172 |
| 99 |
maximumSize.height: 128 |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
Column { |
| 104 |
anchors.left: thumbnailBox.right |
| 105 |
anchors.leftMargin: Style.margin |
| 106 |
anchors.right: parent.right |
| 107 |
spacing: Style.margin |
| 108 |
|
| 109 |
StyledText { |
| 110 |
id: aircraftDescription |
| 111 |
text: aircraft.description |
| 112 |
width: parent.width |
| 113 |
wrapMode: Text.WordWrap |
| 114 |
visible: aircraft.description != "" |
| 115 |
} |
| 116 |
|
| 117 |
StyledText { |
| 118 |
id: aircraftAuthors |
| 119 |
text: qsTr("by %1").arg(aircraft.authors) |
| 120 |
width: parent.width |
| 121 |
anchors.horizontalCenter: parent.horizontalCenter |
| 122 |
wrapMode: Text.WordWrap |
| 123 |
visible: (aircraft.authors != undefined) |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
} |
| 128 |
|
| 129 |
// web-links row |
| 130 |
Row { |
| 131 |
width: parent.width |
| 132 |
height: childrenRect.height |
| 133 |
spacing: Style.margin |
| 134 |
|
| 135 |
Weblink { |
| 136 |
visible: aircraft.homePage != "" |
| 137 |
label: qsTr("Website") |
| 138 |
link: aircraft.homePage |
| 139 |
} |
| 140 |
|
| 141 |
Weblink { |
| 142 |
visible: aircraft.supportUrl != "" |
| 143 |
label: qsTr("Support and issue reporting") |
| 144 |
link: aircraft.supportUrl |
| 145 |
} |
| 146 |
|
| 147 |
Weblink { |
| 148 |
visible: aircraft.wikipediaUrl != "" |
| 149 |
label: qsTr("Wikipedia") |
| 150 |
link: aircraft.wikipediaUrl |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
AircraftDownloadPanel { |
| 155 |
visible: aircraft.isPackaged |
| 156 |
width: parent.width |
| 157 |
uri: aircraft.uri |
| 158 |
installStatus: aircraft.installStatus |
| 159 |
packageSize: aircraft.packageSize |
| 160 |
downloadedBytes: aircraft.downloadedBytes |
| 161 |
} |
| 162 |
|
| 163 |
AircraftPreviewPanel { |
| 164 |
id: previews |
| 165 |
width: parent.width |
| 166 |
previews: aircraft.previews |
| 167 |
visible: aircraft.previews.length > 0 |
| 168 |
packageId: aircraft.packageId |
| 169 |
} |
| 170 |
|
| 171 |
Row { |
| 172 |
height: ratingGrid.height |
| 173 |
width: parent.width |
| 174 |
spacing: Style.strutSize |
| 175 |
|
| 176 |
FavouriteToggleButton { |
| 177 |
checked: aircraft.favourite |
| 178 |
onToggle: { |
| 179 |
aircraft.favourite = on; |
| 180 |
} |
| 181 |
|
| 182 |
GettingStartedTip { |
| 183 |
anchors { |
| 184 |
verticalCenter: parent.verticalCenter |
| 185 |
left: parent.right |
| 186 |
} |
| 187 |
arrow: GettingStartedTip.LeftCenter |
| 188 |
text: qsTr("Click here to mark this as a favourite aircraft") |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
Grid { |
| 193 |
id: ratingGrid |
| 194 |
|
| 195 |
visible: (aircraft.ratings !== undefined) && (aircraft.ratings.length > 0) |
| 196 |
|
| 197 |
rows: 2 |
| 198 |
columns: 3 |
| 199 |
rowSpacing: Style.margin |
| 200 |
columnSpacing: Style.margin * 3 |
| 201 |
horizontalItemAlignment: Grid.AlignRight |
| 202 |
|
| 203 |
StyledText { |
| 204 |
id: ratingsLabel |
| 205 |
text: qsTr("Ratings:") |
| 206 |
} |
| 207 |
|
| 208 |
|
| 209 |
AircraftRating { |
| 210 |
title: qsTr("Flight model") |
| 211 |
Binding on value { |
| 212 |
when: aircraft.ratings !== undefined |
| 213 |
value: aircraft.ratings[0] |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
AircraftRating { |
| 218 |
title: qsTr("Systems") |
| 219 |
Binding on value { |
| 220 |
when: aircraft.ratings !== undefined |
| 221 |
value: aircraft.ratings[1] |
| 222 |
} |
| 223 |
} |
| 224 |
|
| 225 |
Item { |
| 226 |
width: ratingsLabel.width |
| 227 |
height: 1 |
| 228 |
} // placeholder |
| 229 |
|
| 230 |
AircraftRating { |
| 231 |
title: qsTr("Cockpit") |
| 232 |
Binding on value { |
| 233 |
when: aircraft.ratings !== undefined |
| 234 |
value: aircraft.ratings[2] |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
AircraftRating { |
| 239 |
title: qsTr("Exterior") |
| 240 |
Binding on value { |
| 241 |
when: aircraft.ratings !== undefined |
| 242 |
value: aircraft.ratings[3] |
| 243 |
} |
| 244 |
} |
| 245 |
} // of rating grid |
| 246 |
} |
| 247 |
|
| 248 |
StyledText { |
| 249 |
text: qsTr("Local file location: %1").arg(aircraft.pathOnDisk); |
| 250 |
width: parent.width |
| 251 |
wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
| 252 |
visible: aircraft.pathOnDisk != undefined |
| 253 |
} |
| 254 |
|
| 255 |
} // main layout column |
| 256 |
|
| 257 |
GettingStartedTipLayer { |
| 258 |
id: tipsLayer |
| 259 |
anchors.fill: parent |
| 260 |
scopeId: "aircraft-details" |
| 261 |
} |
| 262 |
} // of main item |
| 263 |
} // of Flickable |
| 264 |
} // of Rect |