diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index a4dfc8e..9e899b7 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -140,7 +140,8 @@ HEADERS += src/MG.h \ src/comm/MAVLinkSyntaxHighlighter.h \ src/ui/watchdog/WatchdogControl.h \ src/ui/watchdog/WatchdogProcessView.h \ - src/ui/watchdog/WatchdogView.h + src/ui/watchdog/WatchdogView.h \ + src/ui/HSIDisplay.h SOURCES += src/main.cc \ src/Core.cc \ src/uas/UASManager.cc \ @@ -193,5 +194,6 @@ SOURCES += src/main.cc \ src/comm/MAVLinkSyntaxHighlighter.cc \ src/ui/watchdog/WatchdogControl.cc \ src/ui/watchdog/WatchdogProcessView.cc \ - src/ui/watchdog/WatchdogView.cc + src/ui/watchdog/WatchdogView.cc \ + src/ui/HSIDisplay.cc RESOURCES = mavground.qrc diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index 8e74d1d..6bbe2f4 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -74,6 +74,12 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : { //m_ui->setupUi(this); + // Check if acceptlist exists + if (!acceptList) + { + acceptList = new QStringList(); + } + this->setMinimumHeight(125); this->setMinimumWidth(100); @@ -146,7 +152,7 @@ void HDDisplay::paintDisplay() painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); const int columns = 3; const float spacing = 0.4f; // 40% of width - const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f)); + const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f)); const QColor gaugeColor = QColor(200, 200, 200); //drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); //drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index d521637..88af81f 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -31,14 +31,15 @@ This file is part of the PIXHAWK project #include #include +#include #include "UASManager.h" #include "HSIDisplay.h" #include "MG.h" #include -HSIDisplay::HSIDisplay(QStringList* plotList, QWidget *parent) : - HDDisplay(plotList, parent), +HSIDisplay::HSIDisplay(QWidget *parent) : + HDDisplay(NULL, parent) { } @@ -68,7 +69,7 @@ void HSIDisplay::paintDisplay() const int columns = 3; const float spacing = 0.4f; // 40% of width const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f)); - const QColor gaugeColor = QColor(200, 200, 200); + const QColor ringColor = QColor(200, 200, 200); //drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); //drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); //drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true); @@ -140,11 +141,10 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw, drawCircle(xRef, yRef, radius, 200.0f, color, painter); //drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter); - QString label; - label.sprintf("%05.1f", value); - - // Draw the value - paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter); +// // Draw the value +// QString label; +// label.sprintf("%05.1f", value); +// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter); // Draw the needle // Scale the rotation so that the gauge does one revolution @@ -172,15 +172,3 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw, painter->setBrush(indexBrush); drawPolygon(p, painter); } - -void HDDisplay::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - m_ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/src/ui/HSIDisplay.h b/src/ui/HSIDisplay.h index 5882da2..69c257a 100644 --- a/src/ui/HSIDisplay.h +++ b/src/ui/HSIDisplay.h @@ -44,8 +44,8 @@ This file is part of the PIXHAWK project class HSIDisplay : public HDDisplay { Q_OBJECT public: - HSIDisplay(QStringList* plotList, QWidget *parent = 0); - ~HSIDisplay(); + HSIDisplay(QWidget *parent = 0); + // ~HSIDisplay(); public slots: void setActiveUAS(UASInterface* uas); diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 9e7584b..11d4994 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -100,6 +100,8 @@ settings() parameters->setVisible(false); watchdogControl = new WatchdogControl(this); watchdogControl->setVisible(false); + hsi = new HSIDisplay(this); + hsi->setVisible(false); QStringList* acceptList = new QStringList(); acceptList->append("roll IMU"); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 2a0d62f..a6149cf 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -61,6 +61,7 @@ This file is part of the PIXHAWK project #include "XMLCommProtocolWidget.h" #include "HDDisplay.h" #include "WatchdogControl.h" +#include "HSIDisplay.h" #include "LogCompressor.h" @@ -148,6 +149,7 @@ protected: HDDisplay* headDown1; HDDisplay* headDown2; WatchdogControl* watchdogControl; + HSIDisplay* hsi; // Popup widgets JoystickWidget* joystickWidget;