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 ...@@ -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, // 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 // e.g., each coefficient is replicated to fit a packet. This small vertical panel has to
// stay in L1 cache. // stay in L1 cache.
std::ptrdiff_t l1, l2; std::ptrdiff_t l1, l2, initial_n;
typedef gebp_traits<LhsScalar,RhsScalar> Traits; typedef gebp_traits<LhsScalar,RhsScalar> Traits;
enum { enum {
...@@ -98,11 +98,12 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd ...@@ -98,11 +98,12 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
mr_mask = (0xffffffff/mr)*mr mr_mask = (0xffffffff/mr)*mr
}; };
initial_n = n;
manage_caching_sizes(GetAction, &l1, &l2); manage_caching_sizes(GetAction, &l1, &l2);
k = std::min<std::ptrdiff_t>(k, l1/kdiv); k = std::min<std::ptrdiff_t>(k, l1/kdiv);
std::ptrdiff_t _m = k>0 ? l2/(4 * sizeof(LhsScalar) * k) : 0; std::ptrdiff_t _m = k>0 ? l2/(4 * sizeof(LhsScalar) * k) : 0;
if(_m<m) m = _m & mr_mask; 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> template<typename LhsScalar, typename RhsScalar>
......
...@@ -293,6 +293,9 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas) ...@@ -293,6 +293,9 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas)
*/ */
void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas) void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas)
{ {
if (uas == this->uas)
return; //no need to rewire
// Disconnect the previous one (if any) // Disconnect the previous one (if any)
forgetUAS(this->uas); forgetUAS(this->uas);
......
...@@ -14,12 +14,9 @@ QGCConfigView::QGCConfigView(QWidget *parent) : ...@@ -14,12 +14,9 @@ QGCConfigView::QGCConfigView(QWidget *parent) :
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(activeUASChanged(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(activeUASChanged(UASInterface*)));
if (ui->waitingLabel) { //don't show a configuration widget if no vehicle is connected
ui->gridLayout->removeWidget(ui->waitingLabel); //show a placeholder informational widget instead
delete ui->waitingLabel;
ui->waitingLabel = NULL;
}
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
} }
QGCConfigView::~QGCConfigView() QGCConfigView::~QGCConfigView()
...@@ -32,26 +29,31 @@ void QGCConfigView::activeUASChanged(UASInterface* uas) ...@@ -32,26 +29,31 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
if (currUAS == uas) if (currUAS == uas)
return; return;
if (ui->waitingLabel) { //remove all child widgets since they could contain stale data
ui->gridLayout->removeWidget(ui->waitingLabel); //for example, when we switch from one PX4 UAS to another UAS
delete ui->waitingLabel; foreach (QObject* obj, ui->gridLayout->children()) {
ui->waitingLabel = NULL; QWidget* w = dynamic_cast<QWidget*>(obj);
} if (w) {
ui->gridLayout->removeWidget(w);
if (currUAS && currUAS->getAutopilotType() != uas->getAutopilotType()) { if (obj != ui->waitingLabel)
foreach (QObject* obj, ui->gridLayout->children()) {
QWidget* w = dynamic_cast<QWidget*>(obj);
if (w) {
ui->gridLayout->removeWidget(w);
delete obj; delete obj;
}
} }
} }
switch (uas->getAutopilotType()) { if (NULL != uas) {
case MAV_AUTOPILOT_PX4: ui->gridLayout->removeWidget(ui->waitingLabel);
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
default: switch (uas->getAutopilotType()) {
ui->gridLayout->addWidget(new QGCVehicleConfig()); 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 @@ ...@@ -18,6 +18,12 @@
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "ui_QGCPX4VehicleConfig.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) : QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
QWidget(parent), QWidget(parent),
mav(NULL), mav(NULL),
...@@ -107,22 +113,23 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -107,22 +113,23 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
} }
void QGCPX4VehicleConfig::rcMenuButtonClicked() void QGCPX4VehicleConfig::rcMenuButtonClicked()
{ {
ui->stackedWidget->setCurrentIndex(0); //TODO eg ui->stackedWidget->findChild("rcConfig");
ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_RC);
} }
void QGCPX4VehicleConfig::sensorMenuButtonClicked() void QGCPX4VehicleConfig::sensorMenuButtonClicked()
{ {
ui->stackedWidget->setCurrentIndex(1); ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_SENSOR_CAL);
} }
void QGCPX4VehicleConfig::generalMenuButtonClicked() void QGCPX4VehicleConfig::generalMenuButtonClicked()
{ {
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-2); ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_GENERAL_CONFIG);
} }
void QGCPX4VehicleConfig::advancedMenuButtonClicked() void QGCPX4VehicleConfig::advancedMenuButtonClicked()
{ {
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-1); ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_ADV_CONFIG);
} }
QGCPX4VehicleConfig::~QGCPX4VehicleConfig() QGCPX4VehicleConfig::~QGCPX4VehicleConfig()
...@@ -288,7 +295,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) ...@@ -288,7 +295,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot)) foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{ {
if (file.toLower().endsWith(".qgw")) { if (file.toLower().endsWith(".qgw")) {
QWidget* parent = left?ui->advancedLeftContents:ui->advancedRightContents; QWidget* parent = ui->advanceColumnContents;
tool = new QGCToolWidget("", parent); tool = new QGCToolWidget("", parent);
if (tool->loadSettings(vehicledir.absoluteFilePath(file), false)) if (tool->loadSettings(vehicledir.absoluteFilePath(file), false))
{ {
...@@ -297,16 +304,8 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) ...@@ -297,16 +304,8 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
box->setTitle(tool->objectName()); box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout(box)); box->setLayout(new QVBoxLayout(box));
box->layout()->addWidget(tool); box->layout()->addWidget(tool);
if (left) ui->advancedColumnLayout->addWidget(box);
{
left = false;
ui->advancedLeftLayout->addWidget(box);
}
else
{
left = true;
ui->advancedRightLayout->addWidget(box);
}
} else { } else {
delete tool; delete tool;
} }
...@@ -808,8 +807,9 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -808,8 +807,9 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
} }
// Do nothing if system is the same // Do nothing if UAS is already visible
if (mav == active) return; if (mav == active)
return;
if (mav) if (mav)
{ {
...@@ -829,11 +829,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -829,11 +829,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
{ {
child->deleteLater(); child->deleteLater();
} }
foreach(QWidget* child, ui->advancedLeftContents->findChildren<QWidget*>()) foreach(QWidget* child, ui->advanceColumnContents->findChildren<QWidget*>())
{
child->deleteLater();
}
foreach(QWidget* child, ui->advancedRightContents->findChildren<QWidget*>())
{ {
child->deleteLater(); child->deleteLater();
} }
...@@ -1184,15 +1180,7 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param ...@@ -1184,15 +1180,7 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param
if (!found) if (!found)
{ {
//New param type, create a QGroupBox for it. //New param type, create a QGroupBox for it.
QWidget* parent; QWidget* parent = ui->advanceColumnContents;
if (ui->advancedLeftLayout->count() > ui->advancedRightLayout->count())
{
parent = ui->advancedRightContents;
}
else
{
parent = ui->advancedLeftContents;
}
// Create the tool, attaching it to the QGroupBox // Create the tool, attaching it to the QGroupBox
QGCToolWidget *tool = new QGCToolWidget("", parent); QGCToolWidget *tool = new QGCToolWidget("", parent);
...@@ -1214,16 +1202,8 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param ...@@ -1214,16 +1202,8 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param
libParamToWidgetMap.insert(parameterName,tool); libParamToWidgetMap.insert(parameterName,tool);
toolWidgets.append(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; toolToBoxMap[tool] = box;
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1256</width> <width>1256</width>
<height>711</height> <height>783</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>133</width> <width>133</width>
<height>691</height> <height>757</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_12"> <layout class="QVBoxLayout" name="verticalLayout_12">
...@@ -889,7 +889,7 @@ Config</string> ...@@ -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; <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; &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; } 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> &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> </property>
</widget> </widget>
...@@ -906,8 +906,8 @@ p, li { white-space: pre-wrap; } ...@@ -906,8 +906,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>530</width> <width>26</width>
<height>574</height> <height>26</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_10">
...@@ -981,8 +981,8 @@ p, li { white-space: pre-wrap; } ...@@ -981,8 +981,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>525</width> <width>16</width>
<height>523</height> <height>16</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
...@@ -1018,8 +1018,8 @@ p, li { white-space: pre-wrap; } ...@@ -1018,8 +1018,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>524</width> <width>16</width>
<height>523</height> <height>16</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
...@@ -1065,10 +1065,10 @@ p, li { white-space: pre-wrap; } ...@@ -1065,10 +1065,10 @@ p, li { white-space: pre-wrap; }
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QComboBox" name="fixedWingComboBox"/> <widget class="QComboBox" name="platformSelectorComboBox"/>
</item> </item>
<item> <item>
<widget class="QPushButton" name="loadFixedWingDefaultsButton"> <widget class="QPushButton" name="loadPlatformDefaultsButton">
<property name="text"> <property name="text">
<string>Load Platform Defaults</string> <string>Load Platform Defaults</string>
</property> </property>
...@@ -1092,13 +1092,13 @@ p, li { white-space: pre-wrap; } ...@@ -1092,13 +1092,13 @@ p, li { white-space: pre-wrap; }
<property name="widgetResizable"> <property name="widgetResizable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QWidget" name="advancedLeftContents"> <widget class="QWidget" name="advanceColumnContents">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>525</width> <width>928</width>
<height>523</height> <height>562</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
...@@ -1106,7 +1106,7 @@ p, li { white-space: pre-wrap; } ...@@ -1106,7 +1106,7 @@ p, li { white-space: pre-wrap; }
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="advancedLeftLayout"/> <layout class="QVBoxLayout" name="advancedColumnLayout"/>
</item> </item>
</layout> </layout>
</widget> </widget>
...@@ -1124,31 +1124,6 @@ p, li { white-space: pre-wrap; } ...@@ -1124,31 +1124,6 @@ p, li { white-space: pre-wrap; }
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </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> </layout>
</widget> </widget>
</item> </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