| 1 |
import QtQuick 2.4 |
| 2 |
import QtQml 2.4 |
| 3 |
import FlightGear.Launcher 1.0 |
| 4 |
import FlightGear 1.0 |
| 5 |
|
| 6 |
Rectangle { |
| 7 |
id: root |
| 8 |
color: Style.themeColor |
| 9 |
|
| 10 |
property alias pagesModel: buttonRepeater.model |
| 11 |
property int selectedPage: 0 |
| 12 |
property alias showMenuIcon: menuIcon.visible |
| 13 |
|
| 14 |
readonly property int minimumHeight: mainColumn.childrenRect.height + flyButton.height |
| 15 |
|
| 16 |
implicitWidth: flyButton.width |
| 17 |
|
| 18 |
signal selectPage(var pageSource); |
| 19 |
|
| 20 |
signal showMenu(); |
| 21 |
|
| 22 |
function setSelectedPage(index) |
| 23 |
{ |
| 24 |
selectedPage = index |
| 25 |
} |
| 26 |
|
| 27 |
GettingStartedScope.controller: tips.controller |
| 28 |
|
| 29 |
Column { |
| 30 |
id: mainColumn |
| 31 |
width: parent.width |
| 32 |
anchors.top: parent.top |
| 33 |
anchors.bottom: flyButton.top |
| 34 |
//spacing: Style.margin |
| 35 |
|
| 36 |
Rectangle { |
| 37 |
id: menuIcon |
| 38 |
width: parent.width |
| 39 |
height:menuIconImage.sourceSize.height |
| 40 |
color: menuMouseArea.containsMouse ? Style.activeColor : "transparent" |
| 41 |
|
| 42 |
Image { |
| 43 |
id: menuIconImage |
| 44 |
anchors.centerIn: parent |
| 45 |
source: "image://colored-icon/ellipsis?themeContrast" |
| 46 |
} |
| 47 |
|
| 48 |
MouseArea { |
| 49 |
id: menuMouseArea |
| 50 |
anchors.fill: parent |
| 51 |
hoverEnabled: true |
| 52 |
onClicked: root.showMenu() |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
GettingStartedTip { |
| 57 |
id: menuTip |
| 58 |
tipId: "sidebarMenuTip" |
| 59 |
arrow: GettingStartedTip.TopLeft |
| 60 |
|
| 61 |
anchors { |
| 62 |
horizontalCenter: parent.horizontalCenter |
| 63 |
horizontalCenterOffset: Style.margin |
| 64 |
top: parent.bottom |
| 65 |
} |
| 66 |
text: qsTr("Access additional options here") |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
Repeater { |
| 71 |
id: buttonRepeater |
| 72 |
|
| 73 |
delegate: SidebarButton { |
| 74 |
icon: model.iconPath |
| 75 |
label: model.title |
| 76 |
onClicked: { |
| 77 |
root.selectedPage = model.index |
| 78 |
root.selectPage(model.pageSource); |
| 79 |
} |
| 80 |
|
| 81 |
enabled: !model.buttonDisabled |
| 82 |
disabledText: (model.disabledText !== undefined) ? model.disabledText : "" |
| 83 |
selected: (model.index === root.selectedPage) |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
SidebarButton { |
| 89 |
id: flyButton |
| 90 |
label: _launcher.flyButtonLabel |
| 91 |
anchors.bottom: parent.bottom |
| 92 |
enabled: _launcher.canFly |
| 93 |
disabledText: qsTr("The selected aircraft is not installed or has updates pending") |
| 94 |
icon: _launcher.flyIconUrl |
| 95 |
onClicked: _launcher.fly(); |
| 96 |
} |
| 97 |
|
| 98 |
GettingStartedTipLayer { |
| 99 |
id: tips |
| 100 |
anchors.fill: parent |
| 101 |
scopeId: "sidebar" |
| 102 |
} |
| 103 |
} |