25 changed files with 739 additions and 136 deletions
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (c) 2009-2016 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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
#include "MotorComponent.h" |
||||
#include "APMAutoPilotPlugin.h" |
||||
#include "APMAirframeComponent.h" |
||||
|
||||
MotorComponent::MotorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : |
||||
VehicleComponent(vehicle, autopilot, parent), |
||||
_name(tr("Motors")) |
||||
{ |
||||
|
||||
} |
||||
|
||||
QString MotorComponent::name(void) const |
||||
{ |
||||
return _name; |
||||
} |
||||
|
||||
QString MotorComponent::description(void) const |
||||
{ |
||||
return tr("Motors Setup is used to manually test motor control and direction."); |
||||
} |
||||
|
||||
QString MotorComponent::iconResource(void) const |
||||
{ |
||||
return QStringLiteral("/qmlimages/MotorComponentIcon.png"); |
||||
} |
||||
|
||||
bool MotorComponent::requiresSetup(void) const |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool MotorComponent::setupComplete(void) const |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
QStringList MotorComponent::setupCompleteChangedTriggerList(void) const |
||||
{ |
||||
return QStringList(); |
||||
} |
||||
|
||||
QUrl MotorComponent::setupSource(void) const |
||||
{ |
||||
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/MotorComponent.qml")); |
||||
} |
||||
|
||||
QUrl MotorComponent::summaryQmlSource(void) const |
||||
{ |
||||
return QUrl(); |
||||
} |
||||
|
||||
QString MotorComponent::prerequisiteSetup(void) const |
||||
{ |
||||
return QString(); |
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (c) 2009-2016 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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
#ifndef MotorComponent_H |
||||
#define MotorComponent_H |
||||
|
||||
#include "VehicleComponent.h" |
||||
#include "Fact.h" |
||||
|
||||
class MotorComponent : public VehicleComponent |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
MotorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); |
||||
|
||||
// Virtuals from VehicleComponent
|
||||
QStringList setupCompleteChangedTriggerList(void) const final; |
||||
|
||||
// Virtuals from VehicleComponent
|
||||
QString name(void) const final; |
||||
QString description(void) const final; |
||||
QString iconResource(void) const final; |
||||
bool requiresSetup(void) const final; |
||||
bool setupComplete(void) const final; |
||||
QUrl setupSource(void) const final; |
||||
QUrl summaryQmlSource(void) const final; |
||||
QString prerequisiteSetup(void) const final; |
||||
|
||||
private: |
||||
const QString _name; |
||||
}; |
||||
|
||||
#endif |
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (c) 2009-2016 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.5 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Dialogs 1.2 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
SetupPage { |
||||
id: motorPage |
||||
pageComponent: pageComponent |
||||
|
||||
readonly property int _barHeight: 10 |
||||
readonly property int _barWidth: 5 |
||||
readonly property int _sliderHeight: 10 |
||||
|
||||
FactPanelController { |
||||
id: controller |
||||
factPanel: motorPage.viewPanel |
||||
} |
||||
|
||||
Component { |
||||
id: pageComponent |
||||
|
||||
Column { |
||||
spacing: 10 |
||||
|
||||
Row { |
||||
id: motorSliders |
||||
enabled: safetySwitch.checked |
||||
spacing: ScreenTools.defaultFontPixelWidth * 4 |
||||
|
||||
Repeater { |
||||
id: sliderRepeater |
||||
model: controller.vehicle.motorCount == -1 ? 8 : controller.vehicle.motorCount |
||||
|
||||
Column { |
||||
property alias motorSlider: slider |
||||
|
||||
Timer { |
||||
interval: 250 |
||||
running: true |
||||
repeat: true |
||||
|
||||
property real _lastValue: 0 |
||||
|
||||
onTriggered: { |
||||
if (_lastValue != slider.value) { |
||||
controller.vehicle.motorTest(index + 1, slider.value, 1) |
||||
} |
||||
} |
||||
} |
||||
|
||||
QGCLabel { |
||||
anchors.horizontalCenter: parent.horizontalCenter |
||||
text: index + 1 |
||||
} |
||||
|
||||
QGCSlider { |
||||
id: slider |
||||
height: ScreenTools.defaultFontPixelHeight * _sliderHeight |
||||
orientation: Qt.Vertical |
||||
maximumValue: 100 |
||||
value: 0 |
||||
} |
||||
} // Column |
||||
} // Repeater |
||||
|
||||
Column { |
||||
QGCLabel { |
||||
anchors.horizontalCenter: parent.horizontalCenter |
||||
text: qsTr("All") |
||||
} |
||||
|
||||
QGCSlider { |
||||
id: allSlider |
||||
height: ScreenTools.defaultFontPixelHeight * _sliderHeight |
||||
orientation: Qt.Vertical |
||||
maximumValue: 100 |
||||
value: 0 |
||||
|
||||
onValueChanged: { |
||||
for (var sliderIndex=0; sliderIndex<sliderRepeater.count; sliderIndex++) { |
||||
sliderRepeater.itemAt(sliderIndex).motorSlider.value = allSlider.value |
||||
} |
||||
} |
||||
} |
||||
} // Column |
||||
|
||||
MultiRotorMotorDisplay { |
||||
anchors.top: parent.top |
||||
anchors.bottom: parent.bottom |
||||
width: height |
||||
motorCount: controller.vehicle.motorCount |
||||
xConfig: controller.vehicle.xConfigMotors |
||||
coaxial: controller.vehicle.coaxialMotors |
||||
} |
||||
|
||||
MultiRotorMotorDisplayLegend { |
||||
anchors.top: parent.top |
||||
anchors.bottom: parent.bottom |
||||
width: height |
||||
} |
||||
} // Row |
||||
|
||||
QGCLabel { |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
wrapMode: Text.WordWrap |
||||
text: qsTr("Moving the sliders will causes the motors to spin. Make sure you remove all props.") |
||||
} |
||||
|
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
|
||||
Switch { |
||||
id: safetySwitch |
||||
onClicked: { |
||||
if (!checked) { |
||||
for (var sliderIndex=0; sliderIndex<sliderRepeater.count; sliderIndex++) { |
||||
sliderRepeater.itemAt(sliderIndex).motorSlider.value = 0 |
||||
} |
||||
allSlider.value = 0 |
||||
} |
||||
} |
||||
} |
||||
|
||||
QGCLabel { |
||||
color: qgcPal.warningText |
||||
text: qsTr("Propellors are removed - Enable motor sliders") |
||||
} |
||||
} // Row |
||||
} // Column |
||||
} // Component |
||||
} // SetupPahe |
After Width: | Height: | Size: 684 B |
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (c) 2009-2016 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.5 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Dialogs 1.2 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.FactControls 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Controllers 1.0 |
||||
|
||||
/// Base view control for all Setup pages |
||||
QGCView { |
||||
id: setupView |
||||
viewPanel: setupPanel |
||||
|
||||
property alias pageComponent: pageLoader.sourceComponent |
||||
|
||||
property real _margins: ScreenTools.defaultFontPixelHeight / 2 |
||||
|
||||
QGCPalette { id: qgcPal; colorGroupEnabled: setupPanel.enabled } |
||||
|
||||
QGCViewPanel { |
||||
id: setupPanel |
||||
anchors.fill: parent |
||||
|
||||
QGCFlickable { |
||||
anchors.fill: parent |
||||
contentWidth: pageLoader.item.x + pageLoader.item.width |
||||
contentHeight: pageLoader.item.y + pageLoader.item.height |
||||
clip: true |
||||
|
||||
Column { |
||||
id: headingColumn |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
spacing: _margins |
||||
|
||||
QGCLabel { |
||||
font.pointSize: ScreenTools.largeFontPointSize |
||||
text: vehicleComponent.name + " " + qsTr("Setup") |
||||
visible: !ScreenTools.isShortScreen |
||||
} |
||||
|
||||
QGCLabel { |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
wrapMode: Text.WordWrap |
||||
text: vehicleComponent.description |
||||
visible: !ScreenTools.isShortScreen |
||||
} |
||||
} |
||||
|
||||
Loader { |
||||
anchors.topMargin: _margins |
||||
anchors.top: headingColumn.bottom |
||||
id: pageLoader |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,122 +0,0 @@
@@ -1,122 +0,0 @@
|
||||
/**************************************************************************** |
||||
** |
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). |
||||
** Contact: http://www.qt-project.org/legal |
||||
** |
||||
** This file is part of the examples of the Qt Toolkit. |
||||
** |
||||
** $QT_BEGIN_LICENSE:BSD$ |
||||
** You may use this file under the terms of the BSD license as follows: |
||||
** |
||||
** "Redistribution and use in source and binary forms, with or without |
||||
** modification, are permitted provided that the following conditions are |
||||
** met: |
||||
** * Redistributions of source code must retain the above copyright |
||||
** notice, this list of conditions and the following disclaimer. |
||||
** * Redistributions in binary form must reproduce the above copyright |
||||
** notice, this list of conditions and the following disclaimer in |
||||
** the documentation and/or other materials provided with the |
||||
** distribution. |
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names |
||||
** of its contributors may be used to endorse or promote products derived |
||||
** from this software without specific prior written permission. |
||||
** |
||||
** |
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
||||
** |
||||
** $QT_END_LICENSE$ |
||||
** |
||||
****************************************************************************/ |
||||
|
||||
import QtQuick 2.1 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Item { |
||||
id: slider; |
||||
height: 12 |
||||
property real value // value is read/write. |
||||
property real minimum: 0 |
||||
property real maximum: 1 |
||||
property int length: width - handle.width |
||||
|
||||
Rectangle { |
||||
anchors.fill: parent |
||||
radius: ScreenTools.defaultFontPixelHeight * (0.5) |
||||
color: Qt.rgba(0,0,0,0.65); |
||||
} |
||||
|
||||
Rectangle { |
||||
anchors.left: parent.left |
||||
anchors.leftMargin: ScreenTools.defaultFontPixelHeight * (0.33) |
||||
radius: ScreenTools.defaultFontPixelHeight * (0.33) |
||||
height: ScreenTools.defaultFontPixelHeight * (0.33) |
||||
width: handle.x - x |
||||
color: "#69bb17" |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
|
||||
Rectangle { |
||||
id: labelRect |
||||
width: label.width |
||||
height: label.height + ScreenTools.defaultFontPixelHeight * (0.33) |
||||
radius: ScreenTools.defaultFontPixelHeight * (0.33) |
||||
smooth: true |
||||
color: Qt.rgba(1,1,1,0.75); |
||||
border.width: ScreenTools.defaultFontPixelHeight * (0.083) |
||||
border.color: Qt.rgba(0,0,0,0.45); |
||||
anchors.bottom: handle.top |
||||
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * (0.33) |
||||
visible: mouseRegion.pressed |
||||
x: Math.max(Math.min(handle.x + (handle.width - width ) / 2, slider.width - width), 0) |
||||
QGCLabel{ |
||||
id: label |
||||
color: "black" |
||||
text: slider.value.toFixed(2) |
||||
width: font.pointSize * 3.5 |
||||
anchors.horizontalCenter: labelRect.horizontalCenter |
||||
horizontalAlignment: Text.AlignHCenter |
||||
anchors.verticalCenter: labelRect.verticalCenter |
||||
} |
||||
} |
||||
|
||||
Rectangle { |
||||
id: handle; |
||||
smooth: true |
||||
width: ScreenTools.defaultFontPixelHeight * (2.16); |
||||
y: (slider.height - height) / 2; |
||||
x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum) |
||||
|
||||
height: width |
||||
radius: width / 2 |
||||
gradient: normalGradient |
||||
border.width: 2 |
||||
border.color: "white" |
||||
|
||||
Gradient { |
||||
id: normalGradient |
||||
GradientStop { position: 0.0; color: "#b0b0b0" } |
||||
GradientStop { position: 0.66; color: "#909090" } |
||||
GradientStop { position: 1.0; color: "#545454" } |
||||
} |
||||
|
||||
MouseArea { |
||||
id: mouseRegion |
||||
hoverEnabled: false |
||||
anchors.fill: parent; drag.target: parent |
||||
drag.axis: Drag.XAxis; drag.minimumX: 0; drag.maximumX: slider.length |
||||
preventStealing: true |
||||
onPositionChanged: { slider.value = (slider.maximum - slider.minimum) * handle.x / slider.length + slider.minimum; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,156 @@
@@ -0,0 +1,156 @@
|
||||
import QtQuick 2.2 |
||||
|
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Item { |
||||
id: motorRoot |
||||
|
||||
property int motorCount: 4 // Number of motors on vehicle |
||||
property bool xConfig: true // true: X configuration, false: Plus configuration |
||||
property bool coaxial: true // true: motors on top bottom of same arm, false: motors only on top of arm |
||||
|
||||
property bool _unsupportedConfig: motorCount == 3 || (motorCount == 6 && coaxial) // Tricopters NYI |
||||
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
||||
property real _rotorRadius: motorRoot.height / 8 |
||||
property int _motorsPerSide: motorCount / (coaxial ? 2 : 1) |
||||
|
||||
readonly property string _cwColor: "green" |
||||
readonly property string _ccwColor: "blue" |
||||
readonly property var _motorColors4Plus: [ _ccwColor, _cwColor ] |
||||
readonly property var _motorColors4X: [ _cwColor, _ccwColor ] |
||||
readonly property var _motorColors6: [ _cwColor, _ccwColor ] |
||||
readonly property var _motorColors8: [ _cwColor, _ccwColor ] |
||||
readonly property var _motorColors4Top: [ _cwColor, _ccwColor ] |
||||
readonly property var _motorColors4Bottom: [ _ccwColor, _cwColor ] |
||||
|
||||
readonly property var _motorNumbers4Plus: [ 1, 4, 2, 3 ] |
||||
readonly property var _motorNumbers4X: [ 4, 2, 3, 1 ] |
||||
readonly property var _motorNumbers6Plus: [ 6, 2, 3, 5, 1, 4 ] |
||||
readonly property var _motorNumbers6X: [ 1, 4, 6, 2, 3, 5 ] |
||||
readonly property var _motorNumbers8: [ 8, 4, 2, 6, 7, 5, 1, 3 ] |
||||
readonly property var _motorNumbers4Top: [ 4, 3, 2, 1 ] |
||||
readonly property var _motorNumbers4Bottom: [ 7, 8, 5, 6 ] |
||||
|
||||
Component.onCompleted: { |
||||
if (coaxial) { |
||||
topMotors.motorNumbers = _motorNumbers4Top |
||||
bottomMotors.motorNumbers = _motorNumbers4Bottom |
||||
} else { |
||||
switch (motorCount) { |
||||
case 4: |
||||
topMotors.motorNumbers = xConfig ? _motorNumbers4X : _motorNumbers4Plus |
||||
topMotors.motorColors = xConfig ? _motorColors4X : _motorColors4Plus |
||||
break |
||||
case 6: |
||||
topMotors.motorNumbers = xConfig ? _motorNumbers6X : _motorNumbers6Plus |
||||
topMotors.motorColors = _motorColors6 |
||||
break |
||||
default: |
||||
case 8: |
||||
topMotors.motorNumbers = _motorNumbers8 |
||||
topMotors.motorColors = _motorColors8 |
||||
break |
||||
} |
||||
bottomMotors.motorNumbers = _motorNumbers8 |
||||
} |
||||
} |
||||
|
||||
Component { |
||||
id: motorDisplayComponent |
||||
|
||||
Repeater { |
||||
id: motorRepeater |
||||
model: _motorsPerSide |
||||
|
||||
Item { |
||||
x: motorRepeater.width / 2 + _armXCenter - rotor.radius |
||||
y: motorRepeater.height / 2 + _armYCenter - rotor.radius |
||||
width: _rotorRadius * 2 |
||||
height: _rotorRadius * 2 |
||||
|
||||
property real _armOffsetRadians: ((2 * Math.PI) / _motorsPerSide) |
||||
property real _armOffsetIndexRadians: (_armOffsetRadians * index) + ((xConfig && _motorsPerSide != 6) || (!xConfig && _motorsPerSide == 6) ? _armOffsetRadians / 2 : 0) |
||||
property real _armLength: (motorRepeater.height / 2) - (_rotorRadius * (xConfig && _motorsPerSide == 4 ? 0 : 1)) |
||||
property real _armXCenter: Math.cos(_armOffsetIndexRadians) * _armLength // adjacent = cos * hypotenuse |
||||
property real _armYCenter: Math.sin(_armOffsetIndexRadians) * _armLength // opposite = sin * hypotenuse |
||||
|
||||
Rectangle {id: rotor |
||||
anchors.fill: parent |
||||
radius: _rotorRadius |
||||
color: motorColors[index & 1] |
||||
opacity: topCoaxial ? 0.65 : 1.0 |
||||
border.color: topCoaxial ? "black" : color |
||||
|
||||
readonly property bool topCoaxial: topMotors && coaxial |
||||
} |
||||
|
||||
Rectangle { |
||||
anchors.horizontalCenter: parent.horizontalCenter |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
width: radius *2 |
||||
height: radius *2 |
||||
radius: ScreenTools.defaultFontPixelHeight / 2 |
||||
color: "white" |
||||
border.color: "black" |
||||
|
||||
QGCLabel { |
||||
anchors.fill: parent |
||||
verticalAlignment: Text.AlignVCenter |
||||
horizontalAlignment: Text.AlignHCenter |
||||
text: motorNumbers[index] |
||||
color: parent.border.color |
||||
} |
||||
} |
||||
} // Item |
||||
} // Repeater |
||||
} // Component - MotorDisplayComponent |
||||
|
||||
Item { |
||||
anchors.fill: parent |
||||
visible: !_unsupportedConfig |
||||
|
||||
Loader { |
||||
id: bottomMotors |
||||
anchors.topMargin: ScreenTools.defaultFontPixelHeight |
||||
anchors.fill: parent |
||||
sourceComponent: motorDisplayComponent |
||||
visible: coaxial |
||||
|
||||
property bool topMotors: false |
||||
property var motorNumbers: _motorNumbers8 |
||||
property var motorColors: _motorColors4Bottom |
||||
} |
||||
|
||||
Loader { |
||||
id: topMotors |
||||
anchors.fill: parent |
||||
anchors.bottomMargin: coaxial ? ScreenTools.defaultFontPixelHeight : 0 |
||||
sourceComponent: motorDisplayComponent |
||||
|
||||
property bool topMotors: true |
||||
property var motorNumbers: _motorNumbers8 |
||||
property var motorColors: _motorColors4Top |
||||
} |
||||
|
||||
// Body direction |
||||
Canvas { |
||||
anchors.fill: parent |
||||
|
||||
property real _centerX : width / 2 |
||||
property real _centerY : height / 2 |
||||
|
||||
onPaint: { |
||||
var ctx = getContext("2d"); |
||||
ctx.lineWidth = 3 |
||||
ctx.strokeStyle = _qgcPal.text |
||||
ctx.translate(_centerX, _centerY) |
||||
ctx.moveTo(0, -_rotorRadius / 2); |
||||
ctx.lineTo(_rotorRadius / 2, _rotorRadius); |
||||
ctx.lineTo(-_rotorRadius / 2, _rotorRadius); |
||||
ctx.lineTo(0, -_rotorRadius / 2); |
||||
ctx.stroke(); |
||||
} |
||||
} |
||||
} // Item |
||||
} // Item |
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
import QtQuick 2.2 |
||||
|
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Item { |
||||
id: legendRoot |
||||
|
||||
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
||||
property real _rotorRadius: legendRoot.height / 16 |
||||
|
||||
readonly property string _cwColor: "green" |
||||
readonly property string _ccwColor: "blue" |
||||
|
||||
Item { |
||||
id: cwItem |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
height: legendRoot.height / 2 |
||||
|
||||
Rectangle { |
||||
id: cwRotor |
||||
anchors.left: parent.left |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
width: _rotorRadius * 2 |
||||
height: _rotorRadius * 2 |
||||
radius: _rotorRadius |
||||
color: _cwColor |
||||
} |
||||
|
||||
QGCLabel { |
||||
anchors.leftMargin: ScreenTools.defaultFontPixelWidth |
||||
anchors.left: cwRotor.right |
||||
anchors.right: parent.right |
||||
anchors.top: parent.top |
||||
anchors.bottom: parent.bottom |
||||
verticalAlignment: Text.AlignVCenter |
||||
wrapMode: Text.WordWrap |
||||
text: qsTr("Clockwise rotation, use pusher propellor") |
||||
} |
||||
} |
||||
|
||||
Item { |
||||
id: ccwItem |
||||
anchors.top: cwItem.bottom |
||||
anchors.bottom: parent.bottom |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
|
||||
Rectangle { |
||||
id: ccwRotor |
||||
anchors.left: parent.left |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
width: _rotorRadius * 2 |
||||
height: _rotorRadius * 2 |
||||
radius: _rotorRadius |
||||
color: _ccwColor |
||||
} |
||||
|
||||
QGCLabel { |
||||
anchors.leftMargin: ScreenTools.defaultFontPixelWidth |
||||
anchors.left: ccwRotor.right |
||||
anchors.right: parent.right |
||||
anchors.top: parent.top |
||||
anchors.bottom: parent.bottom |
||||
verticalAlignment: Text.AlignVCenter |
||||
wrapMode: Text.WordWrap |
||||
text: qsTr("Counter-Clockwise rotation, use normal propellor") |
||||
} |
||||
} |
||||
} // Item |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (c) 2009-2016 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.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Controls.Styles 1.2 |
||||
import QtQuick.Controls.Private 1.0 |
||||
|
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Slider { |
||||
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } |
||||
|
||||
style: SliderStyle { |
||||
groove: Item { |
||||
property color fillColor: "#49d" |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) |
||||
implicitHeight: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.3)) |
||||
|
||||
Rectangle { |
||||
radius: height/2 |
||||
anchors.fill: parent |
||||
border.width: 1 |
||||
border.color: "#888" |
||||
gradient: Gradient { |
||||
GradientStop { color: "#bbb" ; position: 0 } |
||||
GradientStop { color: "#ccc" ; position: 0.6 } |
||||
GradientStop { color: "#ccc" ; position: 1 } |
||||
} |
||||
} |
||||
|
||||
Item { |
||||
clip: true |
||||
width: styleData.handlePosition |
||||
height: parent.height |
||||
Rectangle { |
||||
anchors.fill: parent |
||||
border.color: Qt.darker(fillColor, 1.2) |
||||
radius: height/2 |
||||
gradient: Gradient { |
||||
GradientStop {color: Qt.lighter(fillColor, 1.3) ; position: 0} |
||||
GradientStop {color: fillColor ; position: 1.4} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue