Custom Actions are now Mavlink Actions

This reduces confusion with custom build functionality
This commit is contained in:
Don Gagne
2025-01-19 13:36:11 -08:00
committed by Don Gagne
parent fcaa13ea12
commit 218d377994
25 changed files with 108 additions and 129 deletions
+1
View File
@@ -10,6 +10,7 @@ Note: This file only contains high level features or important fixes.
* Added functionality for setting individual MAVLink message rates in the MAVLink Inspector.
* Enabled support for MAVLink 2 signing.
* Dynamic battery display that reduces the number of bars based on battery percentage, with configurable states (100%, Config 1, Config 2, Low, Critical) for clearer status indication.
* Custom Actions changed to Mavlink Actions. The location of the actions json files has changes to the "Mavlink Actions" directory. If you were using the previous "Custom Actions" directory, move you json files to the new location.
## 4.1
+1 -1
View File
@@ -355,7 +355,7 @@
<file alias="CameraSection.FactMetaData.json">../src/MissionManager/CameraSection.FactMetaData.json</file>
<file alias="CameraSpec.FactMetaData.json">../src/MissionManager/CameraSpec.FactMetaData.json</file>
<file alias="CorridorScan.SettingsGroup.json">../src/MissionManager/CorridorScan.SettingsGroup.json</file>
<file alias="CustomMavlinkActions.SettingsGroup.json">../src/Settings/CustomMavlinkActions.SettingsGroup.json</file>
<file alias="MavlinkActions.SettingsGroup.json">../src/Settings/MavlinkActions.SettingsGroup.json</file>
<file alias="RemoteID.SettingsGroup.json">../src/Settings/RemoteID.SettingsGroup.json</file>
<file alias="EditPositionDialog.FactMetaData.json">../src/QmlControls/EditPositionDialog.FactMetaData.json</file>
<file alias="FirmwareUpgrade.SettingsGroup.json">../src/Settings/FirmwareUpgrade.SettingsGroup.json</file>
+1 -1
View File
@@ -8,7 +8,7 @@
- [Fly](qgc-user-guide/fly_view/fly_view.md)
- [Replay Flight Data](qgc-user-guide/fly_view/replay_flight_data.md)
- [Video Overlay](qgc-user-guide/fly_view/video_overlay.md)
- [Custom Mavlink Actions](qgc-user-guide/custom_actions/custom_actions.md)
- [Mavlink Actions](qgc-user-guide/custom_actions/custom_actions.md)
- [3D View](qgc-user-guide/viewer_3d/viewer_3d.md)
- [Plan](qgc-user-guide/plan_view/plan_view.md)
- [GeoFence](qgc-user-guide/plan_view/plan_geofence.md)
@@ -2,14 +2,14 @@
Both the Fly View and Joysticks support the ability execute arbitrary mavlink commands to the active vehicle. In the Fly View these will show up in the Toolstrip Action list. With Joysticks you can assign then to button presses.
## Custom Actions File
## Mavlink Actions File
The custom actions available are defined in a JSON file. The format of that file is as follows:
The actions available are defined in a JSON file. The format of that file is as follows:
```
{
"version": 1,
"fileType": "CustomActions",
"fileType": "MavlinkActions",
"actions":
[
{
@@ -39,8 +39,6 @@ Fields:
* compId (options) - The component id for where you want to send the command to. If not specified `MAV_COMP_ID_AUTOPILOT1` is used.
* param1 thru param7 (optional) - The parameters for the command. Parameters which are not specified will default to 0.0
Custom action files should be located in the CustomActions directory of the QGC save location. For example on Linux that would be `~/Documents/QGroundControl/CustomActions` or `~/Documents/QGroundControl Daily/CustomActions`. The Fly View and Joysticks each have there own custom actions files:
* Fly View - FlyViewCustomActions.json
* Joystick - JoystickCustomActions.json
Mavlink action files should be located in the MavlinkActions directory of the QGC save location. For example on Linux that would be `~/Documents/QGroundControl/MavlinkActions` or `~/Documents/QGroundControl Daily/MavlinkActions`. The Fly View and Joysticks can each have there own custom actions file.
When you start up QGC it will load these files if they exist and make the commands available for use.
+1 -1
View File
@@ -363,7 +363,7 @@
<file alias="CameraSection.FactMetaData.json">src/MissionManager/CameraSection.FactMetaData.json</file>
<file alias="CameraSpec.FactMetaData.json">src/MissionManager/CameraSpec.FactMetaData.json</file>
<file alias="CorridorScan.SettingsGroup.json">src/MissionManager/CorridorScan.SettingsGroup.json</file>
<file alias="CustomMavlinkActions.SettingsGroup.json">src/Settings/CustomMavlinkActions.SettingsGroup.json</file>
<file alias="MavlinkActions.SettingsGroup.json">src/Settings/MavlinkActions.SettingsGroup.json</file>
<file alias="RemoteID.SettingsGroup.json">src/Settings/RemoteID.SettingsGroup.json</file>
<file alias="EditPositionDialog.FactMetaData.json">src/QmlControls/EditPositionDialog.FactMetaData.json</file>
<file alias="FirmwareUpgrade.SettingsGroup.json">src/Settings/FirmwareUpgrade.SettingsGroup.json</file>
+3 -3
View File
@@ -79,11 +79,11 @@ Rectangle {
}
]
property var _customManager: CustomActionManager {
MavlinkActionManager {
id: customManager
actionFileNameFact: QGroundControl.settingsManager.customMavlinkActionsSettings.flyViewActionsFile
actionFileNameFact: QGroundControl.settingsManager.mavlinkActionsSettings.flyViewActionsFile
}
readonly property bool hasCustomActions: customManager.actions.count > 0
readonly property bool hasMavlinkActions: customManager.actions.count > 0
QGCPalette { id: qgcPal }
@@ -159,7 +159,7 @@ Item {
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
property bool showSetHome: _guidedActionsEnabled
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort || actionList.hasCustomActions)
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort || actionList.hasMavlinkActions)
property bool showGripper: _initialConnectComplete ? _activeVehicle.hasGripper : false
property bool showSetEstimatorOrigin: _activeVehicle && !(_activeVehicle.sensorsPresentBits & Vehicle.SysStatusSensorGPS)
property bool showChangeHeading: _guidedActionsEnabled && _vehicleFlying
+11 -11
View File
@@ -9,9 +9,9 @@
#include "Joystick.h"
#include "CustomAction.h"
#include "CustomActionManager.h"
#include "CustomMavlinkActionsSettings.h"
#include "MavlinkAction.h"
#include "MavlinkActionManager.h"
#include "MavlinkActionsSettings.h"
#include "FirmwarePlugin.h"
#include "GimbalController.h"
#include "MultiVehicleManager.h"
@@ -58,7 +58,7 @@ Joystick::Joystick(const QString &name, int axisCount, int buttonCount, int hatC
, _rgAxisValues(new int[static_cast<size_t>(_axisCount)])
, _rgCalibration(new Calibration_t[static_cast<size_t>(_axisCount)])
, _rgButtonValues(new uint8_t[static_cast<size_t>(_totalButtonCount)])
, _customActionManager(new CustomActionManager(SettingsManager::instance()->customMavlinkActionsSettings()->joystickActionsFile(), this))
, _mavlinkActionManager(new MavlinkActionManager(SettingsManager::instance()->mavlinkActionsSettings()->joystickActionsFile(), this))
, _assignableButtonActions(new QmlObjectListModel(this))
{
// qCDebug(JoystickLog) << Q_FUNC_INFO << this;
@@ -1101,10 +1101,10 @@ void Joystick::_executeButtonAction(const QString &action, bool buttonDown)
} else {
if (buttonDown && _activeVehicle) {
emit unknownAction(action);
for (int i = 0; i<_customActionManager->actions()->count(); i++) {
CustomAction *const customAction = _customActionManager->actions()->value<CustomAction*>(i);
if (action == customAction->label()) {
customAction->sendTo(_activeVehicle);
for (int i = 0; i<_mavlinkActionManager->actions()->count(); i++) {
MavlinkAction *const mavlinkAction = _mavlinkActionManager->actions()->value<MavlinkAction*>(i);
if (action == mavlinkAction->label()) {
mavlinkAction->sendTo(_activeVehicle);
return;
}
}
@@ -1194,9 +1194,9 @@ void Joystick::_buildActionList(Vehicle *activeVehicle)
_assignableButtonActions->append(new AssignableButtonAction(action.name, action.canRepeat));
}
for (int i = 0; i < _customActionManager->actions()->count(); i++) {
const CustomAction *const customAction = _customActionManager->actions()->value<const CustomAction*>(i);
_assignableButtonActions->append(new AssignableButtonAction(customAction->label()));
for (int i = 0; i < _mavlinkActionManager->actions()->count(); i++) {
const MavlinkAction *const mavlinkAction = _mavlinkActionManager->actions()->value<const MavlinkAction*>(i);
_assignableButtonActions->append(new AssignableButtonAction(mavlinkAction->label()));
}
for (int i = 0; i < _assignableButtonActions->count(); i++) {
+2 -2
View File
@@ -19,7 +19,7 @@
Q_DECLARE_LOGGING_CATEGORY(JoystickLog)
Q_DECLARE_LOGGING_CATEGORY(JoystickValuesLog)
class CustomActionManager;
class MavlinkActionManager;
class QmlObjectListModel;
class Vehicle;
@@ -274,7 +274,7 @@ private:
int *_rgAxisValues = nullptr;
Calibration_t *_rgCalibration = nullptr;
uint8_t *_rgButtonValues = nullptr;
CustomActionManager *_customActionManager = nullptr;
MavlinkActionManager *_mavlinkActionManager = nullptr;
QmlObjectListModel *_assignableButtonActions = nullptr;
bool _accumulator = false;
+4 -4
View File
@@ -3,10 +3,10 @@ find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Location Positioning Qm
qt_add_library(QmlControls STATIC
AppMessages.cc
AppMessages.h
CustomAction.cc
CustomAction.h
CustomActionManager.cc
CustomActionManager.h
MavlinkAction.cc
MavlinkAction.h
MavlinkActionManager.cc
MavlinkActionManager.h
EditPositionDialogController.cc
EditPositionDialogController.h
FactValueGrid.cc
-22
View File
@@ -1,22 +0,0 @@
{
"version": 1,
"fileType": "CustomActions",
"actions": [
{
"label": "Image Start Capture",
"mavCmd": 2000,
"compId": 1,
"param1": 0,
"param2": 0,
"param3": 0,
"param4": 0,
"param5": 0,
"param6": 0,
"param7": 0
},
{
"label": "Image Stop Capture",
"mavCmd": 2001
}
]
}
@@ -7,19 +7,19 @@
*
****************************************************************************/
#include "CustomAction.h"
#include "MavlinkAction.h"
#include "Vehicle.h"
#include "QGCLoggingCategory.h"
QGC_LOGGING_CATEGORY(CustomActionLog, "qgc.qmlcontrols.customaction")
QGC_LOGGING_CATEGORY(MavlinkActionLog, "qgc.qmlcontrols.mavlinkaction")
CustomAction::CustomAction(QObject *parent)
MavlinkAction::MavlinkAction(QObject *parent)
: QObject(parent)
{
// qCDebug(CustomActionLog) << Q_FUNC_INFO << this;
// qCDebug(MavlinkActionLog) << Q_FUNC_INFO << this;
}
CustomAction::CustomAction(
MavlinkAction::MavlinkAction(
const QString &label,
const QString &description,
MAV_CMD mavCmd,
@@ -39,15 +39,15 @@ CustomAction::CustomAction(
, _compId(compId)
, _params{ param1, param2, param3, param4, param5, param6, param7 }
{
// qCDebug(CustomActionLog) << Q_FUNC_INFO << this;
// qCDebug(MavlinkActionLog) << Q_FUNC_INFO << this;
};
CustomAction::~CustomAction()
MavlinkAction::~MavlinkAction()
{
// qCDebug(CustomActionLog) << Q_FUNC_INFO << this;
// qCDebug(MavlinkActionLog) << Q_FUNC_INFO << this;
}
void CustomAction::sendTo(Vehicle *vehicle)
void MavlinkAction::sendTo(Vehicle *vehicle)
{
if (vehicle) {
const bool showError = true;
@@ -15,11 +15,11 @@
#include <QtCore/QObject>
#include <QtQmlIntegration/QtQmlIntegration>
Q_DECLARE_LOGGING_CATEGORY(CustomActionLog)
Q_DECLARE_LOGGING_CATEGORY(MavlinkActionLog)
class Vehicle;
class CustomAction: public QObject
class MavlinkAction: public QObject
{
Q_OBJECT
QML_ELEMENT
@@ -28,8 +28,8 @@ class CustomAction: public QObject
Q_PROPERTY(QString description READ description CONSTANT)
public:
explicit CustomAction(QObject *parent = nullptr);
CustomAction(
explicit MavlinkAction(QObject *parent = nullptr);
MavlinkAction(
const QString &label,
const QString &description,
MAV_CMD mavCmd,
@@ -43,7 +43,7 @@ public:
float param7,
QObject *parent = nullptr
);
~CustomAction();
~MavlinkAction();
Q_INVOKABLE void sendTo(Vehicle *vehicle);
@@ -7,8 +7,8 @@
*
****************************************************************************/
#include "CustomActionManager.h"
#include "CustomAction.h"
#include "MavlinkActionManager.h"
#include "MavlinkAction.h"
#include "Fact.h"
#include "JsonHelper.h"
#include "QGCApplication.h"
@@ -21,37 +21,37 @@
#include <QtCore/QJsonArray>
#include <QtQml/QQmlEngine>
QGC_LOGGING_CATEGORY(CustomActionManagerLog, "qgc.qmlcontrols.customactionmanager")
QGC_LOGGING_CATEGORY(MavlinkActionManagerLog, "qgc.qmlcontrols.mavlinkactionmanager")
CustomActionManager::CustomActionManager(QObject *parent)
MavlinkActionManager::MavlinkActionManager(QObject *parent)
: QObject(parent)
, _actions(new QmlObjectListModel(this))
{
// qCDebug(CustomActionManagerLog) << Q_FUNC_INFO << this;
// qCDebug(MavlinkActionManagerLog) << Q_FUNC_INFO << this;
}
CustomActionManager::CustomActionManager(Fact *actionFileNameFact, QObject *parent)
MavlinkActionManager::MavlinkActionManager(Fact *actionFileNameFact, QObject *parent)
: QObject(parent)
, _actions(new QmlObjectListModel(this))
{
setActionFileNameFact(actionFileNameFact);
}
CustomActionManager::~CustomActionManager()
MavlinkActionManager::~MavlinkActionManager()
{
// qCDebug(CustomActionManagerLog) << Q_FUNC_INFO << this;
// qCDebug(MavlinkActionManagerLog) << Q_FUNC_INFO << this;
}
void CustomActionManager::setActionFileNameFact(Fact *actionFileNameFact)
void MavlinkActionManager::setActionFileNameFact(Fact *actionFileNameFact)
{
_actionFileNameFact = actionFileNameFact;
emit actionFileNameFactChanged();
(void) connect(_actionFileNameFact, &Fact::rawValueChanged, this, &CustomActionManager::_loadActionsFile);
(void) connect(_actionFileNameFact, &Fact::rawValueChanged, this, &MavlinkActionManager::_loadActionsFile);
_loadActionsFile();
}
void CustomActionManager::_loadActionsFile()
void MavlinkActionManager::_loadActionsFile()
{
_actions->clearAndDeleteContents();
const QString actionFileName = _actionFileNameFact->rawValue().toString();
@@ -60,7 +60,7 @@ void CustomActionManager::_loadActionsFile()
}
// Custom actions are always loaded from the custom actions save path
const QString savePath = SettingsManager::instance()->appSettings()->customActionsSavePath();
const QString savePath = SettingsManager::instance()->appSettings()->mavlinkActionsSavePath();
const QDir saveDir = QDir(savePath);
const QString fullPath = saveDir.absoluteFilePath(actionFileName);
@@ -70,7 +70,7 @@ void CustomActionManager::_loadActionsFile()
return;
}
constexpr const char *kQgcFileType = "CustomActions";
constexpr const char *kQgcFileType = "MavlinkActions";
constexpr const char *kActionListKey = "actions";
_actions->clearAndDeleteContents();
@@ -133,7 +133,7 @@ void CustomActionManager::_loadActionsFile()
const auto param6 = actionObj["param6"].toDouble(0.0);
const auto param7 = actionObj["param7"].toDouble(0.0);
CustomAction *const action = new CustomAction(label, description, mavCmd, compId, param1, param2, param3, param4, param5, param6, param7, this);
MavlinkAction *const action = new MavlinkAction(label, description, mavCmd, compId, param1, param2, param3, param4, param5, param6, param7, this);
QQmlEngine::setObjectOwnership(action, QQmlEngine::CppOwnership);
(void) _actions->append(action);
}
@@ -13,15 +13,15 @@
#include <QtCore/QObject>
#include <QtQmlIntegration/QtQmlIntegration>
Q_DECLARE_LOGGING_CATEGORY(CustomActionManagerLog)
Q_DECLARE_LOGGING_CATEGORY(MavlinkActionManagerLog)
class Fact;
class QmlObjectListModel;
/// Loads the specified action file and provides access to the actions it contains.
/// Action files are loaded from the default CustomActions directory.
/// Action files are loaded from the default MavlinkActions directory.
/// The actions file name is filename only, no path.
class CustomActionManager : public QObject
class MavlinkActionManager : public QObject
{
Q_OBJECT
QML_ELEMENT
@@ -31,9 +31,9 @@ class CustomActionManager : public QObject
Q_PROPERTY(QmlObjectListModel* actions READ actions CONSTANT)
public:
explicit CustomActionManager(QObject *parent = nullptr);
explicit CustomActionManager(Fact *actionFileNameFact, QObject *parent = nullptr);
~CustomActionManager();
explicit MavlinkActionManager(QObject *parent = nullptr);
explicit MavlinkActionManager(Fact *actionFileNameFact, QObject *parent = nullptr);
~MavlinkActionManager();
Fact *actionFileNameFact() { return _actionFileNameFact; }
void setActionFileNameFact(Fact *actionFileNameFact);
+4 -4
View File
@@ -27,8 +27,8 @@
#include "QGCGeoBoundingCube.h"
#include "QGCMapPolygon.h"
#include "QGCMapCircle.h"
#include "CustomAction.h"
#include "CustomActionManager.h"
#include "MavlinkAction.h"
#include "MavlinkActionManager.h"
#include "EditPositionDialogController.h"
#include "ParameterEditorController.h"
#include "QGCFileDialogController.h"
@@ -84,8 +84,8 @@ void QGroundControlQmlGlobal::registerQmlTypes()
qmlRegisterUncreatableType<QGCMapPolygon> ("QGroundControl.FlightMap", 1, 0, "QGCMapPolygon", "Reference only");
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only");
qmlRegisterType<CustomAction> ("QGroundControl.Controllers", 1, 0, "CustomAction");
qmlRegisterType<CustomActionManager> ("QGroundControl.Controllers", 1, 0, "CustomActionManager");
qmlRegisterType<MavlinkAction> ("QGroundControl.Controllers", 1, 0, "MavlinkAction");
qmlRegisterType<MavlinkActionManager> ("QGroundControl.Controllers", 1, 0, "MavlinkActionManager");
qmlRegisterType<EditPositionDialogController> ("QGroundControl.Controllers", 1, 0, "EditPositionDialogController");
qmlRegisterType<HorizontalFactValueGrid> ("QGroundControl.Templates", 1, 0, "HorizontalFactValueGrid");
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
+3 -3
View File
@@ -257,7 +257,7 @@ void AppSettings::_checkSavePathDirectories(void)
savePathDir.mkdir(videoDirectory);
savePathDir.mkdir(photoDirectory);
savePathDir.mkdir(crashDirectory);
savePathDir.mkdir(customActionsDirectory);
savePathDir.mkdir(mavlinkActionsDirectory);
}
}
@@ -341,12 +341,12 @@ QString AppSettings::crashSavePath(void)
return QString();
}
QString AppSettings::customActionsSavePath(void)
QString AppSettings::mavlinkActionsSavePath(void)
{
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(customActionsDirectory);
return dir.filePath(mavlinkActionsDirectory);
}
return QString();
}
+3 -3
View File
@@ -73,7 +73,7 @@ public:
Q_PROPERTY(QString videoSavePath READ videoSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString photoSavePath READ photoSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString crashSavePath READ crashSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString customActionsSavePath READ customActionsSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString mavlinkActionsSavePath READ mavlinkActionsSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString planFileExtension MEMBER planFileExtension CONSTANT)
Q_PROPERTY(QString missionFileExtension MEMBER missionFileExtension CONSTANT)
@@ -92,7 +92,7 @@ public:
QString videoSavePath ();
QString photoSavePath ();
QString crashSavePath ();
QString customActionsSavePath ();
QString mavlinkActionsSavePath ();
// Helper methods for working with firstRunPromptIds QVariant settings string list
static QList<int> firstRunPromptsIdsVariantToList (const QVariant& firstRunPromptIds);
@@ -120,7 +120,7 @@ public:
static constexpr const char* videoDirectory = QT_TRANSLATE_NOOP("AppSettings", "Video");
static constexpr const char* photoDirectory = QT_TRANSLATE_NOOP("AppSettings", "Photo");
static constexpr const char* crashDirectory = QT_TRANSLATE_NOOP("AppSettings", "CrashLogs");
static constexpr const char* customActionsDirectory = QT_TRANSLATE_NOOP("AppSettings", "CustomActions");
static constexpr const char* mavlinkActionsDirectory = QT_TRANSLATE_NOOP("AppSettings", "MavlinkActions");
signals:
void savePathsChanged();
+2 -2
View File
@@ -13,8 +13,8 @@ qt_add_library(Settings STATIC
BatteryIndicatorSettings.h
BrandImageSettings.cc
BrandImageSettings.h
CustomMavlinkActionsSettings.cc
CustomMavlinkActionsSettings.h
MavlinkActionsSettings.cc
MavlinkActionsSettings.h
FirmwareUpgradeSettings.cc
FirmwareUpgradeSettings.h
FlightMapSettings.cc
@@ -7,18 +7,18 @@
*
****************************************************************************/
#include "CustomMavlinkActionsSettings.h"
#include "MavlinkActionsSettings.h"
#include "QGCApplication.h"
#include <QtQml/QQmlEngine>
#include <QtCore/QFile>
#include <QtCore/QSettings>
DECLARE_SETTINGGROUP(CustomMavlinkActions, "CustomMavlinkActions")
DECLARE_SETTINGGROUP(MavlinkActions, "MavlinkActions")
{
qmlRegisterUncreatableType<CustomMavlinkActionsSettings>("QGroundControl.SettingsManager", 1, 0, "CustomMavlinkActionsSettings", "Reference only");
qmlRegisterUncreatableType<MavlinkActionsSettings>("QGroundControl.SettingsManager", 1, 0, "MavlinkActionsSettings", "Reference only");
// Notify the user of new Fly View custom actions support
// Notify the user of new Fly View mavlink actions support
QSettings deprecatedSettings;
static constexpr const char* deprecatedKey1 = "enableCustomActions";
static constexpr const char* deprecatedKey2 = "customActionsDefinitions";
@@ -26,15 +26,15 @@ DECLARE_SETTINGGROUP(CustomMavlinkActions, "CustomMavlinkActions")
if (deprecatedSettings.contains(deprecatedKey1) || deprecatedSettings.contains(deprecatedKey2)) {
deprecatedSettings.remove(deprecatedKey1);
deprecatedSettings.remove(deprecatedKey2);
qgcApp()->showAppMessage(CustomMavlinkActionsSettings::tr("Support for Fly View custom actions has changed. The location of the files has changed. You will need to setup up your settings again from Fly View Settings."));
qgcApp()->showAppMessage(MavlinkActionsSettings::tr("Support for Fly View custom actions has changed. The location of the files has changed. You will need to setup up your settings again from Fly View Settings."));
}
// Notify the user of new Joystick custom actions support
static constexpr const char* joystickFileName = "JoystickMavCommands.json";
if (QFile(joystickFileName).exists()) {
qgcApp()->showAppMessage(CustomMavlinkActionsSettings::tr("Support for Joystick custom actions has changed. The format and location of the files has changed. New setting is available from Fly View Settings. File format is documented in user guide. Delete the %1 file to disable this warning").arg(joystickFileName));
qgcApp()->showAppMessage(MavlinkActionsSettings::tr("Support for Joystick custom actions has changed. The format and location of the files has changed. New setting is available from Fly View Settings. File format is documented in user guide. Delete the %1 file to disable this warning").arg(joystickFileName));
}
}
DECLARE_SETTINGSFACT(CustomMavlinkActionsSettings, flyViewActionsFile)
DECLARE_SETTINGSFACT(CustomMavlinkActionsSettings, joystickActionsFile)
DECLARE_SETTINGSFACT(MavlinkActionsSettings, flyViewActionsFile)
DECLARE_SETTINGSFACT(MavlinkActionsSettings, joystickActionsFile)
@@ -11,11 +11,11 @@
#include "SettingsGroup.h"
class CustomMavlinkActionsSettings : public SettingsGroup
class MavlinkActionsSettings : public SettingsGroup
{
Q_OBJECT
public:
CustomMavlinkActionsSettings(QObject* parent = nullptr);
MavlinkActionsSettings(QObject* parent = nullptr);
DEFINE_SETTING_NAME_GROUP()
+3 -3
View File
@@ -17,7 +17,7 @@
#include "AutoConnectSettings.h"
#include "BatteryIndicatorSettings.h"
#include "BrandImageSettings.h"
#include "CustomMavlinkActionsSettings.h"
#include "MavlinkActionsSettings.h"
#include "FirmwareUpgradeSettings.h"
#include "FlightMapSettings.h"
#include "FlightModeSettings.h"
@@ -74,7 +74,7 @@ void SettingsManager::init()
_autoConnectSettings = new AutoConnectSettings(this);
_batteryIndicatorSettings = new BatteryIndicatorSettings(this);
_brandImageSettings = new BrandImageSettings(this);
_customMavlinkActionsSettings = new CustomMavlinkActionsSettings(this);
_mavlinkActionsSettings = new MavlinkActionsSettings(this);
_firmwareUpgradeSettings = new FirmwareUpgradeSettings(this);
_flightMapSettings = new FlightMapSettings(this);
_flightModeSettings = new FlightModeSettings(this);
@@ -99,7 +99,7 @@ AppSettings *SettingsManager::appSettings() const { return _appSettings; }
AutoConnectSettings *SettingsManager::autoConnectSettings() const { return _autoConnectSettings; }
BatteryIndicatorSettings *SettingsManager::batteryIndicatorSettings() const { return _batteryIndicatorSettings; }
BrandImageSettings *SettingsManager::brandImageSettings() const { return _brandImageSettings; }
CustomMavlinkActionsSettings *SettingsManager::customMavlinkActionsSettings() const { return _customMavlinkActionsSettings; }
MavlinkActionsSettings *SettingsManager::mavlinkActionsSettings() const { return _mavlinkActionsSettings; }
FirmwareUpgradeSettings *SettingsManager::firmwareUpgradeSettings() const { return _firmwareUpgradeSettings; }
FlightMapSettings *SettingsManager::flightMapSettings() const { return _flightMapSettings; }
FlightModeSettings *SettingsManager::flightModeSettings() const { return _flightModeSettings; }
+5 -5
View File
@@ -19,7 +19,7 @@ class AppSettings;
class AutoConnectSettings;
class BatteryIndicatorSettings;
class BrandImageSettings;
class CustomMavlinkActionsSettings;
class MavlinkActionsSettings;
class FirmwareUpgradeSettings;
class FlightMapSettings;
class FlightModeSettings;
@@ -50,7 +50,7 @@ class SettingsManager : public QObject
Q_MOC_INCLUDE("AutoConnectSettings.h")
Q_MOC_INCLUDE("BatteryIndicatorSettings.h")
Q_MOC_INCLUDE("BrandImageSettings.h")
Q_MOC_INCLUDE("CustomMavlinkActionsSettings.h")
Q_MOC_INCLUDE("MavlinkActionsSettings.h")
Q_MOC_INCLUDE("FirmwareUpgradeSettings.h")
Q_MOC_INCLUDE("FlightMapSettings.h")
Q_MOC_INCLUDE("FlightModeSettings.h")
@@ -74,7 +74,7 @@ class SettingsManager : public QObject
Q_PROPERTY(QObject *autoConnectSettings READ autoConnectSettings CONSTANT)
Q_PROPERTY(QObject *batteryIndicatorSettings READ batteryIndicatorSettings CONSTANT)
Q_PROPERTY(QObject *brandImageSettings READ brandImageSettings CONSTANT)
Q_PROPERTY(QObject *customMavlinkActionsSettings READ customMavlinkActionsSettings CONSTANT)
Q_PROPERTY(QObject *mavlinkActionsSettings READ mavlinkActionsSettings CONSTANT)
Q_PROPERTY(QObject *firmwareUpgradeSettings READ firmwareUpgradeSettings CONSTANT)
Q_PROPERTY(QObject *flightMapSettings READ flightMapSettings CONSTANT)
Q_PROPERTY(QObject *flightModeSettings READ flightModeSettings CONSTANT)
@@ -107,7 +107,7 @@ public:
AutoConnectSettings *autoConnectSettings() const;
BatteryIndicatorSettings *batteryIndicatorSettings() const;
BrandImageSettings *brandImageSettings() const;
CustomMavlinkActionsSettings *customMavlinkActionsSettings() const;
MavlinkActionsSettings *mavlinkActionsSettings() const;
FirmwareUpgradeSettings *firmwareUpgradeSettings() const;
FlightMapSettings *flightMapSettings() const;
FlightModeSettings *flightModeSettings() const;
@@ -133,7 +133,7 @@ private:
AutoConnectSettings *_autoConnectSettings = nullptr;
BatteryIndicatorSettings *_batteryIndicatorSettings = nullptr;
BrandImageSettings *_brandImageSettings = nullptr;
CustomMavlinkActionsSettings *_customMavlinkActionsSettings = nullptr;
MavlinkActionsSettings *_mavlinkActionsSettings = nullptr;
FirmwareUpgradeSettings *_firmwareUpgradeSettings = nullptr;
FlightMapSettings *_flightMapSettings = nullptr;
FlightModeSettings *_flightModeSettings = nullptr;
+15 -13
View File
@@ -25,7 +25,7 @@ import QGroundControl.Controllers
SettingsPage {
property var _settingsManager: QGroundControl.settingsManager
property var _flyViewSettings: _settingsManager.flyViewSettings
property var _customMavlinkActionsSettings: _settingsManager.customMavlinkActionsSettings
property var _mavlinkActionsSettings: _settingsManager.mavlinkActionsSettings
property Fact _virtualJoystick: _settingsManager.appSettings.virtualJoystick
property Fact _virtualJoystickAutoCenterThrottle: _settingsManager.appSettings.virtualJoystickAutoCenterThrottle
property Fact _enableMultiVehiclePanel: _settingsManager.appSettings.enableMultiVehiclePanel
@@ -42,8 +42,8 @@ SettingsPage {
QGCFileDialogController { id: fileController }
function customActionList() {
var fileModel = fileController.getFiles(_settingsManager.appSettings.customActionsSavePath, "*.json")
function mavlinkActionList() {
var fileModel = fileController.getFiles(_settingsManager.appSettings.mavlinkActionsSavePath, "*.json")
fileModel.unshift(qsTr("<None>"))
return fileModel
}
@@ -141,29 +141,31 @@ SettingsPage {
SettingsGroupLayout {
Layout.fillWidth: true
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 35
heading: qsTr("Custom MAVLink Actions")
headingDescription: qsTr("Custom action JSON files should be created in the '%1' folder.").arg(QGroundControl.settingsManager.appSettings.customActionsSavePath)
heading: qsTr("MAVLink Actions")
headingDescription: qsTr("Action JSON files should be created in the '%1' folder.").arg(QGroundControl.settingsManager.appSettings.mavlinkActionsSavePath)
LabelledComboBox {
Layout.fillWidth: true
label: qsTr("Fly View Custom Actions")
model: customActionList()
onActivated: (index) => index == 0 ? _customMavlinkActionsSettings.flyViewActionsFile.rawValue = "" : _customMavlinkActionsSettings.flyViewActionsFile.rawValue = comboBox.currentText
label: qsTr("Fly View Actions")
model: mavlinkActionList()
onActivated: (index) => index == 0 ? _mavlinkActionsSettings.flyViewActionsFile.rawValue = "" : _mavlinkActionsSettings.flyViewActionsFile.rawValue = comboBox.currentText
enabled: model.length > 1
Component.onCompleted: {
var index = comboBox.find(_customMavlinkActionsSettings.flyViewActionsFile.valueString)
var index = comboBox.find(_mavlinkActionsSettings.flyViewActionsFile.valueString)
comboBox.currentIndex = index == -1 ? 0 : index
}
}
LabelledComboBox {
Layout.fillWidth: true
label: qsTr("Joystick Custom Actions")
model: customActionList()
onActivated: (index) => index == 0 ? _customMavlinkActionsSettings.joystickActionsFile.rawValue = "" : _customMavlinkActionsSettings.joystickActionsFile.rawValue = comboBox.currentText
label: qsTr("Joystick Actions")
model: mavlinkActionList()
onActivated: (index) => index == 0 ? _mavlinkActionsSettings.joystickActionsFile.rawValue = "" : _mavlinkActionsSettings.joystickActionsFile.rawValue = comboBox.currentText
enabled: model.length > 1
Component.onCompleted: {
var index = comboBox.find(_customMavlinkActionsSettings.joystickActionsFile.valueString)
var index = comboBox.find(_mavlinkActionsSettings.joystickActionsFile.valueString)
comboBox.currentIndex = index == -1 ? 0 : index
}
}