Commit 9967011d authored by dogmaphobic's avatar dogmaphobic

Adding a RoundButton element.

Also moving the Plan View tool bar buttons into a Row element.
parent 70a09b88
......@@ -114,6 +114,7 @@
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/RoundButton.qml">src/QmlControls/RoundButton.qml</file>
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<!-- Vehicle Setup -->
......
......@@ -130,204 +130,182 @@ QGCView {
}
}
Image {
id: addMissionItemsButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: homePositionManagerButton.left
anchors.top: homePositionManagerButton.top
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: "/qmlimages/MapAddMission.svg"
opacity: _addMissionItems ? 1.0 : 0.75
MouseArea {
anchors.fill: parent
Row {
spacing: ScreenTools.defaultFontPixelWidth
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: ScreenTools.defaultFontPixelWidth
RoundButton {
id: addMissionItemsButton
buttonImage: "/qmlimages/MapAddMission.svg"
opacity: _addMissionItems ? 1.0 : 0.75
onClicked: {
_addMissionItems = !_addMissionItems
_showHomePositionManager = false
}
}
}
Image {
id: homePositionManagerButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: centerMapButton.left
anchors.top: centerMapButton.top
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: "/qmlimages/MapHome.svg"
opacity: _showHomePositionManager ? 1.0 : 0.75
MouseArea {
anchors.fill: parent
RoundButton {
id: homePositionManagerButton
buttonImage: "/qmlimages/MapHome.svg"
opacity: _showHomePositionManager ? 1.0 : 0.75
onClicked: {
_showHomePositionManager = !_showHomePositionManager
_addMissionItems = false
}
}
}
DropButton {
id: centerMapButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: syncButton.left
anchors.top: syncButton.top
dropDirection: dropDown
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Home"
onClicked: {
centerMapButton.hideDropDown()
editorMap.center = QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude)
_showHomePositionManager = true
DropButton {
id: centerMapButton
dropDirection: dropDown
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Home"
onClicked: {
centerMapButton.hideDropDown()
editorMap.center = QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude)
_showHomePositionManager = true
}
}
}
QGCButton {
text: "Vehicle"
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0
QGCButton {
text: "Vehicle"
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0
property var activeVehicle: multiVehicleManager.activeVehicle
property var activeVehicle: multiVehicleManager.activeVehicle
onClicked: {
centerMapButton.hideDropDown()
editorMap.latitude = activeVehicle.latitude
editorMap.longitude = activeVehicle.longitude
onClicked: {
centerMapButton.hideDropDown()
editorMap.latitude = activeVehicle.latitude
editorMap.longitude = activeVehicle.longitude
}
}
}
/*
/*
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
QGCButton {
text: "All Items"
QGCButton {
text: "All Items"
onClicked: {
centerMapButton.hideDropDown()
onClicked: {
centerMapButton.hideDropDown()
// Begin with only the home position in the region
var region = QtPositioning.rectangle(QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude),
QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude))
// Begin with only the home position in the region
var region = QtPositioning.rectangle(QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude),
QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude))
// Now expand the region to include all mission items
for (var i=0; i<_missionItems.count; i++) {
var missionItem = _missionItems.get(i)
// Now expand the region to include all mission items
for (var i=0; i<_missionItems.count; i++) {
var missionItem = _missionItems.get(i)
region.topLeft.latitude = Math.max(missionItem.coordinate.latitude, region.topLeft.latitude)
region.topLeft.longitude = Math.min(missionItem.coordinate.longitude, region.topLeft.longitude)
region.topLeft.latitude = Math.max(missionItem.coordinate.latitude, region.topLeft.latitude)
region.topLeft.longitude = Math.min(missionItem.coordinate.longitude, region.topLeft.longitude)
region.topRight.latitude = Math.max(missionItem.coordinate.latitude, region.topRight.latitude)
region.topRight.longitude = Math.max(missionItem.coordinate.longitude, region.topRight.longitude)
region.topRight.latitude = Math.max(missionItem.coordinate.latitude, region.topRight.latitude)
region.topRight.longitude = Math.max(missionItem.coordinate.longitude, region.topRight.longitude)
region.bottomLeft.latitude = Math.min(missionItem.coordinate.latitude, region.bottomLeft.latitude)
region.bottomLeft.longitude = Math.min(missionItem.coordinate.longitude, region.bottomLeft.longitude)
region.bottomLeft.latitude = Math.min(missionItem.coordinate.latitude, region.bottomLeft.latitude)
region.bottomLeft.longitude = Math.min(missionItem.coordinate.longitude, region.bottomLeft.longitude)
region.bottomRight.latitude = Math.min(missionItem.coordinate.latitude, region.bottomRight.latitude)
region.bottomRight.longitude = Math.max(missionItem.coordinate.longitude, region.bottomRight.longitude)
}
region.bottomRight.latitude = Math.min(missionItem.coordinate.latitude, region.bottomRight.latitude)
region.bottomRight.longitude = Math.max(missionItem.coordinate.longitude, region.bottomRight.longitude)
}
editorMap.visibleRegion = region
editorMap.visibleRegion = region
}
}
*/
}
*/
}
}
}
DropButton {
id: syncButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: mapTypeButton.left
anchors.top: mapTypeButton.top
dropDirection: dropDown
buttonImage: "/qmlimages/MapSync.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Load from vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onClicked: {
syncButton.hideDropDown()
controller.getMissionItems()
DropButton {
id: syncButton
dropDirection: dropDown
buttonImage: "/qmlimages/MapSync.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Load from vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onClicked: {
syncButton.hideDropDown()
controller.getMissionItems()
}
}
}
QGCButton {
text: "Save to vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
QGCButton {
text: "Save to vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onClicked: {
syncButton.hideDropDown()
controller.setMissionItems()
onClicked: {
syncButton.hideDropDown()
controller.setMissionItems()
}
}
}
QGCButton {
text: "Load from file..."
QGCButton {
text: "Load from file..."
onClicked: {
syncButton.hideDropDown()
controller.loadMissionFromFile()
onClicked: {
syncButton.hideDropDown()
controller.loadMissionFromFile()
}
}
}
QGCButton {
text: "Save to file..."
QGCButton {
text: "Save to file..."
onClicked: {
syncButton.hideDropDown()
controller.saveMissionToFile()
onClicked: {
syncButton.hideDropDown()
controller.saveMissionToFile()
}
}
}
}
}
}
DropButton {
id: mapTypeButton
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
DropButton {
id: mapTypeButton
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: editorMap.mapType == text
text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
QGCButton {
checkable: true
checked: editorMap.mapType == text
text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
onClicked: {
editorMap.mapType = text
checked = true
mapTypeButton.hideDropDown()
onClicked: {
editorMap.mapType = text
checked = true
mapTypeButton.hideDropDown()
}
}
}
}
......
......@@ -14,6 +14,7 @@ QGCCanvas 1.0 QGCCanvas.qml
SubMenuButton 1.0 SubMenuButton.qml
IndicatorButton 1.0 IndicatorButton.qml
DropButton 1.0 DropButton.qml
RoundButton 1.0 RoundButton.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.qml
......
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.ScreenTools 1.0
Item {
id: _root
signal clicked()
property alias buttonImage: button.source
property real radius: (ScreenTools.defaultFontPixelHeight * 3) / 2
width: radius * 2
height: radius * 2
Rectangle {
anchors.fill: parent
radius: width / 2
border.width: 2
border.color: "white"
color: "transparent"
Image {
id: button
anchors.fill: parent
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
MouseArea {
anchors.fill: parent
onClicked: _root.clicked()
}
}
}
}
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