Commit f1b83268 authored by tstellanova's avatar tstellanova

Fix instance initialization

parent d7137bbe
...@@ -45,6 +45,7 @@ void QGCBaseParamWidget::setUAS(UASInterface* uas) ...@@ -45,6 +45,7 @@ void QGCBaseParamWidget::setUAS(UASInterface* uas)
void QGCBaseParamWidget::connectToParamManager() void QGCBaseParamWidget::connectToParamManager()
{ {
paramMgr = mav->getParamManager();
//TODO route via paramManager instead? //TODO route via paramManager instead?
// Listen to updated param signals from the data model // Listen to updated param signals from the data model
connect(paramMgr->dataModel(), SIGNAL(parameterUpdated(int, QString , QVariant )), connect(paramMgr->dataModel(), SIGNAL(parameterUpdated(int, QString , QVariant )),
...@@ -77,6 +78,8 @@ void QGCBaseParamWidget::disconnectFromParamManager() ...@@ -77,6 +78,8 @@ void QGCBaseParamWidget::disconnectFromParamManager()
// Listen to communications status messages so we can display them // Listen to communications status messages so we can display them
disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)), disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)),
this, SLOT(handleParamStatusMsgUpdate(QString , int ))); this, SLOT(handleParamStatusMsgUpdate(QString , int )));
paramMgr = NULL;
} }
......
...@@ -84,7 +84,8 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -84,7 +84,8 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
//connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions()));
//TODO connect buttons here to save/clear actions? //TODO connect buttons here to save/clear actions?
ui->pendingCommitsWidget->initWithUAS(this->mav); mav = UASManager::instance()->getActiveUAS();
ui->pendingCommitsWidget->initWithUAS(mav);
ui->pendingCommitsWidget->update(); ui->pendingCommitsWidget->update();
//TODO the following methods are not yet implemented //TODO the following methods are not yet implemented
......
...@@ -51,9 +51,12 @@ This file is part of the QGROUNDCONTROL project ...@@ -51,9 +51,12 @@ This file is part of the QGROUNDCONTROL project
*/ */
QGCParamWidget::QGCParamWidget(QWidget *parent) : QGCParamWidget::QGCParamWidget(QWidget *parent) :
QGCBaseParamWidget(parent), QGCBaseParamWidget(parent),
componentItems(new QMap<int, QTreeWidgetItem*>()) componentItems(new QMap<int, QTreeWidgetItem*>()),
statusLabel(new QLabel(this)),
tree(new QTreeWidget(this))
{ {
} }
...@@ -75,9 +78,7 @@ void QGCParamWidget::connectViewSignalsAndSlots() ...@@ -75,9 +78,7 @@ void QGCParamWidget::connectViewSignalsAndSlots()
void QGCParamWidget::layoutWidget() void QGCParamWidget::layoutWidget()
{ {
// Create tree widget
tree = new QTreeWidget(this);
statusLabel = new QLabel();
statusLabel->setAutoFillBackground(true); statusLabel->setAutoFillBackground(true);
// Set tree widget as widget onto this component // Set tree widget as widget onto this component
......
...@@ -88,10 +88,10 @@ public slots: ...@@ -88,10 +88,10 @@ public slots:
protected: protected:
QTreeWidget* tree; ///< The parameter tree
QLabel* statusLabel; ///< User-facing parameter status label
QMap<int, QTreeWidgetItem*>* componentItems; ///< The tree of component items, stored by component ID QMap<int, QTreeWidgetItem*>* componentItems; ///< The tree of component items, stored by component ID
QMap<int, QMap<QString, QTreeWidgetItem*>* > paramGroups; ///< Parameter groups to organize component items QMap<int, QMap<QString, QTreeWidgetItem*>* > paramGroups; ///< Parameter groups to organize component items
QLabel* statusLabel; ///< User-facing parameter status label
QTreeWidget* tree; ///< The parameter tree
}; };
......
...@@ -12,6 +12,7 @@ QGCPendingParamWidget::QGCPendingParamWidget(QObject *parent) : ...@@ -12,6 +12,7 @@ QGCPendingParamWidget::QGCPendingParamWidget(QObject *parent) :
void QGCPendingParamWidget::connectToParamManager() void QGCPendingParamWidget::connectToParamManager()
{ {
paramMgr = mav->getParamManager();
//TODO route via paramManager instead? //TODO route via paramManager instead?
// Listen to updated param signals from the data model // Listen to updated param signals from the data model
connect(paramMgr->dataModel(), SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )), connect(paramMgr->dataModel(), SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )),
...@@ -33,6 +34,8 @@ void QGCPendingParamWidget::disconnectFromParamManager() ...@@ -33,6 +34,8 @@ void QGCPendingParamWidget::disconnectFromParamManager()
// Listen to communications status messages so we can display them // Listen to communications status messages so we can display them
disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)), disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)),
this, SLOT(handleParamStatusMsgUpdate(QString , int ))); this, SLOT(handleParamStatusMsgUpdate(QString , int )));
paramMgr = NULL;
} }
......
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