Commit e9293adb authored by DonLakeFlyer's avatar DonLakeFlyer

Remove MavlinkQmlSingleton

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