Newer
Older
/****************************************************************************
*
* (c) 2009-2016 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 QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Palette 1.0
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
property real _minSummaryW: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelWidth * 28 : ScreenTools.defaultFontPixelWidth * 36
property real _summaryBoxWidth: _minSummaryW
property real _summaryBoxSpace: ScreenTools.defaultFontPixelWidth * 2
function computeSummaryBoxSize() {
var sw = 0
var rw = 0
var idx = Math.floor(_summaryRoot.width / (_minSummaryW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_summaryBoxWidth = _summaryRoot.width
_summaryBoxSpace = 0
} else {
_summaryBoxSpace = 0
if(idx > 1) {
_summaryBoxSpace = ScreenTools.defaultFontPixelWidth * 2
sw = _summaryBoxSpace * (idx - 1)
}
rw = _summaryRoot.width - sw
_summaryBoxWidth = rw / idx
}
}
function capitalizeWords(sentence) {
return sentence.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
}
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
Component.onCompleted: {
computeSummaryBoxSize()
}
onWidthChanged: {
computeSummaryBoxSize()
}
contentHeight: summaryColumn.height
contentWidth: _summaryRoot.width
Column {
id: summaryColumn
width: _summaryRoot.width
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
color: setupComplete ? qgcPal.text : qgcPal.warningText
font.family: ScreenTools.demiboldFontFamily
qsTr("Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component.") :
qsTr("WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left.")
property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.setupComplete : false
Flow {
id: _flowCtl
width: _summaryRoot.width
spacing: _summaryBoxSpace
model: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents : undefined
height: ScreenTools.defaultFontPixelHeight * 13
border.width: 1
border.color: qgcPal.text
Component.onCompleted: {
border.color = Qt.rgba(border.color.r, border.color.g, border.color.b, 0.1)
}
readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 2
id: titleBar
width: parent.width
height: titleHeight
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
width: ScreenTools.defaultFontPixelWidth * 1.75
height: width
radius: width / 2
color: modelData.setupComplete ? "#00d932" : "red"
visible: modelData.requiresSetup
}
onClicked : {
setupView.showVehicleComponentPanel(modelData)
}
}
// Summary Qml
Rectangle {
anchors.top: titleBar.bottom
width: parent.width
Loader {
anchors.fill: parent
anchors.margins: ScreenTools.defaultFontPixelWidth
source: modelData.summaryQmlSource