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 \
src/ui/QGCTabbedInfoView.cpp \
src/ui/UASRawStatusView.cpp \
src/ui/PrimaryFlightDisplay.cc \
src/ui/uas/QGCMessageView.cc
src/ui/uas/QGCMessageView.cc \
src/ui/JoystickButton.cc \
src/ui/JoystickAxis.cc
......
......@@ -163,14 +163,23 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren
font("Bitstream Vera Sans"),
refreshTimer(new QTimer(this))
{
Q_UNUSED(width)
Q_UNUSED(height)
Q_UNUSED(width);
Q_UNUSED(height);
setMinimumSize(120, 80);
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*)));
// 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());
// Refresh timer
......@@ -244,6 +253,17 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event)
/*
* 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
......
......@@ -26,7 +26,9 @@ public slots:
void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError);
/** @brief Set the currently monitored UAS */
virtual void setActiveUAS(UASInterface* uas);
void addUAS(UASInterface* uas);
//void forgetUAS(UASInterface* uas);
void setActiveUAS(UASInterface* uas);
protected:
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