Commit 1fe2818b authored by dongfang's avatar dongfang

PrimaryFlightDisplay now receiving UAS added/removed signals

parent bbc987bc
...@@ -572,7 +572,7 @@ SOURCES += src/main.cc \ ...@@ -572,7 +572,7 @@ SOURCES += src/main.cc \
src/ui/QGCTabbedInfoView.cpp \ src/ui/QGCTabbedInfoView.cpp \
src/ui/UASRawStatusView.cpp \ src/ui/UASRawStatusView.cpp \
src/ui/PrimaryFlightDisplay.cc \ src/ui/PrimaryFlightDisplay.cc \
src/ui/uas/QGCMessageView.cc src/ui/uas/QGCMessageView.cc \
src/ui/JoystickButton.cc \ src/ui/JoystickButton.cc \
src/ui/JoystickAxis.cc src/ui/JoystickAxis.cc
......
...@@ -163,14 +163,23 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren ...@@ -163,14 +163,23 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren
font("Bitstream Vera Sans"), font("Bitstream Vera Sans"),
refreshTimer(new QTimer(this)) refreshTimer(new QTimer(this))
{ {
Q_UNUSED(width) Q_UNUSED(width);
Q_UNUSED(height) Q_UNUSED(height);
setMinimumSize(120, 80); setMinimumSize(120, 80);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Connect with UAS // Connect with UAS signal
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
// connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(forgetUAS(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
// Get a list of all existing UAS and - well attach to one of them. The first one.
foreach (UASInterface* uas, UASManager::instance()->getUASList()) {
addUAS(uas);
}
if (UASManager::instance()->getActiveUAS() != NULL) setActiveUAS(UASManager::instance()->getActiveUAS()); if (UASManager::instance()->getActiveUAS() != NULL) setActiveUAS(UASManager::instance()->getActiveUAS());
// Refresh timer // Refresh timer
...@@ -244,6 +253,17 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event) ...@@ -244,6 +253,17 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event)
/* /*
* Interface towards qgroundcontrol * Interface towards qgroundcontrol
*/ */
void PrimaryFlightDisplay::addUAS(UASInterface* uas)
{
if (uas)
{
if (!this->uas)
{
setActiveUAS(uas);
}
}
}
/** /**
* *
* @param uas the UAS/MAV to monitor/display with the HUD * @param uas the UAS/MAV to monitor/display with the HUD
......
...@@ -26,7 +26,9 @@ public slots: ...@@ -26,7 +26,9 @@ public slots:
void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError); void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError);
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
virtual void setActiveUAS(UASInterface* uas); void addUAS(UASInterface* uas);
//void forgetUAS(UASInterface* uas);
void setActiveUAS(UASInterface* uas);
protected: protected:
enum Layout { enum Layout {
......
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