Commit 64bb126e authored by tstellanova's avatar tstellanova

Start adjusting config UI

Start move to single column layout for advanced parameters; Fix
crashing bug in PrimaryFlightDisplay when uas is removed and then
re-added; workaround compiler warning in GeneralBlockPanelKernel,
parent 09452414
......@@ -88,7 +88,7 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
// at the register level. For vectorization purpose, these small vertical panels are unpacked,
// e.g., each coefficient is replicated to fit a packet. This small vertical panel has to
// stay in L1 cache.
std::ptrdiff_t l1, l2;
std::ptrdiff_t l1, l2, initial_n;
typedef gebp_traits<LhsScalar,RhsScalar> Traits;
enum {
......@@ -98,11 +98,12 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
mr_mask = (0xffffffff/mr)*mr
};
initial_n = n;
manage_caching_sizes(GetAction, &l1, &l2);
k = std::min<std::ptrdiff_t>(k, l1/kdiv);
std::ptrdiff_t _m = k>0 ? l2/(4 * sizeof(LhsScalar) * k) : 0;
if(_m<m) m = _m & mr_mask;
n = n;
n = initial_n; //workaround for compiler warning: despite headerdoc, this parameter remains unchanged
}
template<typename LhsScalar, typename RhsScalar>
......
......@@ -293,6 +293,9 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas)
*/
void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas)
{
if (uas == this->uas)
return; //no need to rewire
// Disconnect the previous one (if any)
forgetUAS(this->uas);
......
......@@ -14,12 +14,9 @@ QGCConfigView::QGCConfigView(QWidget *parent) :
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(activeUASChanged(UASInterface*)));
if (ui->waitingLabel) {
ui->gridLayout->removeWidget(ui->waitingLabel);
delete ui->waitingLabel;
ui->waitingLabel = NULL;
}
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
}
QGCConfigView::~QGCConfigView()
......@@ -32,26 +29,31 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
if (currUAS == uas)
return;
if (ui->waitingLabel) {
ui->gridLayout->removeWidget(ui->waitingLabel);
delete ui->waitingLabel;
ui->waitingLabel = NULL;
}
if (currUAS && currUAS->getAutopilotType() != uas->getAutopilotType()) {
foreach (QObject* obj, ui->gridLayout->children()) {
QWidget* w = dynamic_cast<QWidget*>(obj);
if (w) {
ui->gridLayout->removeWidget(w);
//remove all child widgets since they could contain stale data
//for example, when we switch from one PX4 UAS to another UAS
foreach (QObject* obj, ui->gridLayout->children()) {
QWidget* w = dynamic_cast<QWidget*>(obj);
if (w) {
ui->gridLayout->removeWidget(w);
if (obj != ui->waitingLabel)
delete obj;
}
}
}
switch (uas->getAutopilotType()) {
case MAV_AUTOPILOT_PX4:
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
default:
ui->gridLayout->addWidget(new QGCVehicleConfig());
if (NULL != uas) {
ui->gridLayout->removeWidget(ui->waitingLabel);
switch (uas->getAutopilotType()) {
case MAV_AUTOPILOT_PX4:
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
break;
default:
ui->gridLayout->addWidget(new QGCVehicleConfig());
}
}
else {
//restore waiting label if we no longer have a connection
ui->gridLayout->addWidget(ui->waitingLabel);
}
}
......@@ -18,6 +18,12 @@
#include "QGCToolWidget.h"
#include "ui_QGCPX4VehicleConfig.h"
#define WIDGET_INDEX_RC 0
#define WIDGET_INDEX_SENSOR_CAL 1
#define WIDGET_INDEX_GENERAL_CONFIG 2
#define WIDGET_INDEX_ADV_CONFIG 3
QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
QWidget(parent),
mav(NULL),
......@@ -107,22 +113,23 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
}
void QGCPX4VehicleConfig::rcMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(0);
//TODO eg ui->stackedWidget->findChild("rcConfig");
ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_RC);
}
void QGCPX4VehicleConfig::sensorMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(1);
ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_SENSOR_CAL);
}
void QGCPX4VehicleConfig::generalMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-2);
ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_GENERAL_CONFIG);
}
void QGCPX4VehicleConfig::advancedMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-1);
ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_ADV_CONFIG);
}
QGCPX4VehicleConfig::~QGCPX4VehicleConfig()
......@@ -288,7 +295,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
QWidget* parent = left?ui->advancedLeftContents:ui->advancedRightContents;
QWidget* parent = ui->advanceColumnContents;
tool = new QGCToolWidget("", parent);
if (tool->loadSettings(vehicledir.absoluteFilePath(file), false))
{
......@@ -297,16 +304,8 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool);
if (left)
{
left = false;
ui->advancedLeftLayout->addWidget(box);
}
else
{
left = true;
ui->advancedRightLayout->addWidget(box);
}
ui->advancedColumnLayout->addWidget(box);
} else {
delete tool;
}
......@@ -808,8 +807,9 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
}
// Do nothing if system is the same
if (mav == active) return;
// Do nothing if UAS is already visible
if (mav == active)
return;
if (mav)
{
......@@ -829,11 +829,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
{
child->deleteLater();
}
foreach(QWidget* child, ui->advancedLeftContents->findChildren<QWidget*>())
{
child->deleteLater();
}
foreach(QWidget* child, ui->advancedRightContents->findChildren<QWidget*>())
foreach(QWidget* child, ui->advanceColumnContents->findChildren<QWidget*>())
{
child->deleteLater();
}
......@@ -1184,15 +1180,7 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param
if (!found)
{
//New param type, create a QGroupBox for it.
QWidget* parent;
if (ui->advancedLeftLayout->count() > ui->advancedRightLayout->count())
{
parent = ui->advancedRightContents;
}
else
{
parent = ui->advancedLeftContents;
}
QWidget* parent = ui->advanceColumnContents;
// Create the tool, attaching it to the QGroupBox
QGCToolWidget *tool = new QGCToolWidget("", parent);
......@@ -1214,16 +1202,8 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param
libParamToWidgetMap.insert(parameterName,tool);
toolWidgets.append(tool);
ui->advancedColumnLayout->addWidget(box);
// Make sure we have similar number of widgets on each side.
if (ui->advancedLeftLayout->count() > ui->advancedRightLayout->count())
{
ui->advancedRightLayout->addWidget(box);
}
else
{
ui->advancedLeftLayout->addWidget(box);
}
toolToBoxMap[tool] = box;
}
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1256</width>
<height>711</height>
<height>783</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -43,7 +43,7 @@
<x>0</x>
<y>0</y>
<width>133</width>
<height>691</height>
<height>757</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
......@@ -889,7 +889,7 @@ Config</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
......@@ -906,8 +906,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>530</width>
<height>574</height>
<width>26</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
......@@ -981,8 +981,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>525</width>
<height>523</height>
<width>16</width>
<height>16</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
......@@ -1018,8 +1018,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>523</height>
<width>16</width>
<height>16</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
......@@ -1065,10 +1065,10 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QComboBox" name="fixedWingComboBox"/>
<widget class="QComboBox" name="platformSelectorComboBox"/>
</item>
<item>
<widget class="QPushButton" name="loadFixedWingDefaultsButton">
<widget class="QPushButton" name="loadPlatformDefaultsButton">
<property name="text">
<string>Load Platform Defaults</string>
</property>
......@@ -1092,13 +1092,13 @@ p, li { white-space: pre-wrap; }
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="advancedLeftContents">
<widget class="QWidget" name="advanceColumnContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>525</width>
<height>523</height>
<width>928</width>
<height>562</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
......@@ -1106,7 +1106,7 @@ p, li { white-space: pre-wrap; }
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="advancedLeftLayout"/>
<layout class="QVBoxLayout" name="advancedColumnLayout"/>
</item>
</layout>
</widget>
......@@ -1124,31 +1124,6 @@ p, li { white-space: pre-wrap; }
<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>524</width>
<height>523</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="advancedRightLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
......
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