Skip to content

Commit

Permalink
Add icons for lights. Implement simple and night light by default on …
Browse files Browse the repository at this point in the history
…main UI
  • Loading branch information
ViktorBraichenko committed May 27, 2024
1 parent 329a485 commit a94f907
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FirmwarePlugin/FirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
56 changes: 56 additions & 0 deletions src/ui/toolbar/DayLightActions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

import QtQuick 2.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"
}
}
}
}
Binary file added src/ui/toolbar/Images/NightLight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/ui/toolbar/Images/SimpleLight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions src/ui/toolbar/NightLightActions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

import QtQuick 2.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"
}
}
}
}

0 comments on commit a94f907

Please sign in to comment.