Commit 647ee6cc authored by Don Gagne's avatar Don Gagne

Mocks need QGCSingleton which does not register

parent d2923d8e
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
#include "QGCSingleton.h" #include "QGCSingleton.h"
#include "QGCApplication.h" #include "QGCApplication.h"
QGCSingleton::QGCSingleton(QObject* parent) : QGCSingleton::QGCSingleton(QObject* parent, bool registerSingleton) :
QObject(parent) QObject(parent)
{ {
qgcApp()->registerSingleton(this); if (registerSingleton) {
qgcApp()->registerSingleton(this);
}
} }
...@@ -39,7 +39,9 @@ class QGCSingleton : public QObject ...@@ -39,7 +39,9 @@ class QGCSingleton : public QObject
public: public:
/// @brief Contructor will register singleton to QGCApplication /// @brief Contructor will register singleton to QGCApplication
QGCSingleton(QObject* parent = NULL); /// @param parent Parent object
/// @param registerSingleton true: register with QGCApplication, false: do not register (only used for Mock implementations)
QGCSingleton(QObject* parent = NULL, bool registerSingleton = true);
/// @brief Implementation should delete the singleton such that next call to instance /// @brief Implementation should delete the singleton such that next call to instance
/// will create a new singleton. /// will create a new singleton.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "MockUASManager.h" #include "MockUASManager.h"
MockUASManager::MockUASManager(void) : MockUASManager::MockUASManager(void) :
UASManagerInterface(NULL, false /* do not register singleton with QGCApplication */),
_mockUAS(NULL) _mockUAS(NULL)
{ {
......
...@@ -57,7 +57,10 @@ class UASManagerInterface : public QGCSingleton ...@@ -57,7 +57,10 @@ class UASManagerInterface : public QGCSingleton
Q_OBJECT Q_OBJECT
public: public:
UASManagerInterface(QObject* parent = NULL) : QGCSingleton(parent) { } /// @brief Contructor will register singleton to QGCApplication
/// @param parent Parent object
/// @param registerSingleton true: register with QGCApplication, false: do not register (only used for Mock implementations)
UASManagerInterface(QObject* parent = NULL, bool registerSingleton = true) : QGCSingleton(parent, registerSingleton) { }
virtual UASInterface* getActiveUAS() = 0; virtual UASInterface* getActiveUAS() = 0;
virtual UASWaypointManager *getActiveUASWaypointManager() = 0; virtual UASWaypointManager *getActiveUASWaypointManager() = 0;
......
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