Newer
Older
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
readonly property real _defaultTextHeight: ScreenTools.defaultFontPixelHeight
readonly property real _defaultTextWidth: ScreenTools.defaultFontPixelWidth
readonly property real _horizontalMargin: _defaultTextWidth / 2
readonly property real _verticalMargin: _defaultTextHeight / 2
readonly property real _buttonWidth: _defaultTextWidth * 18
GeoTagController {
id: geoController
}
LogDownloadController {
id: logController
QGCFlickable {
id: buttonScroll
width: buttonColumn.width
anchors.topMargin: _defaultTextHeight / 2
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: _horizontalMargin
anchors.left: parent.left
contentHeight: buttonColumn.height
flickableDirection: Flickable.VerticalFlick
clip: true
Column {
id: buttonColumn
width: _maxButtonWidth
spacing: _defaultTextHeight / 2
property real _maxButtonWidth: 0
Component.onCompleted: reflowWidths()
// I don't know why this does not work
Connections {
target: QGroundControl.settingsManager.appSettings.appFontPointSize
onValueChanged: buttonColumn.reflowWidths()
}
function reflowWidths() {
buttonColumn._maxButtonWidth = 0
for (var i = 0; i < children.length; i++) {
buttonColumn._maxButtonWidth = Math.max(buttonColumn._maxButtonWidth, children[i].width)
}
for (var j = 0; j < children.length; j++) {
children[j].width = buttonColumn._maxButtonWidth
}
}
id: buttonRepeater
model: QGroundControl.corePlugin ? QGroundControl.corePlugin.analyzePages : []
Component.onCompleted: itemAt(0).checked = true
id: subMenu
imageResource: modelData.icon
setupIndicator: false
exclusiveGroup: setupButtonGroup
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
text: modelData.title
property var window: analyzeWidgetWindow
property var loader: analyzeWidgetLoader
onClicked: {
_curIndex = index
panelLoader.source = modelData.url
checked = true
}
Window {
id: analyzeWidgetWindow
width: ScreenTools.defaultFontPixelWidth * 100
height: ScreenTools.defaultFontPixelHeight * 40
visible: false
title: modelData.title
Rectangle {
color: qgcPal.window
anchors.fill: parent
Loader {
id: analyzeWidgetLoader
anchors.fill: parent
}
}
onClosing: {
analyzeWidgetWindow.visible = false
analyzeWidgetLoader.source = ""
_curIndex = index
panelLoader.source = modelData.url
subMenu.visible = true
subMenu.checked = true
}
}
}
}
}
Rectangle {
id: divider
anchors.topMargin: _verticalMargin
anchors.bottomMargin: _verticalMargin
anchors.leftMargin: _horizontalMargin
anchors.left: buttonScroll.right
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 1
color: qgcPal.windowShade
}
Connections {
target: panelLoader.item
onPopout: {
buttonRepeater.itemAt(_curIndex).window.visible = true
var source = panelLoader.source
panelLoader.source = ""
buttonRepeater.itemAt(_curIndex).loader.source = source
buttonRepeater.itemAt(_curIndex).visible = false
buttonRepeater.itemAt(_curIndex).loader.item.popped = true
_root.popout()
}
}
Loader {
id: panelLoader
anchors.topMargin: _verticalMargin
anchors.bottomMargin: _verticalMargin
anchors.leftMargin: _horizontalMargin
anchors.rightMargin: _horizontalMargin
anchors.left: divider.right
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom