Browse Source
# Conflicts: # qgcresources.qrc # src/FlightDisplay/FlightDisplayView.qml # src/MissionManager/MissionController.cc # src/MissionManager/SurveyMissionItem.cc # src/MissionManager/SurveyMissionItem.h # src/PlanView/PlanView.qml # src/QGCApplication.cc # src/Settings/AppSettings.h # src/Vehicle/Vehicle.h Note that SurveyMissionItem (.h/.cc) was changed in such a way that all previous changes were lost. Dynamic computation of its bounding box is missing and needs to be added into whatever is now handling these.QGC4.4
343 changed files with 20733 additions and 4677 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
@@ -1 +1 @@
|
||||
Subproject commit 37d14af47d783eb516959cc10e4cf70d66e927c0 |
||||
Subproject commit 033fa8e7a4a75a0c3f17cea57e3be8966e05f770 |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,144 @@
@@ -0,0 +1,144 @@
|
||||
import QtQuick 2.3 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Dialogs 1.2 |
||||
|
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.FactSystem 1.0 |
||||
|
||||
Rectangle { |
||||
height: _itemHeight |
||||
width: _totalSlots * _itemWidth |
||||
color: qgcPal.textField |
||||
|
||||
property Fact fact: undefined |
||||
property int digitCount: 4 ///< The number of digits to show for each value |
||||
property int incrementSlots: 1 ///< The number of visible slots to left/right of center value |
||||
|
||||
property int _totalDigitCount: digitCount + 1 + fact.units.length |
||||
property real _margins: (ScreenTools.implicitTextFieldHeight - ScreenTools.defaultFontPixelHeight) / 2 |
||||
property real _increment: fact.increment |
||||
property real _value: fact.value |
||||
property int _decimalPlaces: fact.decimalPlaces |
||||
property string _units: fact.units |
||||
property real _prevValue: _value - _increment |
||||
property real _nextValue: _value + _increment |
||||
property real _itemWidth: (_totalDigitCount * ScreenTools.defaultFontPixelWidth) + (_margins * 2) |
||||
property real _itemHeight: ScreenTools.implicitTextFieldHeight |
||||
property var _valueModel |
||||
property int _totalSlots: (incrementSlots * 2) + 1 |
||||
property int _currentIndex: _totalSlots / 2 |
||||
property int _currentRelativeIndex: _currentIndex |
||||
property int _prevIncrementSlots: incrementSlots |
||||
property int _nextIncrementSlots: incrementSlots |
||||
property int _selectionWidth: 3 |
||||
property var _model: fact.valueSliderModel() |
||||
property var _fact: fact |
||||
|
||||
QGCPalette { id: qgcPal; colorGroupEnabled: parent.enabled } |
||||
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false } |
||||
|
||||
function firstVisibleIndex() { |
||||
return valueListView.contentX / _itemWidth |
||||
} |
||||
|
||||
function recalcRelativeIndex() { |
||||
_currentRelativeIndex = _currentIndex - firstVisibleIndex() |
||||
_prevIncrementSlots = _currentRelativeIndex |
||||
_nextIncrementSlots = _totalSlots - _currentRelativeIndex - 1 |
||||
} |
||||
|
||||
function reset() { |
||||
valueListView.positionViewAtIndex(0, ListView.Beginning) |
||||
_currentIndex = _model.resetInitialValue() |
||||
valueListView.positionViewAtIndex(_currentIndex, ListView.Center) |
||||
recalcRelativeIndex() |
||||
} |
||||
|
||||
Component.onCompleted: { |
||||
valueListView.maximumFlickVelocity = valueListView.maximumFlickVelocity / 2 |
||||
reset() |
||||
} |
||||
|
||||
Connections { |
||||
target: _fact |
||||
onValueChanged: reset() |
||||
} |
||||
|
||||
Component { |
||||
id: editDialogComponent |
||||
|
||||
ParameterEditorDialog { |
||||
fact: _fact |
||||
} |
||||
} |
||||
|
||||
QGCListView { |
||||
id: valueListView |
||||
anchors.fill: parent |
||||
orientation: ListView.Horizontal |
||||
snapMode: ListView.SnapToItem |
||||
clip: true |
||||
model: _model |
||||
|
||||
delegate: QGCLabel { |
||||
width: _itemWidth |
||||
height: _itemHeight |
||||
verticalAlignment: Text.AlignVCenter |
||||
horizontalAlignment: Text.AlignHCenter |
||||
text: value + " " + _units |
||||
color: qgcPal.textFieldText |
||||
|
||||
MouseArea { |
||||
anchors.fill: parent |
||||
onClicked: { |
||||
valueListView.focus = true |
||||
if (_currentIndex === index) { |
||||
qgcView.showDialog(editDialogComponent, qsTr("Value Details"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) |
||||
} else { |
||||
_currentIndex = index |
||||
valueListView.positionViewAtIndex(_currentIndex, ListView.Center) |
||||
recalcRelativeIndex() |
||||
fact.value = value |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
onMovementStarted: valueListView.focus = true |
||||
|
||||
onMovementEnded: { |
||||
_currentIndex = firstVisibleIndex() + _currentRelativeIndex |
||||
fact.value = _model.valueAtModelIndex(_currentIndex) |
||||
} |
||||
} |
||||
|
||||
Rectangle { |
||||
id: leftOverlay |
||||
width: _itemWidth * _prevIncrementSlots |
||||
height: _itemHeight |
||||
color: qgcPal.textField |
||||
opacity: 0.5 |
||||
} |
||||
|
||||
Rectangle { |
||||
width: _itemWidth * _nextIncrementSlots |
||||
height: _itemHeight |
||||
anchors.right: parent.right |
||||
color: qgcPal.textField |
||||
opacity: 0.5 |
||||
} |
||||
|
||||
Rectangle { |
||||
x: _currentRelativeIndex * _itemWidth - _borderWidth |
||||
y: -_borderWidth |
||||
width: _itemWidth + (_borderWidth * 2) |
||||
height: _itemHeight + (_borderWidth * 2) |
||||
border.width: _borderWidth |
||||
border.color: qgcPal.brandingBlue |
||||
color: "transparent" |
||||
|
||||
readonly property int _borderWidth: 3 |
||||
} |
||||
} |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#include "FactValidator.h" |
||||
|
||||
FactValidator::FactValidator(QObject* parent) : |
||||
QValidator(parent) |
||||
{ |
||||
|
||||
} |
||||
|
||||
void FactValidator::fixup(QString& input) const |
||||
{ |
||||
Q_UNUSED(input); |
||||
} |
||||
|
||||
FactValidator::State FactValidator::validate(QString& input, int& pos) const |
||||
{ |
||||
Q_UNUSED(input); |
||||
Q_UNUSED(pos); |
||||
|
||||
return Acceptable; |
||||
} |
@ -1,56 +0,0 @@
@@ -1,56 +0,0 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#ifndef FactValidator_H |
||||
#define FactValidator_H |
||||
|
||||
#include <QValidator> |
||||
|
||||
class Fact; |
||||
|
||||
/// QML Validator for Facts (Work In Progress)
|
||||
///
|
||||
/// The validator uses the FactMetaData to impose restrictions on the input. It is used as follows:
|
||||
/// @code{.unparsed}
|
||||
/// TextInput {
|
||||
/// validator: FactValidator { fact: parameters["RC_MAP_THROTTLE"]; }
|
||||
/// }
|
||||
/// @endcode
|
||||
class FactValidator : public QValidator |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
Q_PROPERTY(Fact* fact READ fact WRITE setFact) |
||||
|
||||
public: |
||||
FactValidator(QObject* parent = NULL); |
||||
|
||||
// Property system methods
|
||||
|
||||
/// Read accessor for fact property
|
||||
Fact* fact(void) { return _fact; } |
||||
|
||||
/// Write accessor for fact property
|
||||
void setFact(Fact* fact) { _fact = fact; } |
||||
|
||||
/// Override from QValidator
|
||||
virtual void fixup(QString& input) const; |
||||
|
||||
/// Override from QValidator
|
||||
virtual State validate(QString& input, int& pos) const; |
||||
|
||||
private: |
||||
Fact* _fact; ///< Fact that the validator is working on
|
||||
}; |
||||
|
||||
#endif |
@ -0,0 +1,128 @@
@@ -0,0 +1,128 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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 "FactValueSliderListModel.h" |
||||
|
||||
#include <QDebug> |
||||
#include <QQmlEngine> |
||||
#include <QtMath> |
||||
|
||||
#include <math.h> |
||||
|
||||
const int FactValueSliderListModel::_valueRole = Qt::UserRole; |
||||
const int FactValueSliderListModel::_valueIndexRole = Qt::UserRole + 1; |
||||
|
||||
FactValueSliderListModel::FactValueSliderListModel(Fact& fact, QObject* parent) |
||||
: QAbstractListModel (parent) |
||||
, _fact (fact) |
||||
, _cValues (0) |
||||
, _firstValueIndexInWindow (0) |
||||
, _initialValueIndex (0) |
||||
, _cPrevValues (0) |
||||
, _cNextValues (0) |
||||
, _initialValue (0) |
||||
, _initialValueRounded (0) |
||||
, _increment (0) |
||||
{ |
||||
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); |
||||
} |
||||
|
||||
FactValueSliderListModel::~FactValueSliderListModel() |
||||
{ |
||||
} |
||||
|
||||
int FactValueSliderListModel::resetInitialValue(void) |
||||
{ |
||||
if (_cValues > 0) { |
||||
// Remove any old rows
|
||||
beginRemoveRows(QModelIndex(), 0, _cValues - 1); |
||||
_cValues = 0; |
||||
endRemoveRows(); |
||||
} |
||||
|
||||
_initialValue = _fact.cookedValue().toDouble(); |
||||
_initialValueRounded = qRound(_initialValue); |
||||
if (qRound(_fact.rawIncrement()) == _fact.rawIncrement()) { |
||||
_increment = qRound(_fact.cookedIncrement()); |
||||
} else { |
||||
_increment = _fact.cookedIncrement(); |
||||
} |
||||
_cPrevValues = qMin((_initialValue - _fact.cookedMin().toDouble()), 1000.0) / _increment; |
||||
_cNextValues = qMin((_fact.cookedMax().toDouble() - _initialValue), 1000.0) / _increment; |
||||
_initialValueIndex = _cPrevValues; |
||||
|
||||
int totalValueCount = _cPrevValues + 1 + _cNextValues; |
||||
beginInsertRows(QModelIndex(), 0, totalValueCount - 1); |
||||
_cValues = totalValueCount; |
||||
endInsertRows(); |
||||
|
||||
return _initialValueIndex; |
||||
} |
||||
|
||||
int FactValueSliderListModel::rowCount(const QModelIndex& parent) const |
||||
{ |
||||
Q_UNUSED(parent); |
||||
|
||||
return _cValues; |
||||
} |
||||
|
||||
QVariant FactValueSliderListModel::data(const QModelIndex &index, int role) const |
||||
{ |
||||
Q_UNUSED(role); |
||||
|
||||
if (!index.isValid()) { |
||||
return QVariant(); |
||||
} |
||||
|
||||
int valueIndex = index.row(); |
||||
if (valueIndex >= _cValues) { |
||||
return QVariant(); |
||||
} |
||||
|
||||
if (role == _valueRole) { |
||||
double value; |
||||
int cIncrementCount = valueIndex - _initialValueIndex; |
||||
if (cIncrementCount == 0) { |
||||
value = _initialValue; |
||||
} else { |
||||
value = _initialValueRounded + (cIncrementCount * _increment); |
||||
} |
||||
double precision = qPow(10, _fact.decimalPlaces()); |
||||
double atPrecision = qRound(value * precision) / precision; |
||||
//qDebug() << value << precision << atPrecision << _fact.decimalPlaces() << _fact.name();
|
||||
return QVariant(atPrecision); |
||||
} else if (role == _valueIndexRole) { |
||||
return QVariant::fromValue(valueIndex); |
||||
} else { |
||||
return QVariant(); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
QHash<int, QByteArray> FactValueSliderListModel::roleNames(void) const |
||||
{ |
||||
QHash<int, QByteArray> hash; |
||||
|
||||
hash[_valueRole] = "value"; |
||||
hash[_valueIndexRole] = "valueIndex"; |
||||
|
||||
return hash; |
||||
} |
||||
|
||||
double FactValueSliderListModel::valueAtModelIndex(int index) |
||||
{ |
||||
return data(createIndex(index, 0), _valueRole).toDouble(); |
||||
|
||||
} |
||||
|
||||
int FactValueSliderListModel::valueIndexAtModelIndex(int index) |
||||
{ |
||||
return data(createIndex(index, 0), _valueIndexRole).toInt(); |
||||
} |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <QAbstractListModel> |
||||
|
||||
#include "Fact.h" |
||||
|
||||
/// Provides a list model of values for incrementing/decrementing the value of a Fact
|
||||
class FactValueSliderListModel : public QAbstractListModel |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
FactValueSliderListModel(Fact& fact, QObject* parent = NULL); |
||||
~FactValueSliderListModel(); |
||||
|
||||
Q_INVOKABLE int resetInitialValue(void); |
||||
Q_INVOKABLE double valueAtModelIndex(int index); |
||||
Q_INVOKABLE int valueIndexAtModelIndex(int index); |
||||
|
||||
private: |
||||
// Overrides from QAbstractListModel
|
||||
int rowCount(const QModelIndex & parent = QModelIndex()) const override; |
||||
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override; |
||||
QHash<int, QByteArray> roleNames(void) const override; |
||||
|
||||
Fact& _fact; |
||||
int _cValues; |
||||
int _firstValueIndexInWindow; |
||||
int _initialValueIndex; |
||||
int _cPrevValues; |
||||
int _cNextValues; |
||||
int _windowSize; |
||||
double _initialValue; |
||||
double _initialValueRounded; |
||||
double _increment; |
||||
|
||||
static const int _valueRole; |
||||
static const int _valueIndexRole; |
||||
}; |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue