forked from mavlink/qgroundcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'experimental' of github.com:pixhawk/qgroundcontrol into…
… experimental
- Loading branch information
Showing
10 changed files
with
172 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "QGCWaypointListMulti.h" | ||
#include "ui_QGCWaypointListMulti.h" | ||
#include "UASManager.h" | ||
|
||
QGCWaypointListMulti::QGCWaypointListMulti(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::QGCWaypointListMulti) | ||
{ | ||
ui->setupUi(this); | ||
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(systemCreated(UASInterface*))); | ||
connect(UASManager::instance(), SIGNAL(activeUASSet(int)), this, SLOT(systemSetActive(int))); | ||
} | ||
|
||
void QGCWaypointListMulti::systemDeleted(QObject* uas) | ||
{ | ||
UASInterface* mav = dynamic_cast<UASInterface*>(uas); | ||
if (mav) | ||
{ | ||
int id = mav->getUASID(); | ||
WaypointList* list = lists.value(id, NULL); | ||
if (list) | ||
{ | ||
delete list; | ||
lists.remove(id); | ||
} | ||
} | ||
} | ||
|
||
void QGCWaypointListMulti::systemCreated(UASInterface* uas) | ||
{ | ||
WaypointList* list = new WaypointList(ui->stackedWidget, uas); | ||
lists.insert(uas->getUASID(), list); | ||
ui->stackedWidget->addWidget(list); | ||
// Ensure widget is deleted when system is deleted | ||
connect(uas, SIGNAL(destroyed(QObject*)), this, SLOT(systemDeleted(QObject*))); | ||
} | ||
|
||
void QGCWaypointListMulti::systemSetActive(int uas) | ||
{ | ||
WaypointList* list = lists.value(uas, NULL); | ||
if (list) | ||
{ | ||
ui->stackedWidget->setCurrentWidget(list); | ||
} | ||
} | ||
|
||
QGCWaypointListMulti::~QGCWaypointListMulti() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void QGCWaypointListMulti::changeEvent(QEvent *e) | ||
{ | ||
QWidget::changeEvent(e); | ||
switch (e->type()) { | ||
case QEvent::LanguageChange: | ||
ui->retranslateUi(this); | ||
break; | ||
default: | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef QGCWAYPOINTLISTMULTI_H | ||
#define QGCWAYPOINTLISTMULTI_H | ||
|
||
#include <QWidget> | ||
#include <QMap> | ||
|
||
#include "WaypointList.h" | ||
#include "UASInterface.h" | ||
|
||
namespace Ui { | ||
class QGCWaypointListMulti; | ||
} | ||
|
||
class QGCWaypointListMulti : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit QGCWaypointListMulti(QWidget *parent = 0); | ||
~QGCWaypointListMulti(); | ||
|
||
public slots: | ||
void systemDeleted(QObject* uas); | ||
void systemCreated(UASInterface* uas); | ||
void systemSetActive(int uas); | ||
|
||
protected: | ||
void changeEvent(QEvent *e); | ||
QMap<int, WaypointList*> lists; | ||
|
||
private: | ||
Ui::QGCWaypointListMulti *ui; | ||
}; | ||
|
||
#endif // QGCWAYPOINTLISTMULTI_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QGCWaypointListMulti</class> | ||
<widget class="QWidget" name="QGCWaypointListMulti"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<property name="margin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QStackedWidget" name="stackedWidget"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters