Unverified Commit b1c90168 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7124 from DonLakeFlyer/MobileCleanup

Mobile visual cleanup
parents b86d386d 54d10575
...@@ -488,13 +488,13 @@ QGCView { ...@@ -488,13 +488,13 @@ QGCView {
exclusiveGroup: multiVehicleSelectorGroup exclusiveGroup: multiVehicleSelectorGroup
text: qsTr("Single") text: qsTr("Single")
checked: true checked: true
color: mapPal.text textColor: mapPal.text
} }
QGCRadioButton { QGCRadioButton {
exclusiveGroup: multiVehicleSelectorGroup exclusiveGroup: multiVehicleSelectorGroup
text: qsTr("Multi-Vehicle") text: qsTr("Multi-Vehicle")
color: mapPal.text textColor: mapPal.text
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"name": "Radius", "name": "Radius",
"shortDescription": "Radius for geofence circle.", "shortDescription": "Radius for geofence circle.",
"type": "double", "type": "double",
"decimalPlaces": 2, "decimalPlaces": 1,
"min": 0.1, "min": 0.1,
"units": "m" "units": "m"
} }
......
...@@ -10,13 +10,9 @@ import QGroundControl.FactControls 1.0 ...@@ -10,13 +10,9 @@ import QGroundControl.FactControls 1.0
QGCFlickable { QGCFlickable {
id: root id: root
width: availableWidth contentHeight: geoFenceEditorRect.height
height: availableHeight
contentHeight: editorColumn.height
clip: true clip: true
property real availableWidth
property real availableHeight
property var myGeoFenceController property var myGeoFenceController
property var flightMap property var flightMap
...@@ -24,317 +20,290 @@ QGCFlickable { ...@@ -24,317 +20,290 @@ QGCFlickable {
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
Column { Rectangle {
id: editorColumn id: geoFenceEditorRect
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: geoFenceItems.y + geoFenceItems.height + (_margin * 2)
radius: _radius
color: qgcPal.missionItemEditor
QGCLabel {
id: geoFenceLabel
anchors.margins: _margin
anchors.left: parent.left
anchors.top: parent.top
text: qsTr("GeoFence")
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
}
Rectangle { Rectangle {
id: geoFenceEditorRect id: geoFenceItems
width: parent.width anchors.margins: _margin
height: geoFenceItems.y + geoFenceItems.height + (_margin * 2) anchors.left: parent.left
radius: _radius anchors.right: parent.right
color: qgcPal.missionItemEditor anchors.top: geoFenceLabel.bottom
height: fenceColumn.y + fenceColumn.height + (_margin * 2)
QGCLabel { color: qgcPal.windowShadeDark
id: geoFenceLabel radius: _radius
Column {
id: fenceColumn
anchors.margins: _margin anchors.margins: _margin
anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
text: qsTr("GeoFence")
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
}
Rectangle {
id: geoFenceItems
anchors.margins: _margin
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: geoFenceLabel.bottom spacing: ScreenTools.defaultFontPixelHeight / 2
height: fenceColumn.y + fenceColumn.height + (_margin * 2)
color: qgcPal.windowShadeDark
radius: _radius
Column { QGCLabel {
id: fenceColumn
anchors.margins: _margin
anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight / 2 wrapMode: Text.WordWrap
font.pointSize: myGeoFenceController.supported ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize
QGCLabel { text: myGeoFenceController.supported ?
anchors.left: parent.left qsTr("GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.") :
anchors.right: parent.right qsTr("This vehicle does not support GeoFence.")
wrapMode: Text.WordWrap }
font.pointSize: myGeoFenceController.supported ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize
text: myGeoFenceController.supported ?
qsTr("GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.") :
qsTr("This vehicle does not support GeoFence.")
}
Column { Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight / 2
visible: myGeoFenceController.supported visible: myGeoFenceController.supported
Repeater { Repeater {
model: myGeoFenceController.params model: myGeoFenceController.params
Item { Item {
width: fenceColumn.width width: fenceColumn.width
height: textField.height height: textField.height
property bool showCombo: modelData.enumStrings.length > 0 property bool showCombo: modelData.enumStrings.length > 0
QGCLabel { QGCLabel {
id: textFieldLabel id: textFieldLabel
anchors.baseline: textField.baseline anchors.baseline: textField.baseline
text: myGeoFenceController.paramLabels[index] text: myGeoFenceController.paramLabels[index]
} }
FactTextField { FactTextField {
id: textField id: textField
anchors.right: parent.right anchors.right: parent.right
width: _editFieldWidth width: _editFieldWidth
showUnits: true showUnits: true
fact: modelData fact: modelData
visible: !parent.showCombo visible: !parent.showCombo
} }
FactComboBox { FactComboBox {
id: comboField id: comboField
anchors.right: parent.right anchors.right: parent.right
width: _editFieldWidth width: _editFieldWidth
indexModel: false indexModel: false
fact: showCombo ? modelData : _nullFact fact: showCombo ? modelData : _nullFact
visible: parent.showCombo visible: parent.showCombo
property var _nullFact: Fact { } property var _nullFact: Fact { }
}
} }
} }
}
SectionHeader { SectionHeader {
id: insertSection id: insertSection
text: qsTr("Insert GeoFence") text: qsTr("Insert GeoFence")
} }
QGCButton { QGCButton {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Polygon Fence") text: qsTr("Polygon Fence")
onClicked: { onClicked: {
var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height)
var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
myGeoFenceController.addInclusionPolygon(topLeftCoord, bottomRightCoord) myGeoFenceController.addInclusionPolygon(topLeftCoord, bottomRightCoord)
}
} }
}
QGCButton { QGCButton {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Circular Fence") text: qsTr("Circular Fence")
onClicked: { onClicked: {
var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height)
var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
myGeoFenceController.addInclusionCircle(topLeftCoord, bottomRightCoord) myGeoFenceController.addInclusionCircle(topLeftCoord, bottomRightCoord)
}
} }
}
SectionHeader { SectionHeader {
id: polygonSection id: polygonSection
text: qsTr("Polygon Fences") text: qsTr("Polygon Fences")
} }
QGCLabel {
text: qsTr("None")
visible: polygonSection.checked && myGeoFenceController.polygons.count === 0
}
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columns: 3
flow: GridLayout.TopToBottom
visible: polygonSection.checked && myGeoFenceController.polygons.count > 0
QGCLabel { QGCLabel {
text: qsTr("None") text: qsTr("Inclusion")
visible: polygonSection.checked && myGeoFenceController.polygons.count === 0 Layout.column: 0
Layout.alignment: Qt.AlignHCenter
} }
GridLayout { Repeater {
anchors.left: parent.left model: myGeoFenceController.polygons
anchors.right: parent.right
columns: 3
flow: GridLayout.TopToBottom
visible: polygonSection.checked && myGeoFenceController.polygons.count > 0
QGCLabel { QGCCheckBox {
text: qsTr("Inclusion") checked: object.inclusion
Layout.column: 0 onClicked: object.inclusion = checked
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
}
Repeater { QGCLabel {
model: myGeoFenceController.polygons text: qsTr("Edit")
Layout.column: 1
Layout.alignment: Qt.AlignHCenter
}
QGCCheckBox { Repeater {
checked: object.inclusion model: myGeoFenceController.polygons
onClicked: object.inclusion = checked
Layout.alignment: Qt.AlignHCenter
}
}
QGCLabel { QGCRadioButton {
text: qsTr("Edit") checked: _interactive
Layout.column: 1
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
}
Repeater {
model: myGeoFenceController.polygons
QGCRadioButton {
checked: _interactive
Layout.alignment: Qt.AlignHCenter
property bool _interactive: object.interactive property bool _interactive: object.interactive
on_InteractiveChanged: checked = _interactive on_InteractiveChanged: checked = _interactive
onClicked: { onClicked: {
myGeoFenceController.clearAllInteractive() myGeoFenceController.clearAllInteractive()
object.interactive = checked object.interactive = checked
}
} }
} }
}
QGCLabel { QGCLabel {
text: qsTr("Delete") text: qsTr("Delete")
Layout.column: 2 Layout.column: 2
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
Repeater { Repeater {
model: myGeoFenceController.polygons model: myGeoFenceController.polygons
QGCColoredImage { QGCButton {
width: ScreenTools.defaultFontPixelHeight text: qsTr("Del")
height: width Layout.alignment: Qt.AlignHCenter
sourceSize.height: width onClicked: myGeoFenceController.deletePolygon(index)
source: "/res/XDelete.svg" }
fillMode: Image.PreserveAspectFit }
color: qgcPal.text } // GridLayout
Layout.alignment: Qt.AlignHCenter
property int _polygonIndex: index SectionHeader {
id: circleSection
text: qsTr("Circular Fences")
}
QGCMouseArea { QGCLabel {
fillItem: parent text: qsTr("None")
onClicked: myGeoFenceController.deletePolygon(parent._polygonIndex) visible: circleSection.checked && myGeoFenceController.circles.count === 0
} }
}
}
} // GridLayout
SectionHeader { GridLayout {
id: circleSection anchors.left: parent.left
text: qsTr("Circular Fences") anchors.right: parent.right
} columns: 4
flow: GridLayout.TopToBottom
visible: polygonSection.checked && myGeoFenceController.circles.count > 0
QGCLabel { QGCLabel {
text: qsTr("None") text: qsTr("Inclusion")
visible: circleSection.checked && myGeoFenceController.circles.count === 0 Layout.column: 0
Layout.alignment: Qt.AlignHCenter
} }
GridLayout { Repeater {
anchors.left: parent.left model: myGeoFenceController.circles
anchors.right: parent.right
columns: 4
flow: GridLayout.TopToBottom
visible: polygonSection.checked && myGeoFenceController.circles.count > 0
QGCLabel { QGCCheckBox {
text: qsTr("Inclusion") checked: object.inclusion
Layout.column: 0 onClicked: object.inclusion = checked
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
}
Repeater { QGCLabel {
model: myGeoFenceController.circles text: qsTr("Edit")
Layout.column: 1
Layout.alignment: Qt.AlignHCenter
}
QGCCheckBox { Repeater {
checked: object.inclusion model: myGeoFenceController.circles
onClicked: object.inclusion = checked
Layout.alignment: Qt.AlignHCenter
}
}
QGCLabel { QGCRadioButton {
text: qsTr("Edit") checked: _interactive
Layout.column: 1
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
}
Repeater {
model: myGeoFenceController.circles
QGCRadioButton { property bool _interactive: object.interactive
checked: _interactive
Layout.alignment: Qt.AlignHCenter
property bool _interactive: object.interactive on_InteractiveChanged: checked = _interactive
on_InteractiveChanged: checked = _interactive onClicked: {
myGeoFenceController.clearAllInteractive()
onClicked: { object.interactive = checked
myGeoFenceController.clearAllInteractive()
object.interactive = checked
}
} }
} }
}
QGCLabel { QGCLabel {
text: qsTr("Radius") text: qsTr("Radius")
Layout.column: 2 Layout.column: 2
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
Repeater {
model: myGeoFenceController.circles
FactTextField { Repeater {
fact: object.radius model: myGeoFenceController.circles
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
}
}
QGCLabel { FactTextField {
text: qsTr("Delete") fact: object.radius
Layout.column: 3 Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
}
Repeater { QGCLabel {
model: myGeoFenceController.circles text: qsTr("Delete")
Layout.column: 3
QGCColoredImage { Layout.alignment: Qt.AlignHCenter
width: ScreenTools.defaultFontPixelHeight }
height: width
sourceSize.height: width
source: "/res/XDelete.svg"
fillMode: Image.PreserveAspectFit
color: qgcPal.text
Layout.alignment: Qt.AlignHCenter
property int _circleIndex: index Repeater {
model: myGeoFenceController.circles
QGCMouseArea { QGCButton {
fillItem: parent text: qsTr("Del")
onClicked: myGeoFenceController.deleteCircle(parent._polygonIndex) Layout.alignment: Qt.AlignHCenter
} onClicked: myGeoFenceController.deleteCircle(index)
}
} }
} // GridLayout }
} } // GridLayout
} }
} }
} // Rectangle }
} } // Rectangle
} }
...@@ -15,7 +15,7 @@ import QGroundControl.Palette 1.0 ...@@ -15,7 +15,7 @@ import QGroundControl.Palette 1.0
/// Mission item edit control /// Mission item edit control
Rectangle { Rectangle {
id: _root id: _root
height: editorLoader.y + (editorLoader.visible ? editorLoader.height : 0) + (_margin * 2) height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2)
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius radius: _radius
...@@ -90,8 +90,7 @@ Rectangle { ...@@ -90,8 +90,7 @@ Rectangle {
sourceSize.height: _hamburgerSize sourceSize.height: _hamburgerSize
source: "qrc:/qmlimages/Hamburger.svg" source: "qrc:/qmlimages/Hamburger.svg"
visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0 visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0
color: qgcPal.windowShade color: qgcPal.text
} }
QGCMouseArea { QGCMouseArea {
......
...@@ -760,14 +760,6 @@ QGCView { ...@@ -760,14 +760,6 @@ QGCView {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.leftMargin: ScreenTools.defaultFontPixelWidth
readonly property real _buttonRadius: ScreenTools.defaultFontPixelHeight * 0.75 readonly property real _buttonRadius: ScreenTools.defaultFontPixelHeight * 0.75
QGCColoredImage {
width: height
height: ScreenTools.defaultFontPixelWidth * 2.5
sourceSize.height: height
source: "qrc:/res/waypoint.svg"
color: qgcPal.text
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel { QGCLabel {
text: qsTr("Plan") text: qsTr("Plan")
color: qgcPal.text color: qgcPal.text
...@@ -831,7 +823,7 @@ QGCView { ...@@ -831,7 +823,7 @@ QGCView {
QGCListView { QGCListView {
id: missionItemEditorListView id: missionItemEditorListView
anchors.fill: parent anchors.fill: parent
spacing: ScreenTools.defaultFontPixelHeight * 0.5 spacing: ScreenTools.defaultFontPixelHeight / 4
orientation: ListView.Vertical orientation: ListView.Vertical
model: _missionController.visualItems model: _missionController.visualItems
cacheBuffer: Math.max(height * 2, 0) cacheBuffer: Math.max(height * 2, 0)
...@@ -865,9 +857,9 @@ QGCView { ...@@ -865,9 +857,9 @@ QGCView {
GeoFenceEditor { GeoFenceEditor {
anchors.top: rightControls.bottom anchors.top: rightControls.bottom
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5
anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
availableHeight: ScreenTools.availableHeight
myGeoFenceController: _geoFenceController myGeoFenceController: _geoFenceController
flightMap: editorMap flightMap: editorMap
visible: _editingLayer == _layerGeoFence visible: _editingLayer == _layerGeoFence
......
...@@ -50,7 +50,7 @@ Rectangle { ...@@ -50,7 +50,7 @@ Rectangle {
color: _outerTextColor color: _outerTextColor
} }
Image { QGCColoredImage {
id: hamburger id: hamburger
anchors.rightMargin: _margin anchors.rightMargin: _margin
anchors.right: parent.right anchors.right: parent.right
...@@ -59,6 +59,7 @@ Rectangle { ...@@ -59,6 +59,7 @@ Rectangle {
height: width height: width
sourceSize.height: height sourceSize.height: height
source: "qrc:/qmlimages/Hamburger.svg" source: "qrc:/qmlimages/Hamburger.svg"
color: qgcPal.text
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
......
...@@ -36,7 +36,6 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox) ...@@ -36,7 +36,6 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox)
if(!_defaultSource) { if(!_defaultSource) {
//-- Otherwise, create a default one //-- Otherwise, create a default one
_defaultSource = QGeoPositionInfoSource::createDefaultSource(this); _defaultSource = QGeoPositionInfoSource::createDefaultSource(this);
qDebug() << _defaultSource;
} }
_simulatedSource = new SimulatedPosition(); _simulatedSource = new SimulatedPosition();
......
...@@ -6,96 +6,50 @@ import QGroundControl.Palette 1.0 ...@@ -6,96 +6,50 @@ import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
CheckBox { CheckBox {
activeFocusOnPress: true property color textColor: _qgcPal.text
property bool textBold: false
property real textFontPointSize: ScreenTools.defaultFontPointSize
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool _noText: text === ""
property real _radius: ScreenTools.defaultFontPixelHeight * 0.16
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } activeFocusOnPress: true
style: CheckBoxStyle { style: CheckBoxStyle {
label: Item { label: Item {
implicitWidth: text.implicitWidth + 2 implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25
implicitHeight: ScreenTools.implicitCheckBoxHeight implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.checkBoxIndicatorSize)
baselineOffset: text.baselineOffset baselineOffset: text.baselineOffset
Rectangle {
anchors.margins: -1
anchors.leftMargin: -3
anchors.rightMargin: -3
anchors.fill: text
visible: control.activeFocus
height: 6
radius: 3
color: "#224f9fef"
border.color: "#47b"
opacity: 0.6
}
Text { Text {
id: text id: text
text: control.text text: control.text
antialiasing: true font.pointSize: textFontPointSize
font.pointSize: ScreenTools.defaultFontPointSize font.bold: control.textBold
font.family: ScreenTools.normalFontFamily color: control.textColor
color: control.__qgcPal.text anchors.centerIn: parent
anchors.verticalCenter: parent.verticalCenter
} }
} // label }
indicator: Item { indicator: Item {
implicitWidth: ScreenTools.checkBoxIndicatorSize implicitWidth: ScreenTools.checkBoxIndicatorSize
implicitHeight: implicitWidth implicitHeight: implicitWidth
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.bottomMargin: -1 radius: _radius
color: "#44ffffff" border.color: "black"
radius: baserect.radius opacity: control.checkedState === Qt.PartiallyChecked ? 0.5 : 1
}
Rectangle {
Rectangle { anchors.margins: parent.height / 4
id: baserect anchors.fill: parent
property var enabledGradient: Gradient { radius: _radius
GradientStop {color: "#eee" ; position: 0} color: "black"
GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} visible: control.checkedState === Qt.Checked
GradientStop {color: "#fff" ; position: 1}
}
property var disabledGradient: Gradient {
GradientStop {color: "#999" ; position: 0}
GradientStop {color: __qgcPal.textField ; position: 0.1}
GradientStop {color: __qgcPal.textField ; position: 0.9}
GradientStop {color: "#999" ; position: 1}
}
gradient: control.enabled ? enabledGradient : disabledGradient
radius: ScreenTools.defaultFontPixelHeight * 0.16
anchors.fill: parent
border.color: control.activeFocus ? "#47b" : "#999"
opacity: control.enabled ? 1 : 0.5
}
Image {
source: "/qmlimages/check.png"
opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0
anchors.centerIn: parent
anchors.verticalCenterOffset: 1
Behavior on opacity {NumberAnimation {duration: 80}}
}
Rectangle {
anchors.fill: parent
anchors.margins: Math.round(baserect.radius)
antialiasing: true
gradient: Gradient {
GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0}
GradientStop {color: "#555" ; position: 1}
} }
radius: baserect.radius - 1
anchors.centerIn: parent
anchors.alignWhenCentered: true
border.color: "#222"
Behavior on opacity {NumberAnimation {duration: 80}}
opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0
} }
} // indicator }
} // style }
} }
import QtQuick 2.3 import QtQuick 2.11
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
......
...@@ -6,41 +6,30 @@ import QGroundControl.Palette 1.0 ...@@ -6,41 +6,30 @@ import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
RadioButton { RadioButton {
property var color: qgcPal.text ///< Text color property color textColor: _qgcPal.text
property int textStyle: Text.Normal property bool textBold: false
property color textStyleColor: qgcPal.text property real textFontPointSize: ScreenTools.defaultFontPointSize
property bool textBold: false
property var qgcPal: QGCPalette { colorGroupEnabled: enabled } property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool _noText: text === ""
activeFocusOnPress: true
style: RadioButtonStyle { style: RadioButtonStyle {
spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth / 2
label: Item { label: Item {
implicitWidth: text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25
implicitHeight: ScreenTools.implicitRadioButtonHeight implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.radioButtonIndicatorSize)
baselineOffset: text.y + text.baselineOffset baselineOffset: text.y + text.baselineOffset
Rectangle {
anchors.fill: text
anchors.margins: -1
anchors.leftMargin: -3
anchors.rightMargin:-3
visible: control.activeFocus
height: ScreenTools.defaultFontPixelWidth * 0.25
radius: height * 0.5
color: "#224f9fef"
border.color: "#47b"
opacity: 0.6
}
Text { Text {
id: text id: text
text: control.text text: control.text
font.pointSize: ScreenTools.defaultFontPointSize font.pointSize: textFontPointSize
font.family: ScreenTools.normalFontFamily
font.bold: control.textBold font.bold: control.textBold
antialiasing: true color: control.textColor
color: control.color
style: control.textStyle
styleColor: control.textStyleColor
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
...@@ -49,9 +38,9 @@ RadioButton { ...@@ -49,9 +38,9 @@ RadioButton {
width: ScreenTools.radioButtonIndicatorSize width: ScreenTools.radioButtonIndicatorSize
height: width height: width
color: "white" color: "white"
border.color: control.qgcPal.text border.color: "black"
antialiasing: true
radius: height / 2 radius: height / 2
opacity: control.enabled ? 1 : 0.5
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
...@@ -60,7 +49,7 @@ RadioButton { ...@@ -60,7 +49,7 @@ RadioButton {
antialiasing: true antialiasing: true
radius: height / 2 radius: height / 2
color: "black" color: "black"
opacity: control.checked ? (control.enabled ? 1 : 0.5) : 0 visible: control.checked
} }
} }
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
* *
****************************************************************************/ ****************************************************************************/
import QtQuick 2.3 import QtQuick 2.11
import QtQuick.Controls 1.2 import QtQuick.Controls 1.4
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
...@@ -17,7 +17,7 @@ Rectangle { ...@@ -17,7 +17,7 @@ Rectangle {
id: _root id: _root
color: qgcPal.window color: qgcPal.window
width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 7 width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 7
height: buttonStripColumn.height + (buttonStripColumn.anchors.margins * 2) height: toolStripColumn.height + (toolStripColumn.anchors.margins * 2)
radius: _radius radius: _radius
border.width: 1 border.width: 1
border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35)
...@@ -35,9 +35,7 @@ Rectangle { ...@@ -35,9 +35,7 @@ Rectangle {
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth readonly property real _buttonSpacing: ScreenTools.defaultFontPixelHeight / 4
property bool _showOptionalElements: !ScreenTools.isTinyScreen
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
ExclusiveGroup { id: dropButtonsExclusiveGroup } ExclusiveGroup { id: dropButtonsExclusiveGroup }
...@@ -57,129 +55,141 @@ Rectangle { ...@@ -57,129 +55,141 @@ Rectangle {
} }
Column { Column {
id: buttonStripColumn id: toolStripColumn
anchors.margins: ScreenTools.defaultFontPixelWidth / 2 anchors.margins: ScreenTools.defaultFontPixelWidth / 2
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: _buttonSpacing
QGCLabel { QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: title text: title
visible: _showOptionalElements font.pointSize: ScreenTools.smallFontPointSize
} }
Item { width: 1; height: _buttonSpacing; visible: _showOptionalElements }
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 1 height: 1
color: qgcPal.text color: qgcPal.text
visible: _showOptionalElements
} }
Repeater { Column {
id: repeater anchors.left: parent.left
anchors.right: parent.right
delegate: Column { spacing: _buttonSpacing
id: buttonColumn
width: buttonStripColumn.width Repeater {
visible: _root.buttonVisible ? _root.buttonVisible[index] : true id: repeater
property bool checked: false delegate: FocusScope {
property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup id: scope
width: toolStripColumn.width
QGCPalette { id: _repeaterPal; colorGroupEnabled: _buttonEnabled } height: buttonRect.height
visible: _root.buttonVisible ? _root.buttonVisible[index] : true
property bool _buttonEnabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true
property var _iconSource: modelData.iconSource property bool checked: false
property var _alternateIconSource: modelData.alternateIconSource property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource
property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false property bool _buttonEnabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true
property bool animateImage: _root.animateImage ? _root.animateImage[index] : false property var _iconSource: modelData.iconSource
property var _alternateIconSource: modelData.alternateIconSource
onExclusiveGroupChanged: { property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource
if (exclusiveGroup) { property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false
exclusiveGroup.bindCheckable(buttonColumn) property bool animateImage: _root.animateImage ? _root.animateImage[index] : false
} property bool _hovered: false
} property bool _showHighlight: checked || (_buttonEnabled && _hovered)
onRotateImageChanged: { QGCPalette { id: _repeaterPal; colorGroupEnabled: _buttonEnabled }
if (rotateImage) {
imageRotation.running = true onExclusiveGroupChanged: {
} else { if (exclusiveGroup) {
imageRotation.running = false exclusiveGroup.bindCheckable(scope)
button.rotation = 0 }
}
}
onAnimateImageChanged: {
if (animateImage) {
opacityAnimation.running = true
} else {
opacityAnimation.running = false
button.opacity = 1
} }
}
Item { onRotateImageChanged: {
width: 1 if (rotateImage) {
height: _buttonSpacing imageRotation.running = true
visible: index == 0 ? _showOptionalElements : true } else {
} imageRotation.running = false
buttonImage.rotation = 0
}
}
FocusScope { onAnimateImageChanged: {
id: scope if (animateImage) {
anchors.left: parent.left opacityAnimation.running = true
anchors.right: parent.right } else {
height: width * 0.8 opacityAnimation.running = false
buttonImage.opacity = 1
}
}
Rectangle { Rectangle {
anchors.fill: parent id: buttonRect
color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button anchors.left: parent.left
anchors.right: parent.right
QGCColoredImage { height: buttonColumn.height
id: button color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window
height: parent.height
width: height Column {
anchors.centerIn: parent id: buttonColumn
source: _source anchors.left: parent.left
sourceSize.height: height anchors.right: parent.right
fillMode: Image.PreserveAspectFit spacing: -buttonImage.height / 8
mipmap: true
smooth: true QGCColoredImage {
color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText id: buttonImage
anchors.left: parent.left
RotationAnimation on rotation { anchors.right: parent.right
id: imageRotation height: width * 0.8
loops: Animation.Infinite //anchors.centerIn: parent
from: 0 source: _source
to: 360 sourceSize.height: height
duration: 500 fillMode: Image.PreserveAspectFit
running: false mipmap: true
smooth: true
color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text
RotationAnimation on rotation {
id: imageRotation
loops: Animation.Infinite
from: 0
to: 360
duration: 500
running: false
}
NumberAnimation on opacity {
id: opacityAnimation
running: false
from: 0
to: 1.0
loops: Animation.Infinite
duration: 2000
}
} }
NumberAnimation on opacity { QGCLabel {
id: opacityAnimation id: buttonLabel
running: false anchors.horizontalCenter: parent.horizontalCenter
from: 0 font.pointSize: ScreenTools.smallFontPointSize
to: 1.0 text: modelData.name
loops: Animation.Infinite color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text
duration: 2000 enabled: _buttonEnabled
} }
} } // Column
QGCMouseArea { QGCMouseArea {
// Size of mouse area is expanded to make touch easier anchors.fill: parent
anchors.leftMargin: -buttonStripColumn.anchors.margins visible: _buttonEnabled
anchors.rightMargin: -buttonStripColumn.anchors.margins hoverEnabled: true
anchors.left: parent.left preventStealing: true
anchors.right: parent.right
anchors.top: parent.top onContainsMouseChanged: _hovered = containsMouse
height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) onContainsPressChanged: _hovered = containsPress
visible: _buttonEnabled
preventStealing: true
onClicked: { onClicked: {
scope.focus = true scope.focus = true
...@@ -205,23 +215,8 @@ Rectangle { ...@@ -205,23 +215,8 @@ Rectangle {
} }
} }
} }
} } // Rectangle
} } // FocusScope
Item {
width: 1
height: ScreenTools.defaultFontPixelHeight * 0.25
visible: _showOptionalElements
}
QGCLabel {
id: buttonLabel
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: ScreenTools.smallFontPointSize
text: modelData.name
visible: _showOptionalElements
enabled: _buttonEnabled
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment