25 changed files with 602 additions and 268 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QtQml.Models 2.12 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
|
||||
ToolStripActionList { |
||||
signal displayPreFlightChecklist |
||||
|
||||
model: [ |
||||
PreFlightCheckListShowAction { |
||||
onTriggered: displayPreFlightChecklist() |
||||
}, |
||||
GuidedActionTakeoff { |
||||
guidedController: guidedActionsController |
||||
}, |
||||
GuidedActionLand { |
||||
guidedController: guidedActionsController |
||||
}, |
||||
GuidedActionRTL { |
||||
guidedController: guidedActionsController |
||||
}, |
||||
GuidedActionPause { |
||||
guidedController: guidedActionsController |
||||
}, |
||||
GuidedActionActionList { |
||||
guidedController: guidedActionsController |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.FlightDisplay 1.0 |
||||
|
||||
GuidedToolStripAction { |
||||
text: guidedController.actionListTitle |
||||
iconSource: "/res/action.svg" |
||||
visible: guidedController.showActionList |
||||
enabled: true |
||||
actionID: guidedController.actionActionList |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.FlightDisplay 1.0 |
||||
|
||||
GuidedToolStripAction { |
||||
text: guidedController.landTitle |
||||
message: guidedController.landMessage |
||||
iconSource: "/res/land.svg" |
||||
visible: guidedController.showLand && !guidedController.showTakeoff |
||||
enabled: guidedController.showLand |
||||
actionID: guidedController.actionLand |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.FlightDisplay 1.0 |
||||
|
||||
GuidedToolStripAction { |
||||
text: guidedController.pauseTitle |
||||
iconSource: "/res/pause-mission.svg" |
||||
visible: guidedController.showPause |
||||
enabled: guidedController.showPause |
||||
actionID: guidedController.actionPause |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.FlightDisplay 1.0 |
||||
|
||||
GuidedToolStripAction { |
||||
text: guidedController.rtlTitle |
||||
iconSource: "/res/rtl.svg" |
||||
visible: true |
||||
enabled: guidedController.showRTL |
||||
actionID: guidedController.actionRTL |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.FlightDisplay 1.0 |
||||
|
||||
GuidedToolStripAction { |
||||
text: guidedController.takeoffTitle |
||||
iconSource: "/res/takeoff.svg" |
||||
visible: guidedController.showTakeoff || !guidedController.showLand |
||||
enabled: guidedController.showTakeoff |
||||
actionID: guidedController.actionTakeoff |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl.Controls 1.0 |
||||
|
||||
ToolStripAction { |
||||
property var guidedController |
||||
property int actionID |
||||
property string message |
||||
|
||||
onTriggered: { |
||||
guidedActionsController.closeAll() |
||||
if (actionID === -1) { |
||||
// FIXME: NYI |
||||
guidedActionList.model = _actionModel |
||||
guidedActionList.visible = true |
||||
} else { |
||||
guidedController.confirmAction(actionID) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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 QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
|
||||
ToolStripAction { |
||||
text: qsTr("Checklist") |
||||
iconSource: "/qmlimages/check.svg" |
||||
visible: _useChecklist |
||||
enabled: _useChecklist && _activeVehicle && !_activeVehicle.armed |
||||
|
||||
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
||||
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length |
||||
} |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
#include "ToolStripAction.h" |
||||
|
||||
ToolStripAction::ToolStripAction(QObject* parent) |
||||
: QObject(parent) |
||||
{ |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setEnabled(bool enabled) |
||||
{ |
||||
if (enabled != _enabled) { |
||||
_enabled = enabled; |
||||
emit enabledChanged(enabled); |
||||
} |
||||
} |
||||
|
||||
void ToolStripAction::setVisible(bool visible) |
||||
{ |
||||
if (visible != _visible) { |
||||
_visible = visible; |
||||
emit visibleChanged(visible); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setCheckable(bool checkable) |
||||
{ |
||||
if (checkable != _checkable) { |
||||
_checkable = checkable; |
||||
emit checkableChanged(checkable); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setChecked(bool checked) |
||||
{ |
||||
if (checked != _checked) { |
||||
_checked = checked; |
||||
emit checkedChanged(checked); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setShowAlternateIcon(bool showAlternateIcon) |
||||
{ |
||||
if (showAlternateIcon != _showAlternateIcon) { |
||||
_showAlternateIcon = showAlternateIcon; |
||||
emit showAlternateIconChanged(showAlternateIcon); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setText(const QString& text) |
||||
{ |
||||
if (text != _text) { |
||||
_text = text; |
||||
emit textChanged(text); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setIconSource(const QString& iconSource) |
||||
{ |
||||
if (iconSource != _iconSource) { |
||||
_iconSource = iconSource; |
||||
emit iconSourceChanged(iconSource); |
||||
} |
||||
|
||||
} |
||||
|
||||
void ToolStripAction::setAlternateIconSource(const QString& alternateIconSource) |
||||
{ |
||||
if (alternateIconSource != _alternateIconSource) { |
||||
_alternateIconSource = alternateIconSource; |
||||
emit alternateIconSourceChanged(alternateIconSource); |
||||
} |
||||
} |
||||
|
||||
void ToolStripAction::setDropPanelComponent(QQmlComponent* dropPanelComponent) |
||||
{ |
||||
_dropPanelComponent = dropPanelComponent; |
||||
emit dropPanelComponentChanged(); |
||||
} |
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <QObject> |
||||
#include <QVariant> |
||||
#include <QQmlComponent> |
||||
|
||||
class ToolStripAction : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
ToolStripAction(QObject* parent = nullptr); |
||||
|
||||
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) |
||||
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) |
||||
Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged) |
||||
Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY checkedChanged) |
||||
Q_PROPERTY(bool showAlternateIcon READ showAlternateIcon WRITE setShowAlternateIcon NOTIFY showAlternateIconChanged) |
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) |
||||
Q_PROPERTY(QString iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged) |
||||
Q_PROPERTY(QString alternateIconSource READ alternateIconSource WRITE setAlternateIconSource NOTIFY alternateIconSourceChanged) |
||||
Q_PROPERTY(QQmlComponent* dropPanelComponent READ dropPanelComponent WRITE setDropPanelComponent NOTIFY dropPanelComponentChanged) |
||||
|
||||
bool enabled (void) const { return _enabled; } |
||||
bool visible (void) const { return _visible; } |
||||
bool checkable (void) const { return _checkable; } |
||||
bool checked (void) const { return _checked; } |
||||
bool showAlternateIcon (void) const { return _showAlternateIcon; } |
||||
QString text (void) const { return _text; } |
||||
QString iconSource (void) const { return _iconSource; } |
||||
QString alternateIconSource (void) const { return _alternateIconSource; } |
||||
QQmlComponent* dropPanelComponent (void) const { return _dropPanelComponent; } |
||||
|
||||
void setEnabled (bool enabled); |
||||
void setVisible (bool visible); |
||||
void setCheckable (bool checkable); |
||||
void setChecked (bool checked); |
||||
void setShowAlternateIcon (bool showAlternateIcon); |
||||
void setText (const QString& text); |
||||
void setIconSource (const QString& iconSource); |
||||
void setAlternateIconSource (const QString& alternateIconSource); |
||||
void setDropPanelComponent (QQmlComponent* dropPanelComponent); |
||||
|
||||
signals: |
||||
void enabledChanged (bool enabled); |
||||
void visibleChanged (bool visible); |
||||
void checkableChanged (bool checkable); |
||||
void checkedChanged (bool checked); |
||||
void showAlternateIconChanged (bool showAlternateIcon); |
||||
void textChanged (QString text); |
||||
void iconSourceChanged (QString iconSource); |
||||
void alternateIconSourceChanged (QString alternateIconSource); |
||||
void triggered (QObject* source); |
||||
void dropPanelComponentChanged (void); |
||||
|
||||
protected: |
||||
bool _enabled = true; |
||||
bool _visible = true; |
||||
bool _checkable = false; |
||||
bool _checked = false; |
||||
bool _showAlternateIcon = false; |
||||
QString _text; |
||||
QString _iconSource; |
||||
QString _alternateIconSource; |
||||
QQmlComponent* _dropPanelComponent = nullptr; |
||||
}; |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
#include "ToolStripActionList.h" |
||||
|
||||
ToolStripActionList::ToolStripActionList(QObject* parent) |
||||
: QObject(parent) |
||||
{ |
||||
|
||||
} |
||||
|
||||
QQmlListProperty<QObject> ToolStripActionList::model(void) |
||||
{ |
||||
return QQmlListProperty<QObject>(this, this, |
||||
&ToolStripActionList::append, |
||||
&ToolStripActionList::count, |
||||
&ToolStripActionList::at, |
||||
&ToolStripActionList::clear); |
||||
} |
||||
|
||||
void ToolStripActionList::append(QQmlListProperty<QObject>* qmlListProperty, QObject* value) { |
||||
reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.append(value); |
||||
} |
||||
|
||||
void ToolStripActionList::clear(QQmlListProperty<QObject>* qmlListProperty) { |
||||
reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.clear(); |
||||
} |
||||
|
||||
QObject* ToolStripActionList::at(QQmlListProperty<QObject>* qmlListProperty, int index) { |
||||
return reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList[index]; |
||||
} |
||||
|
||||
int ToolStripActionList::count(QQmlListProperty<QObject>* qmlListProperty) { |
||||
return reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.count(); |
||||
} |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <QObject> |
||||
#include <QQmlListProperty> |
||||
|
||||
class ToolStripActionList : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
ToolStripActionList(QObject* parent = nullptr); |
||||
|
||||
Q_PROPERTY(QQmlListProperty<QObject> model READ model NOTIFY modelChanged) |
||||
|
||||
QQmlListProperty<QObject> model(); |
||||
|
||||
signals: |
||||
void modelChanged(void); |
||||
|
||||
private: |
||||
static void append (QQmlListProperty<QObject>* qmlListProperty, QObject* value); |
||||
static int count (QQmlListProperty<QObject>* qmlListProperty); |
||||
static QObject* at (QQmlListProperty<QObject>*, int index); |
||||
static void clear (QQmlListProperty<QObject>* qmlListProperty); |
||||
|
||||
QList<QObject*> _objectList; |
||||
}; |
Loading…
Reference in new issue