Commit 3e383c01 authored by Michael Carpenter's avatar Michael Carpenter

Standard and Advanced param pages, auto-generated from xml file

parent 897ee64f
......@@ -257,7 +257,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/configuration/FailSafeConfig.ui \
src/ui/configuration/AdvancedParamConfig.ui \
src/ui/configuration/ArduCopterPidConfig.ui \
src/ui/configuration/ApmPlaneLevel.ui
src/ui/configuration/ApmPlaneLevel.ui \
src/ui/configuration/ParamWidget.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -439,7 +440,8 @@ HEADERS += src/MG.h \
src/ui/configuration/FailSafeConfig.h \
src/ui/configuration/AdvancedParamConfig.h \
src/ui/configuration/ArduCopterPidConfig.h \
src/ui/configuration/ApmPlaneLevel.h
src/ui/configuration/ApmPlaneLevel.h \
src/ui/configuration/ParamWidget.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
......@@ -639,7 +641,8 @@ SOURCES += src/main.cc \
src/ui/configuration/FailSafeConfig.cc \
src/ui/configuration/AdvancedParamConfig.cc \
src/ui/configuration/ArduCopterPidConfig.cc \
src/ui/configuration/ApmPlaneLevel.cc
src/ui/configuration/ApmPlaneLevel.cc \
src/ui/configuration/ParamWidget.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
#include "AdvancedParamConfig.h"
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
}
......@@ -9,3 +9,27 @@ AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
AdvancedParamConfig::~AdvancedParamConfig()
{
}
void AdvancedParamConfig::addRange(QString title,QString description,QString param,double min,double max)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupDouble(title + "(" + param + ")",description,0,min,max);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupCombo(title + "(" + param + ")",description,valuelist);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (paramToWidgetMap.contains(parameterName))
{
paramToWidgetMap[parameterName]->setValue(value.toDouble());
}
}
......@@ -3,16 +3,21 @@
#include <QWidget>
#include "ui_AdvancedParamConfig.h"
class AdvancedParamConfig : public QWidget
#include "AP2ConfigWidget.h"
#include "ParamWidget.h"
class AdvancedParamConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AdvancedParamConfig(QWidget *parent = 0);
~AdvancedParamConfig();
void addRange(QString title,QString description,QString param,double min,double max);
void addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist);
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,ParamWidget*> paramToWidgetMap;
Ui::AdvancedParamConfig ui;
};
......
......@@ -6,26 +6,44 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>725</width>
<height>632</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>181</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>705</width>
<height>585</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
......
......@@ -30,7 +30,6 @@ This file is part of the QGROUNDCONTROL project
*/
#include "ApmHardwareConfig.h"
ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
......@@ -191,4 +190,10 @@ void ApmHardwareConfig::activeUASSet(UASInterface *uas)
ui.optionalHardwareButton->setChecked(false);
ui.radio3DRButton->setVisible(false);
ui.antennaTrackerButton->setVisible(false);
}
This diff is collapsed.
This diff is collapsed.
#include "StandardParamConfig.h"
#include "ParamWidget.h"
StandardParamConfig::StandardParamConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
}
StandardParamConfig::~StandardParamConfig()
{
}
StandardParamConfig::StandardParamConfig(QWidget *parent) : QWidget(parent)
void StandardParamConfig::activeUASSet(UASInterface *uas)
{
ui.setupUi(this);
AP2ConfigWidget::activeUASSet(uas);
}
void StandardParamConfig::addRange(QString title,QString description,QString param,double min,double max)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupDouble(title + "(" + param + ")",description,0,min,max);
ui.verticalLayout->addWidget(widget);
widget->show();
}
StandardParamConfig::~StandardParamConfig()
void StandardParamConfig::addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupCombo(title + "(" + param + ")",description,valuelist);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void StandardParamConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (paramToWidgetMap.contains(parameterName))
{
paramToWidgetMap[parameterName]->setValue(value.toDouble());
}
}
......@@ -3,16 +3,22 @@
#include <QWidget>
#include "ui_StandardParamConfig.h"
class StandardParamConfig : public QWidget
#include "AP2ConfigWidget.h"
#include "ParamWidget.h"
class StandardParamConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit StandardParamConfig(QWidget *parent = 0);
~StandardParamConfig();
void addRange(QString title,QString description,QString param,double min,double max);
void addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist);
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,ParamWidget*> paramToWidgetMap;
void activeUASSet(UASInterface *uas);
Ui::StandardParamConfig ui;
};
......
......@@ -6,26 +6,44 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>651</width>
<height>552</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>201</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Standard Params&lt;/h2&gt;</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Standard Params&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>631</width>
<height>505</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
......
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