Commit 033f60a9 authored by lm's avatar lm

Merge branch 'master' of git://github.com/pixhawk/qgroundcontrol

parents 729f2602 5f497743
......@@ -29,7 +29,7 @@
namespace qmapcontrol
{
GoogleSatMapAdapter::GoogleSatMapAdapter()
: TileMapAdapter("khm.google.com", "/kh?v=51&x=%2&s=&y=%3&z=%1", 256, 0, 18)
: TileMapAdapter("khm.google.com", "/kh?v=51&x=%2&s=&y=%3&z=%1", 256, 9, 21)
{
// // name = "googlesat";
//
......
......@@ -27,7 +27,7 @@
namespace qmapcontrol
{
MapControl::MapControl(QSize size, MouseMode mousemode)
: size(size), mymousemode(mousemode), scaleVisible(false), cursorPosVisible(false)
: size(size), mymousemode(mousemode), scaleVisible(false), cursorPosVisible(false), mapPen(Qt::black)
{
layermanager = new LayerManager(this, size);
screen_middle = QPoint(size.width()/2, size.height()/2);
......@@ -126,6 +126,11 @@ namespace qmapcontrol
}
}
void MapControl::setPen(QPen pen)
{
this->mapPen = pen;
}
void MapControl::paintEvent(QPaintEvent* evnt)
{
QWidget::paintEvent(evnt);
......@@ -160,7 +165,7 @@ namespace qmapcontrol
line = distanceList.at( currentZoom() ) / pow(2.0, 18-currentZoom() ) / 0.597164;
// draw the scale
painter.setPen(Qt::black);
painter.setPen(mapPen);
QPoint p1(10,size.height()-20);
QPoint p2((int)line,size.height()-20);
painter.drawLine(p1,p2);
......@@ -209,7 +214,10 @@ namespace qmapcontrol
// Draw the Lat and Lon if needed
if (cursorPosVisible) {
// FIXME Mariano
if (cursorPosVisible && currentZoom() < 19)
{
line = distanceList.at( currentZoom() ) / pow(2.0, 18-currentZoom() ) / 0.597164;
QString str;
......@@ -336,6 +344,9 @@ namespace qmapcontrol
void MapControl::setZoom(int zoomlevel)
{
layermanager->setZoom(zoomlevel);
qDebug() << "MAPCONTROL: Set zoomlevel to:" << zoomlevel << "at " << __FILE__ << __LINE__;
update();
}
int MapControl::currentZoom() const
......
......@@ -222,6 +222,13 @@ namespace qmapcontrol
*/
void showCoord ( bool show );
//! Set the pen for overlay text
/*!
*
* @param pen The new QPen
*/
void setPen(QPen pen);
private:
LayerManager* layermanager;
QPoint screen_middle; // middle of the widget (half size)
......@@ -239,6 +246,7 @@ namespace qmapcontrol
MouseMode mymousemode;
bool scaleVisible;
bool cursorPosVisible;
QPen mapPen;
bool m_loadingFlag;
......
......@@ -98,6 +98,8 @@ namespace qmapcontrol
// QGC FIXME Error is currently undetected
// TODO Error is currently undetected
//qDebug() << "NETWORK_PIXMAP_ERROR: " << ax;
qDebug() << "QMapControl external library: ERROR loading map:" << "width:" << pm.width() << "heigh:" << pm.height() << "at " << __FILE__ << __LINE__;
qDebug() << "HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
}
......
......@@ -956,27 +956,27 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc
{
case MAV_STATE_UNINIT:
uasState = tr("UNINIT");
stateDescription = tr("Not initialized");
stateDescription = tr("Waiting..");
break;
case MAV_STATE_BOOT:
uasState = tr("BOOT");
stateDescription = tr("Booting system, please wait..");
stateDescription = tr("Booting..");
break;
case MAV_STATE_CALIBRATING:
uasState = tr("CALIBRATING");
stateDescription = tr("Calibrating sensors..");
stateDescription = tr("Calibrating..");
break;
case MAV_STATE_ACTIVE:
uasState = tr("ACTIVE");
stateDescription = tr("Normal operation mode");
stateDescription = tr("Normal");
break;
case MAV_STATE_STANDBY:
uasState = tr("STANDBY");
stateDescription = tr("Standby, operational");
stateDescription = tr("Standby, OK");
break;
case MAV_STATE_CRITICAL:
uasState = tr("CRITICAL");
stateDescription = tr("Failure occured!");
stateDescription = tr("FAILURE: Continue");
break;
case MAV_STATE_EMERGENCY:
uasState = tr("EMERGENCY");
......@@ -984,11 +984,11 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc
break;
case MAV_STATE_POWEROFF:
uasState = tr("SHUTDOWN");
stateDescription = tr("Powering off system");
stateDescription = tr("Powering off");
break;
default:
uasState = tr("UNKNOWN");
stateDescription = tr("FAILURE: Unknown system state");
stateDescription = tr("Unknown state");
break;
}
}
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>447</width>
<height>181</height>
<width>469</width>
<height>190</height>
</rect>
</property>
<property name="windowTitle">
......@@ -24,7 +24,7 @@
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="10,0,0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="10,0,0,0,0,0">
<item>
<widget class="QComboBox" name="linkComboBox">
<property name="maximumSize">
......@@ -81,6 +81,19 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
......@@ -107,12 +120,18 @@
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,10,10,10,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="100,1,10,1,1,1">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QComboBox" name="specialComboBox">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maxVisibleItems">
<number>10</number>
</property>
......@@ -188,6 +207,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="holdButton">
<property name="text">
......
......@@ -194,7 +194,7 @@ HUD::~HUD()
QSize HUD::sizeHint() const
{
return QSize(800, 600);
return QSize(width(), (width()*3.0f)/4);
}
void HUD::showEvent(QShowEvent* event)
......
......@@ -25,7 +25,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="10,20">
<property name="spacing">
<number>3</number>
</property>
......@@ -51,8 +51,14 @@
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>300</height>
<width>90</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>370</width>
<height>16777215</height>
</size>
</property>
<property name="title">
......@@ -71,21 +77,21 @@
<item>
<widget class="QScrollArea" name="curveListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>240</width>
<height>250</height>
<width>60</width>
<height>150</height>
</size>
</property>
<property name="baseSize">
<size>
<width>150</width>
<height>200</height>
<width>60</width>
<height>150</height>
</size>
</property>
<property name="autoFillBackground">
......@@ -108,7 +114,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>242</width>
<width>210</width>
<height>361</height>
</rect>
</property>
......@@ -122,14 +128,14 @@
<widget class="QGroupBox" name="diagramGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>9</horstretch>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>300</height>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="baseSize">
......
......@@ -216,6 +216,19 @@ MainWindow::~MainWindow()
}
void MainWindow::resizeEvent(QResizeEvent * event)
{
Q_UNUSED(event);
if (height() < 800)
{
ui.statusBar->setVisible(false);
}
else
{
ui.statusBar->setVisible(true);
}
}
QString MainWindow::getWindowStateKey()
{
return QString::number(currentView)+"/windowstate";
......
......@@ -297,6 +297,8 @@ protected:
*/
void showTheCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SECTIONS view);
/** @brief Catch window resize events */
void resizeEvent(QResizeEvent * event);
/** @brief Keeps track of the current view */
VIEW_SECTIONS currentView;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<height>800</height>
<width>800</width>
<height>500</height>
</rect>
</property>
<property name="minimumSize">
......@@ -31,14 +31,27 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QWidget" name="centralWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>150</height>
</size>
</property>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<height>22</height>
<width>800</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......
......@@ -14,6 +14,7 @@
#include <QGridLayout>
#include <QDir>
#include "QGC.h"
#include "MapWidget.h"
#include "ui_MapWidget.h"
#include "UASInterface.h"
......@@ -34,6 +35,19 @@ MapWidget::MapWidget(QWidget *parent) :
m_ui(new Ui::MapWidget)
{
m_ui->setupUi(this);
mc = new qmapcontrol::MapControl(QSize(320, 240));
// VISUAL MAP STYLE
QString buttonStyle("QAbstractButton { background-color: rgba(20, 20, 20, 45%); border-color: rgba(10, 10, 10, 50%)}");
mc->setPen(QGC::colorCyan.darker(400));
waypointIsDrag = false;
......@@ -41,7 +55,7 @@ MapWidget::MapWidget(QWidget *parent) :
this->setFocusPolicy(Qt::StrongFocus);
// create MapControl
mc = new qmapcontrol::MapControl(QSize(320, 240));
mc->showScale(true);
mc->showCoord(true);
mc->enablePersistentCache();
......@@ -126,32 +140,35 @@ MapWidget::MapWidget(QWidget *parent) :
mapButton = new QPushButton(this);
mapButton->setText("Map Source");
mapButton->setMenu(mapMenu);
mapButton->setStyleSheet(buttonStyle);
// display the MapControl in the application
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0);
layout->setSpacing(2);
layout->addWidget(mc, 0, 0, 1, 2);
layout->addWidget(mapButton, 1, 0);
layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 1, 1);
layout->setRowStretch(0, 100);
layout->setRowStretch(1, 1);
layout->setColumnStretch(0, 1);
layout->setColumnStretch(1, 50);
layout->setSpacing(0);
layout->addWidget(mc, 0, 0);
setLayout(layout);
// create buttons to control the map (zoom, GPS tracking and WP capture)
QPushButton* zoomin = new QPushButton(QIcon(":/images/actions/list-add.svg"), "", this);
zoomin->setStyleSheet(buttonStyle);
QPushButton* zoomout = new QPushButton(QIcon(":/images/actions/list-remove.svg"), "", this);
zoomout->setStyleSheet(buttonStyle);
createPath = new QPushButton(QIcon(":/images/actions/go-bottom.svg"), "", this);
createPath->setStyleSheet(buttonStyle);
clearTracking = new QPushButton(QIcon(""), "", this);
clearTracking->setStyleSheet(buttonStyle);
followgps = new QPushButton(QIcon(":/images/actions/system-lock-screen.svg"), "", this);
followgps->setStyleSheet(buttonStyle);
QPushButton* goToButton = new QPushButton(QIcon(""), "T", this);
goToButton->setStyleSheet(buttonStyle);
zoomin->setMaximumWidth(30);
zoomout->setMaximumWidth(30);
createPath->setMaximumWidth(30);
clearTracking->setMaximumWidth(30);
followgps->setMaximumWidth(30);
goToButton->setMaximumWidth(30);
// Set checkable buttons
// TODO: Currently checked buttons are are very difficult to distinguish when checked.
......@@ -161,8 +178,8 @@ MapWidget::MapWidget(QWidget *parent) :
// add buttons to control the map (zoom, GPS tracking and WP capture)
QGridLayout* innerlayout = new QGridLayout(mc);
innerlayout->setMargin(5);
innerlayout->setSpacing(5);
innerlayout->setMargin(3);
innerlayout->setSpacing(3);
innerlayout->addWidget(zoomin, 0, 0);
innerlayout->addWidget(zoomout, 1, 0);
innerlayout->addWidget(followgps, 2, 0);
......@@ -170,7 +187,9 @@ MapWidget::MapWidget(QWidget *parent) :
innerlayout->addWidget(clearTracking, 4, 0);
// Add spacers to compress buttons on the top left
innerlayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 5, 0);
innerlayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 0, 1, 0, 6);
innerlayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 0, 1, 0, 7);
innerlayout->addWidget(mapButton, 0, 6);
innerlayout->addWidget(goToButton, 0, 7);
innerlayout->setRowStretch(0, 1);
innerlayout->setRowStretch(1, 100);
mc->setLayout(innerlayout);
......@@ -183,6 +202,8 @@ MapWidget::MapWidget(QWidget *parent) :
connect(zoomout, SIGNAL(clicked(bool)),
mc, SLOT(zoomOut()));
connect(goToButton, SIGNAL(clicked()), this, SLOT(goTo()));
QList<UASInterface*> systems = UASManager::instance()->getUASList();
foreach(UASInterface* system, systems)
{
......@@ -229,6 +250,31 @@ MapWidget::MapWidget(QWidget *parent) :
radioCamera = 10;
}
void MapWidget::goTo()
{
bool ok;
QString text = QInputDialog::getText(this, tr("Please enter coordinates"),
tr("Coordinates (Lat,Lon):"), QLineEdit::Normal,
QString("%1,%2").arg(mc->currentCoordinate().x()).arg(mc->currentCoordinate().y()), &ok);
if (ok && !text.isEmpty())
{
QStringList split = text.split(",");
if (split.length() == 2)
{
bool convert;
double latitude = split.first().toDouble(&convert);
ok &= convert;
double longitude = split.last().toDouble(&convert);
ok &= convert;
if (ok)
{
mc->setView(QPointF(latitude, longitude));
}
}
}
}
void MapWidget::mapproviderSelected(QAction* action)
{
......
......@@ -77,6 +77,8 @@ public slots:
void clearPath();
void changeGlobalWaypointPositionBySpinBox(int index, float lat, float lon);
void drawBorderCamAtMap(bool status);
/** @brief Bring up dialog to go to a specific location */
void goTo();
protected:
void changeEvent(QEvent* e);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>121</height>
<width>310</width>
<height>111</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>335</width>
<width>260</width>
<height>0</height>
</size>
</property>
......@@ -73,12 +73,12 @@ QLabel#timeRemainingLabel {
}
QLabel#waypointLabel {
font: 24px;
font: 22px;
}
QGroupBox {
border: 1px solid #4A4A4F;
border-radius: 5px;
border-radius: 10px;
padding: 0px 0px 0px 0px;
margin: 0px;
}
......@@ -98,7 +98,7 @@ QGroupBox#heartbeatIcon {
QToolButton#typeButton {
font-weight: bold;
font-size: 12px;
border: 2px solid #999999;
border: 0px solid #999999;
border-radius: 5px;
min-width:44px;
max-width: 44px;
......@@ -184,8 +184,11 @@ QProgressBar::chunk#thrustBar {
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>6</number>
<number>2</number>
</property>
<item>
<widget class="QGroupBox" name="uasViewFrame">
......@@ -206,26 +209,26 @@ QProgressBar::chunk#thrustBar {
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>6</number>
<number>4</number>
</property>
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>6</number>
<number>4</number>
</property>
<item row="0" column="0" rowspan="5" colspan="2">
<widget class="QToolButton" name="typeButton">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
<width>44</width>
<height>44</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
<width>44</width>
<height>44</height>
</size>
</property>
<property name="baseSize">
......
......@@ -16,8 +16,21 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
ui(new Ui::QGCParamSlider)
{
ui->setupUi(this);
endEditMode();
connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
scaledInt = ui->valueSlider->maximum() - ui->valueSlider->minimum();
ui->editDoneButton->show();
ui->editMaxLabel->show();
ui->editMinLabel->show();
ui->editNameLabel->show();
ui->editInstructionsLabel->show();
ui->editRefreshParamsButton->show();
ui->editSelectParamComboBox->show();
ui->editSelectComponentComboBox->show();
ui->editStatusLabel->show();
ui->editMinSpinBox->show();
ui->editMaxSpinBox->show();
connect(ui->editDoneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
}
QGCParamSlider::~QGCParamSlider()
......@@ -27,31 +40,33 @@ QGCParamSlider::~QGCParamSlider()
void QGCParamSlider::startEditMode()
{
ui->doneButton->show();
ui->maxLabel->show();
ui->minLabel->show();
ui->nameLineEdit->show();
ui->instructionsLabel->show();
ui->refreshParamsButton->show();
ui->selectParamComboBox->show();
ui->minSpinBox->show();
ui->maxSpinBox->show();
ui->typeComboBox->show();
ui->editDoneButton->show();
ui->editMaxLabel->show();
ui->editMinLabel->show();
ui->editNameLabel->show();
ui->editInstructionsLabel->show();
ui->editRefreshParamsButton->show();
ui->editSelectParamComboBox->show();
ui->editSelectComponentComboBox->show();
ui->editStatusLabel->show();
ui->editMinSpinBox->show();
ui->editMaxSpinBox->show();
isInEditMode = true;
}
void QGCParamSlider::endEditMode()
{
ui->doneButton->hide();
ui->maxLabel->hide();
ui->minLabel->hide();
ui->nameLineEdit->hide();
ui->instructionsLabel->hide();
ui->refreshParamsButton->hide();
ui->selectParamComboBox->hide();
ui->minSpinBox->hide();
ui->maxSpinBox->hide();
ui->typeComboBox->hide();
ui->editDoneButton->hide();
ui->editMaxLabel->hide();
ui->editMinLabel->hide();
ui->editNameLabel->hide();
ui->editInstructionsLabel->hide();
ui->editRefreshParamsButton->hide();
ui->editSelectParamComboBox->hide();
ui->editSelectComponentComboBox->hide();
ui->editStatusLabel->hide();
ui->editMinSpinBox->hide();
ui->editMaxSpinBox->hide();
isInEditMode = false;
emit editingFinished();
}
......@@ -68,6 +83,21 @@ void QGCParamSlider::sendParameter()
}
}
void QGCParamSlider::setSliderValue(int sliderValue)
{
parameterValue = scaledIntToFloat(sliderValue);
QString unit("");
ui->valueLabel->setText(QString("%1 %2").arg(parameterValue, 0, 'f', 3).arg(unit));
}
void QGCParamSlider::setParameterValue(int uas, int component, QString parameterName, float value)
{
parameterValue = value;
QString unit("");
ui->valueLabel->setText(QString("%1 %2").arg(value, 0, 'f', 3).arg(unit));
ui->valueSlider->setValue(floatToScaledInt(value));
}
void QGCParamSlider::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
......@@ -80,12 +110,35 @@ void QGCParamSlider::changeEvent(QEvent *e)
}
}
void QGCParamSlider::writeSettings(QSettings& settings)
float QGCParamSlider::scaledIntToFloat(int sliderValue)
{
return (((double)sliderValue)/scaledInt)*(parameterMax - parameterMin);
}
int QGCParamSlider::floatToScaledInt(float value)
{
return ((value - parameterMin)/(parameterMax - parameterMin))*scaledInt;
}
void QGCParamSlider::readSettings(const QSettings& settings)
void QGCParamSlider::writeSettings(QSettings& settings)
{
settings.setValue("TYPE", "SLIDER");
settings.setValue("QGC_PARAM_SLIDER_DESCRIPTION", ui->nameLabel->text());
//settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
settings.setValue("QGC_PARAM_SLIDER_PARAMID", ui->editSelectParamComboBox->currentText());
settings.setValue("QGC_PARAM_SLIDER_COMPONENTID", ui->editSelectComponentComboBox->currentText());
settings.setValue("QGC_PARAM_SLIDER_MIN", ui->editMinSpinBox->value());
settings.setValue("QGC_PARAM_SLIDER_MAX", ui->editMaxSpinBox->value());
settings.sync();
}
void QGCParamSlider::readSettings(const QSettings& settings)
{
ui->nameLabel->setText(settings.value("QGC_PARAM_SLIDER_DESCRIPTION").toString());
//settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
ui->editSelectParamComboBox->setEditText(settings.value("QGC_PARAM_SLIDER_PARAMID").toString());
ui->editSelectComponentComboBox->setEditText(settings.value("QGC_PARAM_SLIDER_COMPONENTID").toString());
ui->editMinSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MIN").toFloat());
ui->editMaxSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MAX").toFloat());
qDebug() << "DONE READING SETTINGS";
}
......@@ -24,6 +24,10 @@ public slots:
void endEditMode();
/** @brief Send the parameter to the MAV */
void sendParameter();
/** @brief Set the slider value as parameter value */
void setSliderValue(int sliderValue);
/** @brief Update the UI with the new parameter value */
void setParameterValue(int uas, int component, QString parameterName, float value);
void writeSettings(QSettings& settings);
void readSettings(const QSettings& settings);
......@@ -34,8 +38,14 @@ protected:
float parameterMin;
float parameterMax;
int component; ///< ID of the MAV component to address
double scaledInt;
void changeEvent(QEvent *e);
/** @brief Convert scaled int to float */
float scaledIntToFloat(int sliderValue);
int floatToScaledInt(float value);
private:
Ui::QGCParamSlider *ui;
};
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>136</height>
<width>499</width>
<height>173</height>
</rect>
</property>
<property name="windowTitle">
......@@ -15,50 +15,21 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLineEdit" name="nameLineEdit">
<widget class="QLineEdit" name="editNameLabel">
<property name="text">
<string>Informal Name..</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="typeComboBox">
<item>
<property name="text">
<string>Float</string>
</property>
</item>
<item>
<property name="text">
<string>Integer</string>
</property>
</item>
<item>
<property name="text">
<string>Double</string>
</property>
</item>
<item>
<property name="text">
<string>Short</string>
</property>
</item>
<item>
<property name="text">
<string>Byte/Char</string>
</property>
</item>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="minLabel">
<item row="1" column="4">
<widget class="QLabel" name="editMinLabel">
<property name="text">
<string>Min</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QLabel" name="maxLabel">
<item row="1" column="6">
<widget class="QLabel" name="editMaxLabel">
<property name="text">
<string>Max</string>
</property>
......@@ -78,37 +49,45 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QDoubleSpinBox" name="minSpinBox"/>
<item row="2" column="3" colspan="2">
<widget class="QDoubleSpinBox" name="editMinSpinBox"/>
</item>
<item row="2" column="4">
<item row="2" column="5">
<widget class="QSlider" name="valueSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QDoubleSpinBox" name="maxSpinBox"/>
<item row="2" column="6">
<widget class="QDoubleSpinBox" name="editMaxSpinBox"/>
</item>
<item row="3" column="5">
<widget class="QPushButton" name="doneButton">
<item row="0" column="0" colspan="7">
<widget class="QLabel" name="editInstructionsLabel">
<property name="text">
<string>Done</string>
<string>Please configure the parameter slider now:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="selectParamComboBox">
<item>
<property name="text">
<string>Select Parameter..</string>
</property>
</item>
<item row="5" column="0" colspan="6">
<widget class="QLabel" name="editStatusLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QPushButton" name="refreshParamsButton">
<item row="3" column="0" colspan="3">
<widget class="QComboBox" name="editSelectComponentComboBox"/>
</item>
<item row="5" column="6">
<widget class="QPushButton" name="editDoneButton">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QPushButton" name="editRefreshParamsButton">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -117,11 +96,13 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="instructionsLabel">
<property name="text">
<string>Please configure the parameter slider now:</string>
</property>
<item row="3" column="4" colspan="2">
<widget class="QComboBox" name="editSelectParamComboBox">
<item>
<property name="text">
<string>Select Parameter..</string>
</property>
</item>
</widget>
</item>
</layout>
......
......@@ -199,7 +199,7 @@ void LinechartWidget::createLayout()
layout->addWidget(activePlot, 0, 0, 1, 6);
layout->setRowStretch(0, 10);
layout->setRowStretch(1, 0);
layout->setRowStretch(1, 1);
// Linear scaling button
scalingLinearButton = createButton(this);
......
......@@ -50,6 +50,8 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
m_ui->setupUi(this);
listLayout = new QVBoxLayout(this);
listLayout->setMargin(0);
listLayout->setSpacing(3);
listLayout->setAlignment(Qt::AlignTop);
this->setLayout(listLayout);
setObjectName("UNMANNED_SYSTEMS_LIST");
......@@ -58,7 +60,7 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
uWidget = new QGCUnconnectedInfoWidget(this);
listLayout->addWidget(uWidget);
this->setMinimumWidth(250);
this->setMinimumWidth(262);
uasViews = QMap<UASInterface*, UASView*>();
......
......@@ -59,6 +59,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
lon(0),
alt(0),
groundDistance(0),
localFrame(false),
m_ui(new Ui::UASView)
{
m_ui->setupUi(this);
......@@ -109,6 +110,19 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
// Heartbeat fade
refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
// Hide kill and shutdown buttons per default
m_ui->killButton->hide();
m_ui->shutdownButton->hide();
if (localFrame)
{
m_ui->gpsLabel->hide();
}
else
{
m_ui->positionLabel->hide();
}
}
UASView::~UASView()
......@@ -135,7 +149,7 @@ void UASView::setBackgroundColor()
{
uasColor = uasColor.darker(675);
}
colorstyle = colorstyle.sprintf("QGroupBox { border-radius: 5px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X; border: 2px solid %s; }",
colorstyle = colorstyle.sprintf("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X; border: 2px solid %s; }",
uasColor.red(), uasColor.green(), uasColor.blue(), borderColor.toStdString().c_str());
m_ui->uasViewFrame->setStyleSheet(colorstyle);
}
......@@ -286,11 +300,15 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType)
void UASView::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec)
{
Q_UNUSED(usec);
if (uas == this->uas)
Q_UNUSED(uas);
this->x = x;
this->y = y;
this->z = z;
if (!localFrame)
{
this->x = x;
this->y = y;
this->z = z;
localFrame = true;
m_ui->gpsLabel->hide();
m_ui->positionLabel->show();
}
}
......@@ -404,7 +422,7 @@ void UASView::refresh()
// Position
QString position;
position = position.sprintf("%02.2f %02.2f %02.2f m", x, y, z);
position = position.sprintf("%05.1f %05.1f %05.1f m", x, y, z);
m_ui->positionLabel->setText(position);
QString globalPosition;
QString latIndicator;
......@@ -425,23 +443,22 @@ void UASView::refresh()
{
lonIndicator = "W";
}
globalPosition = globalPosition.sprintf("%02.2f%s %02.2f%s %02.2f m", lon, lonIndicator.toStdString().c_str(), lat, latIndicator.toStdString().c_str(), alt);
globalPosition = globalPosition.sprintf("%05.1f%s %05.1f%s %05.1f m", lon, lonIndicator.toStdString().c_str(), lat, latIndicator.toStdString().c_str(), alt);
m_ui->gpsLabel->setText(globalPosition);
// Altitude
if (groundDistance == 0 && alt != 0)
{
m_ui->groundDistanceLabel->setText(QString("%1 m").arg(alt));
m_ui->groundDistanceLabel->setText(QString("%1 m").arg(alt, 5, 'f', 1, '0'));
}
else
{
m_ui->groundDistanceLabel->setText(QString("%1 m").arg(groundDistance));
m_ui->groundDistanceLabel->setText(QString("%1 m").arg(groundDistance, 5, 'f', 1, '0'));
}
// Speed
QString speed;
speed = speed.sprintf("%02.2f m/s", totalSpeed);
m_ui->speedLabel->setText(speed);
QString speed("%1 m/s");
m_ui->speedLabel->setText(speed.arg(totalSpeed, 4, 'f', 1, '0'));
// Thrust
m_ui->thrustBar->setValue(thrust * 100);
......@@ -461,7 +478,7 @@ void UASView::refresh()
}
else
{
m_ui->timeRemainingLabel->setText(tr("Calculating"));
m_ui->timeRemainingLabel->setText(tr("Calc.."));
}
// Time Elapsed
......@@ -482,7 +499,7 @@ void UASView::refresh()
heartbeatColor = heartbeatColor.darker(150);
QString colorstyle;
colorstyle = colorstyle.sprintf("QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}",
colorstyle = colorstyle.sprintf("QGroupBox { border: 1px solid #EEEEEE; border-radius: 8px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}",
heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue());
m_ui->heartbeatIcon->setStyleSheet(colorstyle);
m_ui->heartbeatIcon->setAutoFillBackground(true);
......
......@@ -99,6 +99,7 @@ protected:
float lon;
float alt;
float groundDistance;
bool localFrame;
static const int updateInterval = 300;
......
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