Commit ed9c6f45 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #1339 from dogmaphobic/powerSettings

Initial Battery Config
parents 12930fd5 bae07b16
...@@ -497,7 +497,7 @@ HEADERS += \ ...@@ -497,7 +497,7 @@ HEADERS += \
src/ui/QGCUDPLinkConfiguration.h \ src/ui/QGCUDPLinkConfiguration.h \
src/uas/UASMessageHandler.h \ src/uas/UASMessageHandler.h \
src/ui/toolbar/MainToolBar.h \ src/ui/toolbar/MainToolBar.h \
src/QmlControls/MousePosition.h src/QmlControls/ScreenTools.h
SOURCES += \ SOURCES += \
src/main.cc \ src/main.cc \
...@@ -639,7 +639,7 @@ SOURCES += \ ...@@ -639,7 +639,7 @@ SOURCES += \
src/ui/QGCUDPLinkConfiguration.cc \ src/ui/QGCUDPLinkConfiguration.cc \
src/uas/UASMessageHandler.cc \ src/uas/UASMessageHandler.cc \
src/ui/toolbar/MainToolBar.cc \ src/ui/toolbar/MainToolBar.cc \
src/QmlControls/MousePosition.cc src/QmlControls/ScreenTools.cc
# #
# Unit Test specific configuration goes here # Unit Test specific configuration goes here
...@@ -742,6 +742,7 @@ HEADERS+= \ ...@@ -742,6 +742,7 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/SensorsComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponentController.h \ src/AutoPilotPlugins/PX4/SensorsComponentController.h \
src/AutoPilotPlugins/PX4/SafetyComponent.h \ src/AutoPilotPlugins/PX4/SafetyComponent.h \
src/AutoPilotPlugins/PX4/PowerComponent.h \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \
SOURCES += \ SOURCES += \
...@@ -764,6 +765,7 @@ SOURCES += \ ...@@ -764,6 +765,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponentController.cc \ src/AutoPilotPlugins/PX4/SensorsComponentController.cc \
src/AutoPilotPlugins/PX4/SafetyComponent.cc \ src/AutoPilotPlugins/PX4/SafetyComponent.cc \
src/AutoPilotPlugins/PX4/PowerComponent.cc \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \
# Fact System code # Fact System code
......
...@@ -247,13 +247,11 @@ ...@@ -247,13 +247,11 @@
<qresource prefix="/qml"> <qresource prefix="/qml">
<file alias="test.qml">src/test.qml</file> <file alias="test.qml">src/test.qml</file>
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file> <file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file>
<file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file> <file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file>
<file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file> <file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file>
<file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file> <file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file>
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file> <file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file> <file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/qmldir</file> <file alias="QGroundControl/Controls/qmldir">src/QmlControls/qmldir</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file> <file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file> <file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
...@@ -263,31 +261,27 @@ ...@@ -263,31 +261,27 @@
<file alias="QGroundControl/Controls/QGCComboBox.qml">src/QmlControls/QGCComboBox.qml</file> <file alias="QGroundControl/Controls/QGCComboBox.qml">src/QmlControls/QGCComboBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file> <file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file> <file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file> <file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file> <file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/arrow-down.png">src/QmlControls/arrow-down.png</file> <file alias="QGroundControl/Controls/arrow-down.png">src/QmlControls/arrow-down.png</file>
<file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file> <file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file>
<file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file> <file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file>
<file alias="SetupViewButtons.qml">src/VehicleSetup/SetupViewButtons.qml</file> <file alias="SetupViewButtons.qml">src/VehicleSetup/SetupViewButtons.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file> <file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file> <file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file> <file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file>
<file alias="SensorsComponent.qml">src/AutoPilotPlugins/PX4/SensorsComponent.qml</file> <file alias="SensorsComponent.qml">src/AutoPilotPlugins/PX4/SensorsComponent.qml</file>
<file alias="FlightModesComponent.qml">src/AutoPilotPlugins/PX4/FlightModesComponent.qml</file> <file alias="FlightModesComponent.qml">src/AutoPilotPlugins/PX4/FlightModesComponent.qml</file>
<file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file> <file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="SensorsComponentSummary.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml</file> <file alias="SensorsComponentSummary.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml</file>
<file alias="SensorsComponentSummaryFixedWing.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml</file> <file alias="SensorsComponentSummaryFixedWing.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml</file>
<file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file> <file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file> <file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file> <file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
<file alias="SafetyComponentTree.svg">src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.svg</file>
<file alias="SafetyComponentTree.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.png</file>
<file alias="SafetyComponentHome.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png</file> <file alias="SafetyComponentHome.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png</file>
<file alias="SafetyComponentArrowDown.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentArrowDown.png</file> <file alias="SafetyComponentArrowDown.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentArrowDown.png</file>
<file alias="SafetyComponentPlane.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentPlane.png</file> <file alias="SafetyComponentPlane.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentPlane.png</file>
...@@ -297,16 +291,21 @@ ...@@ -297,16 +291,21 @@
<file alias="VehicleRight.png">src/AutoPilotPlugins/PX4/Images/VehicleRight.png</file> <file alias="VehicleRight.png">src/AutoPilotPlugins/PX4/Images/VehicleRight.png</file>
<file alias="VehicleNoseDown.png">src/AutoPilotPlugins/PX4/Images/VehicleNoseDown.png</file> <file alias="VehicleNoseDown.png">src/AutoPilotPlugins/PX4/Images/VehicleNoseDown.png</file>
<file alias="VehicleTailDown.png">src/AutoPilotPlugins/PX4/Images/VehicleTailDown.png</file> <file alias="VehicleTailDown.png">src/AutoPilotPlugins/PX4/Images/VehicleTailDown.png</file>
<file alias="QGroundControl/Controls/subMenuButtonImage.png">files/Setup/cogwheels.png</file> <file alias="QGroundControl/Controls/subMenuButtonImage.png">files/Setup/cogwheels.png</file>
<file alias="QGroundControl/Controls/SensorsComponentIcon.png">src/AutoPilotPlugins/PX4/Images/SensorsComponentIcon.png</file> <file alias="QGroundControl/Controls/SensorsComponentIcon.png">src/AutoPilotPlugins/PX4/Images/SensorsComponentIcon.png</file>
<file alias="QGroundControl/Controls/RadioComponentIcon.png">src/AutoPilotPlugins/PX4/Images/RadioComponentIcon.png</file> <file alias="QGroundControl/Controls/RadioComponentIcon.png">src/AutoPilotPlugins/PX4/Images/RadioComponentIcon.png</file>
<file alias="QGroundControl/Controls/FlightModesComponentIcon.png">src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png</file> <file alias="QGroundControl/Controls/FlightModesComponentIcon.png">src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png</file>
<file alias="QGroundControl/Controls/AirframeComponentIcon.png">src/AutoPilotPlugins/PX4/Images/AirframeComponentIcon.png</file> <file alias="QGroundControl/Controls/AirframeComponentIcon.png">src/AutoPilotPlugins/PX4/Images/AirframeComponentIcon.png</file>
<file alias="QGroundControl/Controls/SafetyComponentIcon.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentIcon.png</file> <file alias="QGroundControl/Controls/SafetyComponentIcon.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentIcon.png</file>
<file alias="QGroundControl/Controls/PowerComponentIcon.png">src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png</file>
<file alias="QGroundControl/Controls/FirmwareUpgradeIcon.png">src/VehicleSetup/FirmwareUpgradeIcon.png</file> <file alias="QGroundControl/Controls/FirmwareUpgradeIcon.png">src/VehicleSetup/FirmwareUpgradeIcon.png</file>
<file alias="QGroundControl/Controls/VehicleSummaryIcon.png">src/VehicleSetup/VehicleSummaryIcon.png</file> <file alias="QGroundControl/Controls/VehicleSummaryIcon.png">src/VehicleSetup/VehicleSummaryIcon.png</file>
<file alias="PowerComponentBattery_01cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_01cell.svg</file>
<file alias="PowerComponentBattery_02cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_02cell.svg</file>
<file alias="PowerComponentBattery_03cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_03cell.svg</file>
<file alias="PowerComponentBattery_04cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_04cell.svg</file>
<file alias="PowerComponentBattery_05cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_05cell.svg</file>
<file alias="PowerComponentBattery_06cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_06cell.svg</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file> <file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
</qresource> </qresource>
<qresource prefix="/AutoPilotPlugins/PX4"> <qresource prefix="/AutoPilotPlugins/PX4">
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="63" y="58.5" fill="#FFFFFF" width="162" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="63" y="58.5" fill="#FFFFFF" width="75.6" height="207"/>
<rect x="149.4" y="58.5" fill="#FFFFFF" width="75.6" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="63" y="58.5" fill="#FFFFFF" width="48.6" height="207"/>
<rect x="119.363" y="58.5" fill="#FFFFFF" width="48.6" height="207"/>
<rect x="176.4" y="58.5" fill="#FFFFFF" width="48.6" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="63" y="58.5" fill="#FFFFFF" width="36" height="207"/>
<rect x="104.812" y="58.5" fill="#FFFFFF" width="36" height="207"/>
<rect x="147.75" y="58.5" fill="#FFFFFF" width="36" height="207"/>
<rect x="189" y="58.5" fill="#FFFFFF" width="36" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="198" y="58.5" fill="#FFFFFF" width="27" height="207"/>
<rect x="164.25" y="58.5" fill="#FFFFFF" width="27" height="207"/>
<rect x="130.5" y="58.5" fill="#FFFFFF" width="27" height="207"/>
<rect x="96.75" y="58.5" fill="#FFFFFF" width="27" height="207"/>
<rect x="63" y="58.5" fill="#FFFFFF" width="27" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="36 9 216 279" enable-background="new 36 9 216 279" xml:space="preserve">
<g>
<path fill="none" stroke="#FFFFFF" stroke-width="8" stroke-miterlimit="10" d="M238.475,270.675c0,3.96-3.24,7.2-7.2,7.2h-174.6
c-3.96,0-7.2-3.24-7.2-7.2v-219.6c0-3.96,3.24-7.2,7.2-7.2h174.6c3.96,0,7.2,3.24,7.2,7.2V270.675z"/>
</g>
<g>
<rect x="84.262" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="92.141" y1="28.35" x2="105.184" y2="28.35"/>
</g>
<g>
<rect x="173.928" y="13.95" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" width="28.8" height="28.8"/>
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="188.328" y1="20.767" x2="188.328" y2="35.933"/>
<line fill="none" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="10" x1="181.806" y1="28.35" x2="194.849" y2="28.35"/>
</g>
</g>
<rect x="63" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
<rect x="90.675" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
<rect x="118.35" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
<rect x="146.025" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
<rect x="173.7" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
<rect x="201.375" y="58.5" fill="#FFFFFF" width="23.4" height="207"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="356 -168 306 480" enable-background="new 356 -168 306 480" xml:space="preserve">
<g>
<title>Layer 1</title>
<g id="layer1">
<g id="g4623">
<path id="rect2192" fill="#FFFFFF" d="M484.7,225.1h36.7v77.8c-10.8,5.1-23.7,6.6-36.7,0V225.1z"/>
<path id="path1307" fill="#FFFFFF" d="M633.7,234.3c-83.3-16.9-172.7,18.5-261.3,0C432.8,178.9,450.2,67.3,503,8
C545.8,65.7,572.4,178.9,633.7,234.3z"/>
<path id="path2183" fill="#FFFFFF" d="M607.5,89.1c-66.6-13.5-138.1,14.8-208.9,0C446.9,44.8,460.8-44.4,503-91.8
C537.2-45.7,558.5,44.8,607.5,89.1z"/>
<path id="path2185" fill="#FFFFFF" d="M583.6-26.4c-51.3-10.4-106.5,11.4-161.1,0c37.3-34.2,48-103,80.6-139.5
C529.4-130.3,545.8-60.5,583.6-26.4z"/>
</g>
</g>
</g>
</svg>
...@@ -70,6 +70,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) : ...@@ -70,6 +70,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_flightModesComponent(NULL), _flightModesComponent(NULL),
_sensorsComponent(NULL), _sensorsComponent(NULL),
_safetyComponent(NULL), _safetyComponent(NULL),
_powerComponent(NULL),
_incorrectParameterVersion(false) _incorrectParameterVersion(false)
{ {
Q_ASSERT(uas); Q_ASSERT(uas);
...@@ -214,6 +215,10 @@ const QVariantList& PX4AutoPilotPlugin::components(void) ...@@ -214,6 +215,10 @@ const QVariantList& PX4AutoPilotPlugin::components(void)
Q_CHECK_PTR(_sensorsComponent); Q_CHECK_PTR(_sensorsComponent);
_components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent));
_powerComponent = new PowerComponent(_uas, this);
Q_CHECK_PTR(_powerComponent);
_components.append(QVariant::fromValue((VehicleComponent*)_powerComponent));
_safetyComponent = new SafetyComponent(_uas, this); _safetyComponent = new SafetyComponent(_uas, this);
Q_CHECK_PTR(_safetyComponent); Q_CHECK_PTR(_safetyComponent);
_components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent));
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "FlightModesComponent.h" #include "FlightModesComponent.h"
#include "SensorsComponent.h" #include "SensorsComponent.h"
#include "SafetyComponent.h" #include "SafetyComponent.h"
#include "PowerComponent.h"
#include <QImage> #include <QImage>
...@@ -64,7 +65,8 @@ public: ...@@ -64,7 +65,8 @@ public:
FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; } FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; }
SensorsComponent* sensorsComponent(void) { return _sensorsComponent; } SensorsComponent* sensorsComponent(void) { return _sensorsComponent; }
SafetyComponent* safetyComponent(void) { return _safetyComponent; } SafetyComponent* safetyComponent(void) { return _safetyComponent; }
PowerComponent* powerComponent(void) { return _powerComponent; }
private slots: private slots:
void _checkForIncorrectParameterVersion(void); void _checkForIncorrectParameterVersion(void);
...@@ -76,6 +78,7 @@ private: ...@@ -76,6 +78,7 @@ private:
FlightModesComponent* _flightModesComponent; FlightModesComponent* _flightModesComponent;
SensorsComponent* _sensorsComponent; SensorsComponent* _sensorsComponent;
SafetyComponent* _safetyComponent; SafetyComponent* _safetyComponent;
PowerComponent* _powerComponent;
bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
}; };
......
...@@ -5,22 +5,26 @@ ...@@ -5,22 +5,26 @@
<short_desc>Empty cell voltage</short_desc> <short_desc>Empty cell voltage</short_desc>
<long_desc>Defines the voltage where a single cell of the battery is considered empty.</long_desc> <long_desc>Defines the voltage where a single cell of the battery is considered empty.</long_desc>
<default>3.4</default> <default>3.4</default>
<unit>V</unit>
</parameter> </parameter>
<parameter name="BAT_V_CHARGED" type="FLOAT"> <parameter name="BAT_V_CHARGED" type="FLOAT">
<short_desc>Full cell voltage</short_desc> <short_desc>Full cell voltage</short_desc>
<long_desc>Defines the voltage where a single cell of the battery is considered full.</long_desc> <long_desc>Defines the voltage where a single cell of the battery is considered full.</long_desc>
<default>4.2</default> <default>4.2</default>
<unit>V</unit>
</parameter> </parameter>
<parameter name="BAT_V_LOAD_DROP" type="FLOAT"> <parameter name="BAT_V_LOAD_DROP" type="FLOAT">
<short_desc>Voltage drop per cell on 100% load</short_desc> <short_desc>Voltage drop per cell on 100% load</short_desc>
<long_desc>This implicitely defines the internal resistance <long_desc>This implicitely defines the internal resistance
to maximum current ratio and assumes linearity.</long_desc> to maximum current ratio and assumes linearity.</long_desc>
<default>0.07</default> <default>0.07</default>
<unit>V</unit>
</parameter> </parameter>
<parameter name="BAT_N_CELLS" type="INT32"> <parameter name="BAT_N_CELLS" type="INT32">
<short_desc>Number of cells</short_desc> <short_desc>Number of cells</short_desc>
<long_desc>Defines the number of cells the attached battery consists of.</long_desc> <long_desc>Defines the number of cells the attached battery consists of.</long_desc>
<default>3</default> <default>3</default>
<unit>S</unit>
</parameter> </parameter>
<parameter name="BAT_CAPACITY" type="FLOAT"> <parameter name="BAT_CAPACITY" type="FLOAT">
<short_desc>Battery capacity</short_desc> <short_desc>Battery capacity</short_desc>
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Gus Grubba <mavlink@grubba.com>
#include "PowerComponent.h"
#include "PX4RCCalibration.h"
#include "QGCQmlWidgetHolder.h"
#include "PX4AutoPilotPlugin.h"
PowerComponent::PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Power"))
{
}
QString PowerComponent::name(void) const
{
return _name;
}
QString PowerComponent::description(void) const
{
return tr("The Power Component is used to setup battery parameters as well as advanced settings for propellers and magnetometer.");
}
QString PowerComponent::iconResource(void) const
{
return "PowerComponentIcon.png";
}
bool PowerComponent::requiresSetup(void) const
{
return true;
}
bool PowerComponent::setupComplete(void) const
{
QVariant cvalue, evalue, nvalue;
if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_CHARGED", cvalue)) {
if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_EMPTY", evalue)) {
if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_N_CELLS", nvalue)) {
return (cvalue.toFloat() > 0.1f) && (evalue.toFloat() > 0.1f) && (nvalue.toInt() > 0);
}
}
}
Q_ASSERT(false);
return false;
}
QString PowerComponent::setupStateDescription(void) const
{
const char* stateDescription;
if (requiresSetup()) {
stateDescription = "Requires setup";
} else {
stateDescription = "Setup complete";
}
return QString(stateDescription);
}
QStringList PowerComponent::setupCompleteChangedTriggerList(void) const
{
return QStringList();
}
QStringList PowerComponent::paramFilterList(void) const
{
QStringList list;
return list;
}
QWidget* PowerComponent::setupWidget(void) const
{
QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder();
Q_CHECK_PTR(holder);
holder->setAutoPilot(_autopilot);
holder->setSource(QUrl::fromUserInput("qrc:/qml/PowerComponent.qml"));
return holder;
}
QUrl PowerComponent::summaryQmlSource(void) const
{
return QUrl::fromUserInput("qrc:/qml/PowerComponentSummary.qml");
}
QString PowerComponent::prerequisiteSetup(void) const
{
PX4AutoPilotPlugin* plugin = dynamic_cast<PX4AutoPilotPlugin*>(_autopilot);
Q_ASSERT(plugin);
if (!plugin->airframeComponent()->setupComplete()) {
return plugin->airframeComponent()->name();
}
return QString();
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef PowerComponent_H
#define PowerComponent_H
#include "PX4Component.h"
/// @file
/// @brief Battery, propeller and magnetometer settings
/// @author Gus Grubba <mavlink@grubba.com>
class PowerComponent : public PX4Component
{
Q_OBJECT
public:
PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent
virtual QString name (void) const;
virtual QString description (void) const;
virtual QString iconResource (void) const;
virtual bool requiresSetup (void) const;
virtual bool setupComplete (void) const;
virtual QString setupStateDescription (void) const;
virtual QWidget* setupWidget (void) const;
virtual QStringList paramFilterList (void) const;
virtual QUrl summaryQmlSource (void) const;
virtual QString prerequisiteSetup (void) const;
private:
const QString _name;
QVariantList _summaryItems;
};
#endif
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief Battery, propeller and magnetometer summary
/// @author Gus Grubba <mavlink@grubba.com>
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
Column {
anchors.fill: parent
anchors.margins: 8
Row {
width: parent.width
QGCLabel { id: battFull; text: "Battery Full:" }
FactLabel {
fact: Fact { name: "BAT_V_CHARGED" }
horizontalAlignment: Text.AlignRight;
width: parent.width - battFull.contentWidth;
}
}
Row {
width: parent.width
QGCLabel { id: battEmpty; text: "Battery Empty:" }
FactLabel {
fact: Fact { name: "BAT_V_EMPTY" }
horizontalAlignment: Text.AlignRight;
width: parent.width - battEmpty.contentWidth;
}
}
Row {
width: parent.width
QGCLabel { id: battCells; text: "Number of Cells:" }
FactLabel {
fact: Fact { name: "BAT_N_CELLS" }
horizontalAlignment: Text.AlignRight;
width: parent.width - battCells.contentWidth;
}
}
Row {
width: parent.width
QGCLabel { id: battDrop; text: "Voltage Drop:" }
FactLabel {
fact: Fact { name: "BAT_V_LOAD_DROP" }
horizontalAlignment: Text.AlignRight;
width: parent.width - battDrop.contentWidth;
}
}
}
...@@ -201,7 +201,7 @@ Rectangle { ...@@ -201,7 +201,7 @@ Rectangle {
y: parent.height - height - 20 y: parent.height - height - 20
width: 80 width: 80
height: parent.height / 2 height: parent.height / 2
source: "/qml/SafetyComponentTree.png" source: "/qml/SafetyComponentTree.svg"
fillMode: Image.Stretch fillMode: Image.Stretch
smooth: true smooth: true
color: palette.windowShadeDark color: palette.windowShadeDark
...@@ -212,8 +212,8 @@ Rectangle { ...@@ -212,8 +212,8 @@ Rectangle {
y: parent.height - height y: parent.height - height
width: 100 width: 100
height: parent.height * .75 height: parent.height * .75
source: "/qml/SafetyComponentTree.png" source: "/qml/SafetyComponentTree.svg"
fillMode: Image.Stretch fillMode: Image.PreserveAspectFit
smooth: true smooth: true
color: palette.button color: palette.button
} }
......
...@@ -39,7 +39,27 @@ Fact::Fact(QString name, FactMetaData::ValueType_t type, QObject* parent) : ...@@ -39,7 +39,27 @@ Fact::Fact(QString name, FactMetaData::ValueType_t type, QObject* parent) :
void Fact::setValue(const QVariant& value) void Fact::setValue(const QVariant& value)
{ {
_value = value; switch (type()) {
case FactMetaData::valueTypeInt8:
case FactMetaData::valueTypeInt16:
case FactMetaData::valueTypeInt32:
_value.setValue(QVariant(value.toInt()));
break;
case FactMetaData::valueTypeUint8:
case FactMetaData::valueTypeUint16:
case FactMetaData::valueTypeUint32:
_value.setValue(value.toUInt());
break;
case FactMetaData::valueTypeFloat:
_value.setValue(value.toFloat());
break;
case FactMetaData::valueTypeDouble:
_value.setValue(value.toDouble());
break;
}
emit valueChanged(_value); emit valueChanged(_value);
emit _containerValueChanged(_value); emit _containerValueChanged(_value);
} }
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#include "QGCTemporaryFile.h" #include "QGCTemporaryFile.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCPalette.h" #include "QGCPalette.h"
#include "MousePosition.h" #include "ScreenTools.h"
#ifdef QGC_RTLAB_ENABLED #ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h" #include "OpalLink.h"
...@@ -252,7 +252,7 @@ void QGCApplication::_initCommon(void) ...@@ -252,7 +252,7 @@ void QGCApplication::_initCommon(void)
// Register our Qml objects // Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette"); qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterType<MousePosition>("QGroundControl.MousePosition", 1, 0, "MousePosition"); qmlRegisterType<ScreenTools>("QGroundControl.ScreenTools", 1, 0, "ScreenTools");
} }
bool QGCApplication::_initForNormalAppBoot(void) bool QGCApplication::_initForNormalAppBoot(void)
......
...@@ -4,7 +4,7 @@ import QtQuick.Controls.Styles 1.2 ...@@ -4,7 +4,7 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.MousePosition 1.0 import QGroundControl.ScreenTools 1.0
Button { Button {
// primary: true - this is the primary button for this group of buttons // primary: true - this is the primary button for this group of buttons
...@@ -23,17 +23,17 @@ Button { ...@@ -23,17 +23,17 @@ Button {
property int __lastGlobalMouseX: 0 property int __lastGlobalMouseX: 0
property int __lastGlobalMouseY: 0 property int __lastGlobalMouseY: 0
property MousePosition __globalMousePosition: MousePosition { } property ScreenTools __screenTools: ScreenTools { }
Connections { Connections {
target: __behavior target: __behavior
onMouseXChanged: { onMouseXChanged: {
__lastGlobalMouseX = __globalMousePosition.mouseX __lastGlobalMouseX = __screenTools.mouseX
__lastGlobalMouseY = __globalMousePosition.mouseY __lastGlobalMouseY = __screenTools.mouseY
} }
onMouseYChanged: { onMouseYChanged: {
__lastGlobalMouseX = __globalMousePosition.mouseX __lastGlobalMouseX = __screenTools.mouseX
__lastGlobalMouseY = __globalMousePosition.mouseY __lastGlobalMouseY = __screenTools.mouseY
} }
onEntered: { __forceHoverOff; false; hoverTimer.start() } onEntered: { __forceHoverOff; false; hoverTimer.start() }
onExited: { __forceHoverOff; false; hoverTimer.stop() } onExited: { __forceHoverOff; false; hoverTimer.stop() }
...@@ -45,7 +45,7 @@ Button { ...@@ -45,7 +45,7 @@ Button {
repeat: true repeat: true
onTriggered: { onTriggered: {
if (__lastGlobalMouseX != __globalMousePosition.mouseX || __lastGlobalMouseY != __globalMousePosition.mouseY) { if (__lastGlobalMouseX != __screenTools.mouseX || __lastGlobalMouseY != __screenTools.mouseY) {
__forceHoverOff = true __forceHoverOff = true
} else { } else {
__forceHoverOff = false __forceHoverOff = false
......
import QtQuick 2.2 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
...@@ -17,6 +17,7 @@ Item { ...@@ -17,6 +17,7 @@ Item {
property alias paintedWidth: image.paintedWidth property alias paintedWidth: image.paintedWidth
property alias progress: image.progress property alias progress: image.progress
property alias smooth: image.smooth property alias smooth: image.smooth
property alias mipmap: image.mipmap
property alias source: image.source property alias source: image.source
property alias sourceSize: image.sourceSize property alias sourceSize: image.sourceSize
property alias status: image.status property alias status: image.status
...@@ -28,6 +29,7 @@ Item { ...@@ -28,6 +29,7 @@ Item {
Image { Image {
id: image id: image
smooth: true smooth: true
mipmap: true
visible: false visible: false
anchors.fill: parent anchors.fill: parent
} }
...@@ -37,4 +39,4 @@ Item { ...@@ -37,4 +39,4 @@ Item {
source: image source: image
color: parent.color color: parent.color
} }
} }
\ No newline at end of file
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
/// @author Don Gagne <don@thegagnes.com> /// @author Gus Grubba <mavlink@grubba.com>
#include "MousePosition.h" #include "ScreenTools.h"
#include "MainWindow.h"
MousePosition::MousePosition(void) ScreenTools::ScreenTools()
: _dotsPerInch(96.0)
, _dpiFactor( 72.0 / 96.0)
{ {
// Get screen DPI to manage font sizes on different platforms
QScreen *srn = QGuiApplication::screens().at(0); // TODO: Find current monitor as opposed to picking first one
if(srn && srn->logicalDotsPerInch() > 50.0) {
_dotsPerInch = (double)srn->logicalDotsPerInch(); // Font point sizes are based on Mac 72dpi
_dpiFactor = 72.0 / _dotsPerInch;
} else {
qWarning() << "System not reporting logical DPI, which is used to compute the appropriate font size. The default being used is 96dpi. If the text within buttons and UI elements are too big or too small, that's the reason.";
}
connect(MainWindow::instance(), &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas);
}
void ScreenTools::_updateCanvas()
{
emit repaintRequestedChanged();
} }
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
/// @author Don Gagne <don@thegagnes.com> /// @author Gus Grubba <mavlink@grubba.com>
#ifndef MOUSEPOSITION_H #ifndef SCREENTOOLS_H
#define MOUSEPOSITION_H #define SCREENTOOLS_H
#include <QObject> #include <QObject>
#include <QCursor> #include <QCursor>
/// This Qml control is used to return global mouse positions. It is needed to fix /// This Qml control is used to return screen parameters
/// a problem with hover state of buttons not being updated correctly if the mouse class ScreenTools : public QObject
/// moves out of a QQuickWidget control.
class MousePosition : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
MousePosition(void); ScreenTools();
Q_PROPERTY(int mouseX READ mouseX) Q_PROPERTY(double screenDPI READ screenDPI CONSTANT)
Q_PROPERTY(int mouseY READ mouseY) Q_PROPERTY(double dpiFactor READ dpiFactor CONSTANT)
Q_PROPERTY(int mouseX READ mouseX)
int mouseX(void) { return QCursor::pos().x(); } Q_PROPERTY(int mouseY READ mouseY)
int mouseY(void) { return QCursor::pos().y(); } Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
double screenDPI () { return _dotsPerInch; }
double dpiFactor () { return _dpiFactor; }
int mouseX () { return QCursor::pos().x(); }
int mouseY () { return QCursor::pos().y(); }
bool repaintRequested () { return true; }
signals:
void repaintRequestedChanged();
private slots:
void _updateCanvas();
private:
double _dotsPerInch;
double _dpiFactor;
}; };
#endif #endif
...@@ -947,7 +947,7 @@ void MainWindow::connectCommonActions() ...@@ -947,7 +947,7 @@ void MainWindow::connectCommonActions()
connect(_ui.actionSimulate, SIGNAL(triggered(bool)), this, SLOT(simulateLink(bool))); connect(_ui.actionSimulate, SIGNAL(triggered(bool)), this, SLOT(simulateLink(bool)));
// Update Tool Bar // Update Tool Bar
_mainToolBar->setCurrentView((MainToolBar::ViewType_t)_currentView); _mainToolBar->setCurrentView(_currentView);
} }
void MainWindow::_openUrl(const QString& url, const QString& errorMessage) void MainWindow::_openUrl(const QString& url, const QString& errorMessage)
...@@ -1173,6 +1173,10 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -1173,6 +1173,10 @@ void MainWindow::_loadCurrentViewState(void)
// HIL dock widget are dynamic and don't take part in the saved window state, so this // HIL dock widget are dynamic and don't take part in the saved window state, so this
// need to happen after we restore state // need to happen after we restore state
_showHILConfigurationWidgets(); _showHILConfigurationWidgets();
// There is a bug in Qt where a Canvas element inside a QQuickWidget does not
// receive update requests. Here we emit a signal for them to get repainted.
emit repaintCanvas();
} }
void MainWindow::_hideAllHilDockWidgets(void) void MainWindow::_hideAllHilDockWidgets(void)
...@@ -1371,22 +1375,3 @@ void MainWindow::_showQmlTestWidget(void) ...@@ -1371,22 +1375,3 @@ void MainWindow::_showQmlTestWidget(void)
new QmlTestWidget(); new QmlTestWidget();
} }
#endif #endif
// There is a bug in Qt where a Canvas element inside a QQuickWidget does not
// receive update requests. We hook into this event and notify the tool bar
// to update its canvas elements. If other QQuickWidgets start using Canvas
// and this bug is not fixed, this should be turned into a signal emited by
// MainWindow and the various QQuickWidgets that need it should connect to it.
bool MainWindow::event(QEvent* e)
{
bool result = true;
switch (e->type()) {
case QEvent::Paint:
result = QMainWindow::event(e);
_mainToolBar->updateCanvas();
return result;
default:
break;
}
return QMainWindow::event(e);
}
...@@ -205,6 +205,8 @@ signals: ...@@ -205,6 +205,8 @@ signals:
void initStatusChanged(const QString& message, int alignment, const QColor &color); void initStatusChanged(const QString& message, int alignment, const QColor &color);
/** Emitted when any value changes from any source */ /** Emitted when any value changes from any source */
void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec);
/** Emitted when any the Canvas elements within QML wudgets need updating */
void repaintCanvas();
#ifdef QGC_MOUSE_ENABLED_LINUX #ifdef QGC_MOUSE_ENABLED_LINUX
/** @brief Forward X11Event to catch 3DMouse inputs */ /** @brief Forward X11Event to catch 3DMouse inputs */
...@@ -219,8 +221,6 @@ public: ...@@ -219,8 +221,6 @@ public:
protected: protected:
bool event(QEvent *);
typedef enum _VIEW_SECTIONS typedef enum _VIEW_SECTIONS
{ {
VIEW_ENGINEER, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters VIEW_ENGINEER, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
......
...@@ -30,8 +30,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -30,8 +30,8 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine> #include <QQmlEngine>
#include "MainWindow.h"
#include "MainToolBar.h" #include "MainToolBar.h"
#include "MainWindow.h"
#include "UASMessageHandler.h" #include "UASMessageHandler.h"
#include "UASMessageView.h" #include "UASMessageView.h"
...@@ -55,7 +55,6 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -55,7 +55,6 @@ MainToolBar::MainToolBar(QWidget* parent)
, _currentNormalCount(0) , _currentNormalCount(0)
, _currentMessageType(MessageNone) , _currentMessageType(MessageNone)
, _satelliteCount(-1) , _satelliteCount(-1)
, _dotsPerInch(96.0) // Default to Windows as it's more likely not to report below
, _satelliteLock(0) , _satelliteLock(0)
, _showGPS(true) , _showGPS(true)
, _showMav(true) , _showMav(true)
...@@ -73,13 +72,6 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -73,13 +72,6 @@ MainToolBar::MainToolBar(QWidget* parent)
if(pl) { if(pl) {
pl->setContentsMargins(0,0,0,0); pl->setContentsMargins(0,0,0,0);
} }
// Get screen DPI to manage font sizes on different platforms
QScreen *srn = QGuiApplication::screens().at(0); // TODO: Find current monitor as opposed to picking first one
if(srn && srn->logicalDotsPerInch() > 50.0) {
_dotsPerInch = (qreal)srn->logicalDotsPerInch(); // Font point sizes are based on Mac 72dpi
} else {
qWarning() << "System not reporting logical DPI, which is used to compute the appropriate font size. The default being used is 96dpi. If the text within buttons and UI elements are too big or too small, that's the reason.";
}
// Tool Bar Preferences // Tool Bar Preferences
QSettings settings; QSettings settings;
...@@ -138,25 +130,25 @@ void MainToolBar::viewStateChanged(const QString &key, bool value) ...@@ -138,25 +130,25 @@ void MainToolBar::viewStateChanged(const QString &key, bool value)
void MainToolBar::onSetupView() void MainToolBar::onSetupView()
{ {
setCurrentView(ViewSetup); setCurrentView(MainWindow::VIEW_SETUP);
MainWindow::instance()->loadSetupView(); MainWindow::instance()->loadSetupView();
} }
void MainToolBar::onPlanView() void MainToolBar::onPlanView()
{ {
setCurrentView(ViewPlan); setCurrentView(MainWindow::VIEW_MISSION);
MainWindow::instance()->loadOperatorView(); MainWindow::instance()->loadOperatorView();
} }
void MainToolBar::onFlyView() void MainToolBar::onFlyView()
{ {
setCurrentView(ViewFly); setCurrentView(MainWindow::VIEW_FLIGHT);
MainWindow::instance()->loadPilotView(); MainWindow::instance()->loadPilotView();
} }
void MainToolBar::onAnalyzeView() void MainToolBar::onAnalyzeView()
{ {
setCurrentView(ViewAnalyze); setCurrentView(MainWindow::VIEW_ENGINEER);
MainWindow::instance()->loadEngineerView(); MainWindow::instance()->loadEngineerView();
} }
...@@ -655,8 +647,3 @@ void MainToolBar::_setSatLoc(UASInterface*, int fix) ...@@ -655,8 +647,3 @@ void MainToolBar::_setSatLoc(UASInterface*, int fix)
emit satelliteLockChanged(_satelliteLock); emit satelliteLockChanged(_satelliteLock);
} }
} }
void MainToolBar::updateCanvas()
{
emit repaintRequestedChanged();
}
...@@ -92,13 +92,11 @@ public: ...@@ -92,13 +92,11 @@ public:
Q_PROPERTY(QStringList connectedList READ connectedList NOTIFY connectedListChanged) Q_PROPERTY(QStringList connectedList READ connectedList NOTIFY connectedListChanged)
Q_PROPERTY(bool mavPresent READ mavPresent NOTIFY mavPresentChanged) Q_PROPERTY(bool mavPresent READ mavPresent NOTIFY mavPresentChanged)
Q_PROPERTY(QString currentState READ currentState NOTIFY currentStateChanged) Q_PROPERTY(QString currentState READ currentState NOTIFY currentStateChanged)
Q_PROPERTY(double dotsPerInch READ dotsPerInch NOTIFY dotsPerInchChanged)
Q_PROPERTY(int satelliteLock READ satelliteLock NOTIFY satelliteLockChanged) Q_PROPERTY(int satelliteLock READ satelliteLock NOTIFY satelliteLockChanged)
Q_PROPERTY(bool showGPS READ showGPS NOTIFY showGPSChanged) Q_PROPERTY(bool showGPS READ showGPS NOTIFY showGPSChanged)
Q_PROPERTY(bool showMav READ showMav NOTIFY showMavChanged) Q_PROPERTY(bool showMav READ showMav NOTIFY showMavChanged)
Q_PROPERTY(bool showMessages READ showMessages NOTIFY showMessagesChanged) Q_PROPERTY(bool showMessages READ showMessages NOTIFY showMessagesChanged)
Q_PROPERTY(bool showBattery READ showBattery NOTIFY showBatteryChanged) Q_PROPERTY(bool showBattery READ showBattery NOTIFY showBatteryChanged)
Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged)
int connectionCount () { return _connectionCount; } int connectionCount () { return _connectionCount; }
double batteryVoltage () { return _batteryVoltage; } double batteryVoltage () { return _batteryVoltage; }
...@@ -117,17 +115,14 @@ public: ...@@ -117,17 +115,14 @@ public:
QStringList connectedList () { return _connectedList; } QStringList connectedList () { return _connectedList; }
bool mavPresent () { return _mav != NULL; } bool mavPresent () { return _mav != NULL; }
QString currentState () { return _currentState; } QString currentState () { return _currentState; }
double dotsPerInch () { return _dotsPerInch; }
int satelliteLock () { return _satelliteLock; } int satelliteLock () { return _satelliteLock; }
bool showGPS () { return _showGPS; } bool showGPS () { return _showGPS; }
bool showMav () { return _showMav; } bool showMav () { return _showMav; }
bool showMessages () { return _showMessages; } bool showMessages () { return _showMessages; }
bool showBattery () { return _showBattery; } bool showBattery () { return _showBattery; }
bool repaintRequested () { return true; }
void setCurrentView (int currentView); void setCurrentView (int currentView);
void viewStateChanged (const QString& key, bool value); void viewStateChanged (const QString& key, bool value);
void updateCanvas ();
signals: signals:
void connectionCountChanged (int count); void connectionCountChanged (int count);
...@@ -147,13 +142,11 @@ signals: ...@@ -147,13 +142,11 @@ signals:
void connectedListChanged (QStringList connectedList); void connectedListChanged (QStringList connectedList);
void mavPresentChanged (bool present); void mavPresentChanged (bool present);
void currentStateChanged (QString state); void currentStateChanged (QString state);
void dotsPerInchChanged ();
void satelliteLockChanged (int lock); void satelliteLockChanged (int lock);
void showGPSChanged (bool value); void showGPSChanged (bool value);
void showMavChanged (bool value); void showMavChanged (bool value);
void showMessagesChanged (bool value); void showMessagesChanged (bool value);
void showBatteryChanged (bool value); void showBatteryChanged (bool value);
void repaintRequestedChanged ();
private slots: private slots:
void _setActiveUAS (UASInterface* active); void _setActiveUAS (UASInterface* active);
...@@ -205,7 +198,6 @@ private: ...@@ -205,7 +198,6 @@ private:
MessageType_t _currentMessageType; MessageType_t _currentMessageType;
int _satelliteCount; int _satelliteCount;
QStringList _connectedList; QStringList _connectedList;
qreal _dotsPerInch;
int _satelliteLock; int _satelliteLock;
bool _showGPS; bool _showGPS;
bool _showMav; bool _showMav;
......
...@@ -35,14 +35,16 @@ import QGroundControl.Controls 1.0 ...@@ -35,14 +35,16 @@ import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.MainToolBar 1.0 import QGroundControl.MainToolBar 1.0
import QGroundControl.ScreenTools 1.0
Rectangle { Rectangle {
property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true } property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
property ScreenTools screenTools: ScreenTools { }
property int cellSpacerSize: 4 property int cellSpacerSize: 4
property int cellHeight: 30 property int cellHeight: 30
property int cellRadius: 3 property int cellRadius: 3
property double dpiFactor: (72.0 / mainToolBar.dotsPerInch);
property var colorBlue: "#1a6eaa" property var colorBlue: "#1a6eaa"
property var colorGreen: "#079527" property var colorGreen: "#079527"
...@@ -133,13 +135,12 @@ Rectangle { ...@@ -133,13 +135,12 @@ Rectangle {
height: cellHeight height: cellHeight
spacing: -12 spacing: -12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Connections { Connections {
target: mainToolBar target: screenTools
onRepaintRequestedChanged: { onRepaintRequestedChanged: {
setupButton.repaintChevron = true; setupButton.repaintChevron = true;
planButton.repaintChevron = true; planButton.repaintChevron = true;
flyButton.repaintChevron = true; flyButton.repaintChevron = true;
analyzeButton.repaintChevron = true; analyzeButton.repaintChevron = true;
} }
} }
...@@ -240,7 +241,7 @@ Rectangle { ...@@ -240,7 +241,7 @@ Rectangle {
Text { Text {
id: messageText id: messageText
text: (mainToolBar.messageCount > 0) ? mainToolBar.messageCount : '' text: (mainToolBar.messageCount > 0) ? mainToolBar.messageCount : ''
font.pointSize: 14 * dpiFactor font.pointSize: 14 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -328,7 +329,7 @@ Rectangle { ...@@ -328,7 +329,7 @@ Rectangle {
Text { Text {
id: satelitteText id: satelitteText
text: (mainToolBar.satelliteCount > 0) ? mainToolBar.satelliteCount : '' text: (mainToolBar.satelliteCount > 0) ? mainToolBar.satelliteCount : ''
font.pointSize: 14 * dpiFactor font.pointSize: 14 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
...@@ -363,7 +364,7 @@ Rectangle { ...@@ -363,7 +364,7 @@ Rectangle {
Text { Text {
id: batteryText id: batteryText
text: mainToolBar.batteryVoltage.toFixed(1) + ' V'; text: mainToolBar.batteryVoltage.toFixed(1) + ' V';
font.pointSize: 14 * dpiFactor font.pointSize: 14 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
...@@ -391,7 +392,7 @@ Rectangle { ...@@ -391,7 +392,7 @@ Rectangle {
Text { Text {
id: armedStatusText id: armedStatusText
text: (mainToolBar.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED") text: (mainToolBar.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED")
font.pointSize: 12 * dpiFactor font.pointSize: 12 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (mainToolBar.systemArmed) ? colorOrangeText : colorGreenText color: (mainToolBar.systemArmed) ? colorOrangeText : colorGreenText
...@@ -410,7 +411,7 @@ Rectangle { ...@@ -410,7 +411,7 @@ Rectangle {
Text { Text {
id: stateStatusText id: stateStatusText
text: mainToolBar.currentState text: mainToolBar.currentState
font.pointSize: 12 * dpiFactor font.pointSize: 12 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.centerIn: parent anchors.centerIn: parent
color: (mainToolBar.currentState === "STANDBY") ? colorGreenText : colorRedText color: (mainToolBar.currentState === "STANDBY") ? colorGreenText : colorRedText
...@@ -431,7 +432,7 @@ Rectangle { ...@@ -431,7 +432,7 @@ Rectangle {
Text { Text {
id: modeStatusText id: modeStatusText
text: mainToolBar.currentMode text: mainToolBar.currentMode
font.pointSize: 12 * dpiFactor font.pointSize: 12 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -452,7 +453,7 @@ Rectangle { ...@@ -452,7 +453,7 @@ Rectangle {
Text { Text {
id: connectionStatusText id: connectionStatusText
text: qsTr("CONNECTION LOST") text: qsTr("CONNECTION LOST")
font.pointSize: 14 * dpiFactor font.pointSize: 14 * screenTools.dpiFactor
font.weight: Font.DemiBold font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
......
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