diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index fbfaaab2cd9..f118b4003b0 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -334,6 +334,8 @@ const QVariantList& FirmwarePlugin::toolIndicators(const Vehicle*) QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RemoteIDIndicator.qml")), + QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/DayLightActions.qml")), + QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/NightLightActions.qml")), }); } return _toolIndicatorList; diff --git a/src/ui/toolbar/DayLightActions.qml b/src/ui/toolbar/DayLightActions.qml new file mode 100644 index 00000000000..4541ad5996f --- /dev/null +++ b/src/ui/toolbar/DayLightActions.qml @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * (c) 2009-2020 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.MultiVehicleManager 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 + +// Joystick Indicator +Item { + id: _root + width: joystickRow.width * 1.1 + anchors.top: parent.top + anchors.bottom: parent.bottom + + property bool showIndicator: true + property bool _joystickEnabled: globals.activeVehicle ? globals.activeVehicle.joystickEnabled : false + + Row { + id: lightRow + anchors.top: parent.top + anchors.bottom: parent.bottom + spacing: ScreenTools.defaultFontPixelWidth + + QGCColoredImage { + width: height + anchors.top: parent.top + anchors.bottom: parent.bottom + sourceSize.height: height + source: "/qmlimages/SimpleLight.png" + fillMode: Image.PreserveAspectFit + color: { + if(globals.activeVehicle && joystickManager.activeJoystick) { + if(globals.activeVehicle.joystickEnabled) { + // Everything ready to use joystick + return qgcPal.buttonText + } + // Joystick is not enabled in the joystick configuration page + return "yellow" + } + // Joystick not available or there is no active vehicle + return "red" + } + } + } +} diff --git a/src/ui/toolbar/Images/NightLight.png b/src/ui/toolbar/Images/NightLight.png new file mode 100644 index 00000000000..cf942817886 Binary files /dev/null and b/src/ui/toolbar/Images/NightLight.png differ diff --git a/src/ui/toolbar/Images/SimpleLight.png b/src/ui/toolbar/Images/SimpleLight.png new file mode 100644 index 00000000000..8cd15872d5c Binary files /dev/null and b/src/ui/toolbar/Images/SimpleLight.png differ diff --git a/src/ui/toolbar/NightLightActions.qml b/src/ui/toolbar/NightLightActions.qml new file mode 100644 index 00000000000..4541ad5996f --- /dev/null +++ b/src/ui/toolbar/NightLightActions.qml @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * (c) 2009-2020 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.MultiVehicleManager 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 + +// Joystick Indicator +Item { + id: _root + width: joystickRow.width * 1.1 + anchors.top: parent.top + anchors.bottom: parent.bottom + + property bool showIndicator: true + property bool _joystickEnabled: globals.activeVehicle ? globals.activeVehicle.joystickEnabled : false + + Row { + id: lightRow + anchors.top: parent.top + anchors.bottom: parent.bottom + spacing: ScreenTools.defaultFontPixelWidth + + QGCColoredImage { + width: height + anchors.top: parent.top + anchors.bottom: parent.bottom + sourceSize.height: height + source: "/qmlimages/SimpleLight.png" + fillMode: Image.PreserveAspectFit + color: { + if(globals.activeVehicle && joystickManager.activeJoystick) { + if(globals.activeVehicle.joystickEnabled) { + // Everything ready to use joystick + return qgcPal.buttonText + } + // Joystick is not enabled in the joystick configuration page + return "yellow" + } + // Joystick not available or there is no active vehicle + return "red" + } + } + } +}