Commit e9293adb authored by DonLakeFlyer's avatar DonLakeFlyer

Remove MavlinkQmlSingleton

parent 9b9b9d74
......@@ -568,7 +568,6 @@ HEADERS += \
src/QmlControls/AppMessages.h \
src/QmlControls/CoordinateVector.h \
src/QmlControls/EditPositionDialogController.h \
src/QmlControls/MavlinkQmlSingleton.h \
src/QmlControls/ParameterEditorController.h \
src/QmlControls/QGCFileDialogController.h \
src/QmlControls/QGCImageProvider.h \
......
......@@ -19,7 +19,6 @@ import QGroundControl.FlightMap 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Mavlink 1.0
import QGroundControl.QGCPositionManager 1.0
Map {
......
......@@ -14,7 +14,6 @@
#include "QGCMAVLink.h"
#include "QGCLoggingCategory.h"
#include "QmlObjectListModel.h"
#include "MavlinkQmlSingleton.h"
#include <QObject>
#include <QString>
......
......@@ -335,10 +335,10 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
SimpleMissionItem * newItem = new SimpleMissionItem(_controllerVehicle, this);
newItem->setSequenceNumber(sequenceNumber);
newItem->setCoordinate(coordinate);
newItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT);
newItem->setCommand(MAV_CMD_NAV_WAYPOINT);
_initVisualItem(newItem);
if (_visualItems->count() == 1) {
MavlinkQmlSingleton::Qml_MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF : MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF;
MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF;
if (_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)takeoffCmd)) {
newItem->setCommand(takeoffCmd);
}
......@@ -366,7 +366,7 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
int sequenceNumber = _nextSequenceNumber();
SimpleMissionItem * newItem = new SimpleMissionItem(_controllerVehicle, this);
newItem->setSequenceNumber(sequenceNumber);
newItem->setCommand((MavlinkQmlSingleton::Qml_MAV_CMD)(_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)MAV_CMD_DO_SET_ROI_LOCATION) ?
newItem->setCommand((MAV_CMD)(_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)MAV_CMD_DO_SET_ROI_LOCATION) ?
MAV_CMD_DO_SET_ROI_LOCATION :
MAV_CMD_DO_SET_ROI));
_initVisualItem(newItem);
......@@ -840,7 +840,7 @@ bool MissionController::_loadTextMissionFile(QTextStream& stream, QmlObjectListM
// Update sequence numbers in DO_JUMP commands to take into account added home position in index 0
for (int i=1; i<visualItems->count(); i++) {
SimpleMissionItem* item = qobject_cast<SimpleMissionItem*>(visualItems->get(i));
if (item && item->command() == MavlinkQmlSingleton::MAV_CMD_DO_JUMP) {
if (item && item->command() == MAV_CMD_DO_JUMP) {
item->missionItem().setParam1((int)item->missionItem().param1() + 1);
}
}
......@@ -1297,7 +1297,7 @@ void MissionController::_recalcMissionFlightStatus()
}
// Link back to home if first item is takeoff and we have home position
if (firstCoordinateItem && simpleItem && (simpleItem->command() == MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF || simpleItem->command() == MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF)) {
if (firstCoordinateItem && simpleItem && (simpleItem->command() == MAV_CMD_NAV_TAKEOFF || simpleItem->command() == MAV_CMD_NAV_VTOL_TAKEOFF)) {
if (showHomePosition) {
linkStartToHome = true;
if (_controllerVehicle->multiRotor() || _controllerVehicle->vtol()) {
......@@ -1313,19 +1313,19 @@ void MissionController::_recalcMissionFlightStatus()
// Update VTOL state
if (simpleItem && _controllerVehicle->vtol()) {
switch (simpleItem->command()) {
case MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF:
case MAV_CMD_NAV_TAKEOFF:
vtolInHover = false;
break;
case MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF:
case MAV_CMD_NAV_VTOL_TAKEOFF:
vtolInHover = true;
break;
case MavlinkQmlSingleton::MAV_CMD_NAV_LAND:
case MAV_CMD_NAV_LAND:
vtolInHover = false;
break;
case MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_LAND:
case MAV_CMD_NAV_VTOL_LAND:
vtolInHover = true;
break;
case MavlinkQmlSingleton::MAV_CMD_DO_VTOL_TRANSITION:
case MAV_CMD_DO_VTOL_TRANSITION:
{
int transitionState = simpleItem->missionItem().param1();
if (transitionState == MAV_VTOL_STATE_TRANSITION_TO_MC) {
......
......@@ -15,7 +15,6 @@
#include "QmlObjectListModel.h"
#include "Vehicle.h"
#include "QGCLoggingCategory.h"
#include "MavlinkQmlSingleton.h"
#include <QHash>
......
......@@ -132,7 +132,7 @@ void MissionControllerTest::_testAddWaypointWorker(MAV_AUTOPILOT firmwareType)
QVERIFY(settingsItem);
QVERIFY(simpleItem);
QCOMPARE(simpleItem->command(), MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF);
QCOMPARE((MAV_CMD)simpleItem->command(), MAV_CMD_NAV_TAKEOFF);
QCOMPARE(simpleItem->childItems()->count(), 0);
// If the first item added specifies a coordinate, then planned home position will be set
......
......@@ -20,7 +20,6 @@
#include "QGCMAVLink.h"
#include "QGC.h"
#include "MavlinkQmlSingleton.h"
#include "QmlObjectListModel.h"
#include "Fact.h"
#include "QGCLoggingCategory.h"
......
......@@ -392,15 +392,15 @@ QString SimpleMissionItem::abbreviation() const
return tr("H");
switch(command()) {
case MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF:
case MAV_CMD_NAV_TAKEOFF:
return tr("Takeoff");
case MavlinkQmlSingleton::MAV_CMD_NAV_LAND:
case MAV_CMD_NAV_LAND:
return tr("Land");
case MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF:
case MAV_CMD_NAV_VTOL_TAKEOFF:
return tr("VTOL Takeoff");
case MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_LAND:
case MAV_CMD_NAV_VTOL_LAND:
return tr("VTOL Land");
case MavlinkQmlSingleton::MAV_CMD_DO_SET_ROI:
case MAV_CMD_DO_SET_ROI:
return tr("ROI");
default:
return QString();
......@@ -750,7 +750,7 @@ QString SimpleMissionItem::category(void) const
return _commandTree->getUIInfo(_vehicle, (MAV_CMD)command())->category();
}
void SimpleMissionItem::setCommand(MavlinkQmlSingleton::Qml_MAV_CMD command)
void SimpleMissionItem::setCommand(int command)
{
if ((MAV_CMD)command != _missionItem.command()) {
_missionItem.setCommand((MAV_CMD)command);
......
......@@ -44,7 +44,7 @@ public:
Q_PROPERTY(Fact* altitude READ altitude CONSTANT) ///< Altitude as specified by altitudeMode. Not necessarily true mission item altitude
Q_PROPERTY(AltitudeMode altitudeMode READ altitudeMode WRITE setAltitudeMode NOTIFY altitudeModeChanged)
Q_PROPERTY(Fact* amslAltAboveTerrain READ amslAltAboveTerrain CONSTANT) ///< Actual AMSL altitude for item if altitudeMode == AltitudeAboveTerrain
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged)
Q_PROPERTY(int command READ command WRITE setCommand NOTIFY commandChanged)
/// Optional sections
Q_PROPERTY(QObject* speedSection READ speedSection NOTIFY speedSectionChanged)
......@@ -65,7 +65,7 @@ public:
// Property accesors
QString category (void) const;
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_missionItem._commandFact.cookedValue().toInt(); }
int command(void) const { return _missionItem._commandFact.cookedValue().toInt(); }
bool friendlyEditAllowed (void) const;
bool rawEdit (void) const;
bool specifiesAltitude (void) const;
......@@ -85,7 +85,7 @@ public:
void setCommandByIndex(int index);
void setCommand(MavlinkQmlSingleton::Qml_MAV_CMD command);
void setCommand(int command);
void setAltDifference (double altDifference);
void setAltPercent (double altPercent);
......
......@@ -236,11 +236,11 @@ void SimpleMissionItemTest::_testSignals(void)
// dirtyChanged
// coordinateChanged - since altitude will be set back to default
_simpleItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT);
_simpleItem->setCommand(MAV_CMD_NAV_WAYPOINT);
QVERIFY(_spyVisualItem->checkNoSignals());
QVERIFY(_spySimpleItem->checkNoSignals());
_simpleItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_LOITER_TIME);
_simpleItem->setCommand(MAV_CMD_NAV_LOITER_TIME);
QVERIFY(_spySimpleItem->checkSignalsByMask(commandChangedMask));
QVERIFY(_spyVisualItem->checkSignalsByMask(commandNameChangedMask | dirtyChangedMask | coordinateChangedMask));
}
......
......@@ -18,7 +18,6 @@
#include "QGCMAVLink.h"
#include "QGC.h"
#include "MavlinkQmlSingleton.h"
#include "QmlObjectListModel.h"
#include "Fact.h"
#include "QGCLoggingCategory.h"
......
......@@ -23,7 +23,6 @@ import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Mavlink 1.0
import QGroundControl.Controllers 1.0
/// Mission Editor
......
......@@ -57,7 +57,6 @@
#include "FirmwarePluginManager.h"
#include "MultiVehicleManager.h"
#include "Vehicle.h"
#include "MavlinkQmlSingleton.h"
#include "JoystickConfigController.h"
#include "JoystickManager.h"
#include "QmlObjectListModel.h"
......@@ -130,11 +129,6 @@ static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*)
return screenToolsController;
}
static QObject* mavlinkQmlSingletonFactory(QQmlEngine*, QJSEngine*)
{
return new MavlinkQmlSingleton;
}
static QObject* qgroundcontrolQmlGlobalSingletonFactory(QQmlEngine*, QJSEngine*)
{
// We create this object as a QGCTool even though it isn't in the toolbox
......@@ -404,7 +398,6 @@ void QGCApplication::_initCommon(void)
// Register Qml Singletons
qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory);
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
qmlRegisterSingletonType<MavlinkQmlSingleton> ("QGroundControl.Mavlink", 1, 0, "Mavlink", mavlinkQmlSingletonFactory);
}
bool QGCApplication::_initForNormalAppBoot(void)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment