Commit d4425e06 authored by Bryant's avatar Bryant

Merge branch 'connStatus' of github.com:Susurrus/qgroundcontrol into connStatus

Conflicts:
	src/ui/QGCVehicleConfig.cc
	src/ui/QGCVehicleConfig.h
	src/ui/QGCVehicleConfig.ui
	src/ui/uas/UASControlWidget.cc
	src/ui/uas/UASListWidget.h
	src/ui/uas/UASQuickView.cc
parents 7aef7fcf 975f4106
......@@ -183,6 +183,9 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
setActiveUAS(UASManager::instance()->getActiveUAS());
}
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
this, SLOT(setActiveUAS(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
this, SLOT(setActiveUAS(UASInterface*)));
......
......@@ -256,19 +256,21 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
//TODO: Throw an error here too, no autopilot specific configuration
qWarning() << "Invalid vehicle dir, no vehicle specific configuration will be loaded.";
}
// Generate widgets for the General tab.
QGCToolWidget *tool;
bool left = true;
foreach (QString file,generaldir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
QWidget* parent = left?ui->generalLeftContents:ui->generalRightContents;
tool = new QGCToolWidget("", parent);
if (tool->loadSettings(generaldir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(parent);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
if (left)
{
......@@ -285,18 +287,20 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
}
}
// Generate widgets for the Advanced tab.
left = true;
foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
QWidget* parent = left?ui->advancedLeftContents:ui->advancedRightContents;
tool = new QGCToolWidget("", parent);
if (tool->loadSettings(vehicledir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(parent);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
if (left)
{
......@@ -314,7 +318,7 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
}
//Load tabs for general configuration
// Load tabs for general configuration
foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3);
......@@ -331,10 +335,10 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
buttonToWidgetMap[button] = tab;
tab->setLayout(new QVBoxLayout());
tab->show();
QScrollArea *area = new QScrollArea();
QScrollArea *area = new QScrollArea(tab);
tab->layout()->addWidget(area);
QWidget *scrollArea = new QWidget();
scrollArea->setLayout(new QVBoxLayout());
QWidget *scrollArea = new QWidget(tab);
scrollArea->setLayout(new QVBoxLayout(tab));
area->setWidget(scrollArea);
area->setWidgetResizable(true);
area->show();
......@@ -343,14 +347,14 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
foreach (QString file,newdir.entryList(QDir::Files| QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
tool = new QGCToolWidget("", tab);
if (tool->loadSettings(newdir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(tab);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(tab));
box->layout()->addWidget(tool);
scrollArea->layout()->addWidget(box);
} else {
......@@ -360,7 +364,7 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
}
//Load tabs for vehicle specific configuration
// Load additional tabs for vehicle specific configuration
foreach (QString dir,vehicledir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
//QWidget *tab = new QWidget(ui->tabWidget);
......@@ -379,10 +383,10 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
button->setText(dir);
tab->setLayout(new QVBoxLayout());
tab->show();
QScrollArea *area = new QScrollArea();
QScrollArea *area = new QScrollArea(tab);
tab->layout()->addWidget(area);
QWidget *scrollArea = new QWidget();
scrollArea->setLayout(new QVBoxLayout());
QWidget *scrollArea = new QWidget(tab);
scrollArea->setLayout(new QVBoxLayout(tab));
area->setWidget(scrollArea);
area->setWidgetResizable(true);
area->show();
......@@ -392,15 +396,15 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
foreach (QString file,newdir.entryList(QDir::Files| QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
tool = new QGCToolWidget("", tab);
tool->addUAS(mav);
if (tool->loadSettings(newdir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox();
QGroupBox *box = new QGroupBox(tab);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
scrollArea->layout()->addWidget(box);
box->show();
......@@ -412,30 +416,31 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
}
// Load calibration
// Load general calibration for autopilot
//TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries?
tool = new QGCToolWidget("", this);
tool = new QGCToolWidget("", ui->sensorContents);
tool->addUAS(mav);
if (tool->loadSettings(autopilotdir.absolutePath() + "/general/calibration/calibration.qgw", false))
{
toolWidgets.append(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(ui->sensorContents);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
ui->sensorLayout->addWidget(box);
} else {
delete tool;
}
tool = new QGCToolWidget("", this);
// Load vehicle-specific autopilot configuration
tool = new QGCToolWidget("", ui->sensorContents);
tool->addUAS(mav);
if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false))
{
toolWidgets.append(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(ui->sensorContents);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
ui->sensorLayout->addWidget(box);
} else {
......@@ -494,7 +499,7 @@ void QGCVehicleConfig::loadConfig()
QXmlStreamReader xml(xmlfile.readAll());
xmlfile.close();
//TODO: Testing to ensure that incorrectly formated XML won't break this.
//TODO: Testing to ensure that incorrectly formatted XML won't break this.
while (!xml.atEnd())
{
if (xml.isStartElement() && xml.name() == "paramfile")
......@@ -674,7 +679,16 @@ void QGCVehicleConfig::loadConfig()
}
if (genarraycount > 0)
{
tool = new QGCToolWidget("", this);
QWidget* parent = this;
if (valuetype == "vehicles")
{
parent = ui->generalLeftContents;
}
else if (valuetype == "libraries")
{
parent = ui->generalRightContents;
}
tool = new QGCToolWidget("", parent);
tool->addUAS(mav);
tool->setTitle(parametersname);
tool->setObjectName(parametersname);
......@@ -702,9 +716,9 @@ void QGCVehicleConfig::loadConfig()
}
toolWidgets.append(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(parent);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
if (valuetype == "vehicles")
{
......@@ -719,7 +733,16 @@ void QGCVehicleConfig::loadConfig()
}
if (advarraycount > 0)
{
tool = new QGCToolWidget("", this);
QWidget* parent = this;
if (valuetype == "vehicles")
{
parent = ui->generalLeftContents;
}
else if (valuetype == "libraries")
{
parent = ui->generalRightContents;
}
tool = new QGCToolWidget("", parent);
tool->addUAS(mav);
tool->setTitle(parametersname);
tool->setObjectName(parametersname);
......@@ -747,31 +770,25 @@ void QGCVehicleConfig::loadConfig()
}
toolWidgets.append(tool);
QGroupBox *box = new QGroupBox(this);
QGroupBox *box = new QGroupBox(parent);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
if (valuetype == "vehicles")
{
ui->leftAdvancedLayout->addWidget(box);
ui->leftGeneralLayout->addWidget(box);
}
else if (valuetype == "libraries")
{
ui->rightAdvancedLayout->addWidget(box);
ui->rightGeneralLayout->addWidget(box);
}
box->hide();
toolToBoxMap[tool] = box;
}
}
xml.readNext();
}
}
xml.readNext();
}
}
......@@ -785,7 +802,7 @@ void QGCVehicleConfig::loadConfig()
void QGCVehicleConfig::setActiveUAS(UASInterface* active)
{
// Do nothing if system is the same or NULL
// Do nothing if system is the same
if (mav == active) return;
if (mav)
......@@ -796,11 +813,41 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this,
SLOT(parameterChanged(int,int,QString,QVariant)));
foreach (QGCToolWidget* tool, toolWidgets)
// Delete all children from all fixed tabs.
foreach(QWidget* child, ui->generalLeftContents->findChildren<QWidget*>())
{
delete tool;
child->deleteLater();
}
foreach(QWidget* child, ui->generalRightContents->findChildren<QWidget*>())
{
child->deleteLater();
}
foreach(QWidget* child, ui->advancedLeftContents->findChildren<QWidget*>())
{
child->deleteLater();
}
foreach(QWidget* child, ui->advancedRightContents->findChildren<QWidget*>())
{
child->deleteLater();
}
foreach(QWidget* child, ui->sensorContents->findChildren<QWidget*>())
{
child->deleteLater();
}
// And then delete any custom tabs
foreach(QWidget* child, additionalTabs)
{
child->deleteLater();
}
additionalTabs.clear();
toolWidgets.clear();
paramToWidgetMap = NULL;
libParamToWidgetMap.clear();
systemTypeToParamMap.clear();
toolToBoxMap.clear();
paramTooltips.clear();
}
// Reset current state
......@@ -819,13 +866,13 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
if (systemTypeToParamMap.contains(mav->getSystemTypeName()))
{
paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()];
paramToWidgetMap = &systemTypeToParamMap[mav->getSystemTypeName()];
}
else
{
//Indication that we have no meta data for this system type.
qDebug() << "No parameters defined for system type:" << mav->getSystemTypeName();
paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()];
paramToWidgetMap = &systemTypeToParamMap[mav->getSystemTypeName()];
}
if (!paramTooltips.isEmpty())
......@@ -842,7 +889,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
// Since a system is now connected, enable the VehicleConfig UI.
//ui->tabWidget->setEnabled(true);
ui->tabWidget->setEnabled(true);
ui->setButton->setEnabled(true);
ui->refreshButton->setEnabled(true);
ui->readButton->setEnabled(true);
......@@ -1139,7 +1186,18 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (!found)
{
//New param type, create a QGroupBox for it.
QGCToolWidget *tool = new QGCToolWidget("", this);
QWidget* parent;
if (ui->leftAdvancedLayout->count() > ui->rightAdvancedLayout->count())
{
parent = ui->advancedRightContents;
}
else
{
parent = ui->advancedLeftContents;
}
// Create the tool, attaching it to the QGroupBox
QGCToolWidget *tool = new QGCToolWidget("", parent);
QString tooltitle = parameterName;
if (parameterName.split("_").size() > 1)
{
......@@ -1148,14 +1206,17 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
tool->setTitle(tooltitle);
tool->setObjectName(tooltitle);
//tool->setSettings(set);
tool->addParam(uas,component,parameterName,value);
libParamToWidgetMap.insert(parameterName,tool);
toolWidgets.append(tool);
QGroupBox *box = new QGroupBox(this);
tool->addParam(uas, component, parameterName, value);
QGroupBox *box = new QGroupBox(parent);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
libParamToWidgetMap.insert(parameterName,tool);
toolWidgets.append(tool);
//Make sure we have similar number of widgets on each side.
if (ui->leftAdvancedLayout->count() > ui->rightAdvancedLayout->count())
......
......@@ -34,8 +34,13 @@
<height>16777215</height>
</size>
</property>
<<<<<<< HEAD
<property name="widgetResizable">
<bool>true</bool>
=======
<property name="currentIndex">
<number>0</number>
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
......@@ -1070,9 +1075,20 @@ p, li { white-space: pre-wrap; }
<property name="title">
<string>Configuration</string>
</property>
<<<<<<< HEAD
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
=======
<widget class="QWidget" name="sensorContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>362</width>
<height>489</height>
</rect>
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
</property>
<item>
<widget class="QScrollArea" name="scrollArea_4">
......@@ -1193,11 +1209,104 @@ p, li { white-space: pre-wrap; }
<property name="enabled">
<bool>false</bool>
</property>
<<<<<<< HEAD
<property name="toolTip">
<string>Copy parameters from permanent memory to non-permanent current memory of aircraft. DOES NOT update the parameters in this view, click refresh after copying them to get them.</string>
</property>
<property name="statusTip">
<string/>
=======
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="generalLeftContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>438</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="leftGeneralLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="generalRightGroupBox">
<property name="title">
<string>Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="generalRightContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>438</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="rightGeneralLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="advancedTab">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title">
<string>Advanced Config</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
</property>
<property name="whatsThis">
<string/>
......@@ -1247,12 +1356,106 @@ p, li { white-space: pre-wrap; }
<property name="toolTip">
<string>Save parameters in this view to a file on this computer.</string>
</property>
<<<<<<< HEAD
<property name="statusTip">
<string/>
=======
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_4">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="advancedLeftContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>438</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="leftAdvancedLayout">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="advancedRightGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
</property>
<property name="text">
<string>Save (File)</string>
</property>
<<<<<<< HEAD
=======
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_5">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="advancedRightContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>438</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="rightAdvancedLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
</widget>
</item>
</layout>
......
......@@ -69,6 +69,17 @@ void UASQuickView::saveSettings()
settings.setArrayIndex(count++);
settings.setValue("name",i.key());
settings.setValue("type","text");
=======
QAction *action = new QAction(tr("longitude"),this);
action->setCheckable(true);
action->setChecked(true);
connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool)));
this->addAction(action);
UASQuickViewItem *item = new UASQuickViewItem(this);
item->setTitle(tr("longitude"));
this->layout()->addWidget(item);
uasPropertyToLabelMap["longitude"] = item;
>>>>>>> 975f41067229245752f23de45b80ca4a7e28642d
}
settings.endArray();
settings.sync();
......@@ -80,6 +91,7 @@ void UASQuickView::loadSettings()
int size = settings.beginReadArray("UAS_QUICK_VIEW_ITEMS");
for (int i=0;i<size;i++)
{
<<<<<<< HEAD
settings.setArrayIndex(i);
QString nameval = settings.value("name").toString();
QString typeval = settings.value("type").toString();
......@@ -149,6 +161,7 @@ void UASQuickView::addUAS(UASInterface* uas)
void UASQuickView::setActiveUAS(UASInterface* uas)
{
// Clean up from the old UAS
if (this->uas)
{
uasPropertyValueMap.clear();
......@@ -259,6 +272,9 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr
{
quickViewSelectDialog->addItem(name);
}
// And periodically update the view.
updateTimer->start(1000);
}
uasPropertyValueMap[name] = value;
}
......
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