diff --git a/lib/QMapControl/src/googlesatmapadapter.cpp b/lib/QMapControl/src/googlesatmapadapter.cpp index a2e3edefbe1b4d3f1e273c56c37193210e86d65f..5692b29489c36eae9c9d44ef54ed0964b5dee94a 100644 --- a/lib/QMapControl/src/googlesatmapadapter.cpp +++ b/lib/QMapControl/src/googlesatmapadapter.cpp @@ -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"; // diff --git a/lib/QMapControl/src/mapcontrol.cpp b/lib/QMapControl/src/mapcontrol.cpp index 2872765dab8b14751d843c93fccfce9b839bcdca..c01a95e81b3f1161052edca18e3262958386849a 100644 --- a/lib/QMapControl/src/mapcontrol.cpp +++ b/lib/QMapControl/src/mapcontrol.cpp @@ -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 diff --git a/lib/QMapControl/src/mapcontrol.h b/lib/QMapControl/src/mapcontrol.h index d0d434e1bbe3bdb1a86787b1c149982ddcaf458b..db790f48fdec98bc4e310504a2e1a1d34463c0cf 100644 --- a/lib/QMapControl/src/mapcontrol.h +++ b/lib/QMapControl/src/mapcontrol.h @@ -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; diff --git a/lib/QMapControl/src/mapnetwork.cpp b/lib/QMapControl/src/mapnetwork.cpp index 155d9202f1029ec00851f6d1e8cddbe2e3e41c2c..7fba8ae5306055e103de8e7508b644e97f8f89b5 100644 --- a/lib/QMapControl/src/mapnetwork.cpp +++ b/lib/QMapControl/src/mapnetwork.cpp @@ -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__; } } diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index c0510dbc7aa3e6521f347a43224eafc41c096682..1dfb0680364f86fac7d23965deb8adab4b35d958 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -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; } } diff --git a/src/ui/DebugConsole.ui b/src/ui/DebugConsole.ui index e22d2f22c33d52a70e88da849d4a9692c75dcfa5..8a8fe506f1ea3e46c5ed7e86a88b50917c5a5149 100644 --- a/src/ui/DebugConsole.ui +++ b/src/ui/DebugConsole.ui @@ -6,8 +6,8 @@ 0 0 - 447 - 181 + 469 + 190 @@ -24,7 +24,7 @@ 6 - + @@ -81,6 +81,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -107,12 +120,18 @@ - + 5 + + + 100 + 16777215 + + 10 @@ -188,6 +207,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 5 + 20 + + + + diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 90c22ae57fe383cd2be7c465f694170a27e3e8b9..1fb7c7e5e7c968b1f153a65ef55db0d73dd3cdce 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -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) diff --git a/src/ui/Linechart.ui b/src/ui/Linechart.ui index bad25b0b120a656ff685daf18095e4bd30182ca9..b6e1df340ed20b2eab53f5713cd193a624827b38 100644 --- a/src/ui/Linechart.ui +++ b/src/ui/Linechart.ui @@ -25,7 +25,7 @@ Form - + 3 @@ -51,8 +51,14 @@ - 250 - 300 + 90 + 200 + + + + + 370 + 16777215 @@ -71,21 +77,21 @@ - + 0 0 - 240 - 250 + 60 + 150 - 150 - 200 + 60 + 150 @@ -108,7 +114,7 @@ 0 0 - 242 + 210 361 @@ -122,14 +128,14 @@ - 9 + 0 0 - 400 - 300 + 200 + 200 diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 5d8a867d9b10864b81376682db413af0ced20095..363e2f4503ddfeb0a1c3708e8fd84ffcb6798cd9 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -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"; diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 04e29f07d6ea25d71fa1948c9c69b018dd0037a9..df1cfb0a5a7fe579b857b3e67369aae9735aae3a 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -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; diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index c8165aea35e0cb3570a85358432334a3e21071a0..ebd66090415f8a76df209254a4bc495281d1dc0f 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -6,8 +6,8 @@ 0 0 - 1000 - 800 + 800 + 500 @@ -31,14 +31,27 @@ - + + + + 0 + 0 + + + + + 200 + 150 + + + 0 0 - 1000 - 22 + 800 + 25 diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index cda58c62dc871b06a42c75abdda6bfe93d1ba785..443ee5ff27442d0fdb7c026734319729a28f3d42 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -14,6 +14,7 @@ #include #include +#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 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) { diff --git a/src/ui/MapWidget.h b/src/ui/MapWidget.h index 53654331631c1020f0a4ce39ec0e05a20b0a51af..d8474cbf5c8bfebed1ee3f9da3ce2767519837c2 100644 --- a/src/ui/MapWidget.h +++ b/src/ui/MapWidget.h @@ -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); diff --git a/src/ui/UASView.ui b/src/ui/UASView.ui index ceadfa1b901bd2e244fdaa86e2f9f12a42da4dde..1b0cdea4aeddee0cc5e4a68ed327b7063549fffc 100644 --- a/src/ui/UASView.ui +++ b/src/ui/UASView.ui @@ -6,8 +6,8 @@ 0 0 - 335 - 121 + 310 + 111 @@ -18,7 +18,7 @@ - 335 + 260 0 @@ -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 { } + + 2 + - 6 + 2 @@ -206,26 +209,26 @@ QProgressBar::chunk#thrustBar { - 6 + 4 2 - 6 + 4 - 48 - 48 + 44 + 44 - 48 - 48 + 44 + 44 diff --git a/src/ui/designer/QGCParamSlider.cc b/src/ui/designer/QGCParamSlider.cc index f5290b0347c54c9ab4940b256f78afa81932e6b5..6164cfcf1891d4e039eb71a27124a771fc38ecae 100644 --- a/src/ui/designer/QGCParamSlider.cc +++ b/src/ui/designer/QGCParamSlider.cc @@ -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"; } diff --git a/src/ui/designer/QGCParamSlider.h b/src/ui/designer/QGCParamSlider.h index 51bd73b85aac8fa344d90ebc4a5995d8f62f514a..07b9cdea3f9d08a0f1c081399605b3a711e9c3bc 100644 --- a/src/ui/designer/QGCParamSlider.h +++ b/src/ui/designer/QGCParamSlider.h @@ -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; }; diff --git a/src/ui/designer/QGCParamSlider.ui b/src/ui/designer/QGCParamSlider.ui index c7022526a3727edbd9717f22775090df76833dff..7f195cb5d743138d4a141838de07e84f89f007ec 100644 --- a/src/ui/designer/QGCParamSlider.ui +++ b/src/ui/designer/QGCParamSlider.ui @@ -6,8 +6,8 @@ 0 0 - 436 - 136 + 499 + 173 @@ -15,50 +15,21 @@ - + Informal Name.. - - - - - Float - - - - - Integer - - - - - Double - - - - - Short - - - - - Byte/Char - - - - - - + + Min - - + + Max @@ -78,37 +49,45 @@ - - + + - + Qt::Horizontal - - + + - - + + - Done + Please configure the parameter slider now: - - - - - Select Parameter.. - - + + + + TextLabel + - - + + + + + + + Done + + + + + true @@ -117,11 +96,13 @@ - - - - Please configure the parameter slider now: - + + + + + Select Parameter.. + + diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index 704b83bb2eb46d19f6eec49077c034917d16ad3b..94790b69eb8f506062768bdcf68c4efe3acb1435 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -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); diff --git a/src/ui/uas/UASListWidget.cc b/src/ui/uas/UASListWidget.cc index e8a4f4e28d9953ff31c2ce1eb0ec3cfa9bf36588..b505d4fe3a0d03b4649adf06adce09cecd26701a 100644 --- a/src/ui/uas/UASListWidget.cc +++ b/src/ui/uas/UASListWidget.cc @@ -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(); diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 01bd37d7fc52d85d7af111347b501dc41498a69a..afb1fb0e56c53a7a714213b835c1ca6707ee9940 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -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); diff --git a/src/ui/uas/UASView.h b/src/ui/uas/UASView.h index 74dcc3c963feb5629514d19e682b4acaef5e910f..b96103d16a95636ff9b08066b91e44e7aa341a01 100644 --- a/src/ui/uas/UASView.h +++ b/src/ui/uas/UASView.h @@ -99,6 +99,7 @@ protected: float lon; float alt; float groundDistance; + bool localFrame; static const int updateInterval = 300;