Commit 297d2ac5 authored by lm's avatar lm

Cleaned up Unmanned systems list widget, reduced size requirements of the widget

parent 7d609bc3
...@@ -956,27 +956,27 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc ...@@ -956,27 +956,27 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc
{ {
case MAV_STATE_UNINIT: case MAV_STATE_UNINIT:
uasState = tr("UNINIT"); uasState = tr("UNINIT");
stateDescription = tr("Not initialized"); stateDescription = tr("Waiting..");
break; break;
case MAV_STATE_BOOT: case MAV_STATE_BOOT:
uasState = tr("BOOT"); uasState = tr("BOOT");
stateDescription = tr("Booting system, please wait.."); stateDescription = tr("Booting..");
break; break;
case MAV_STATE_CALIBRATING: case MAV_STATE_CALIBRATING:
uasState = tr("CALIBRATING"); uasState = tr("CALIBRATING");
stateDescription = tr("Calibrating sensors.."); stateDescription = tr("Calibrating..");
break; break;
case MAV_STATE_ACTIVE: case MAV_STATE_ACTIVE:
uasState = tr("ACTIVE"); uasState = tr("ACTIVE");
stateDescription = tr("Normal operation mode"); stateDescription = tr("Normal");
break; break;
case MAV_STATE_STANDBY: case MAV_STATE_STANDBY:
uasState = tr("STANDBY"); uasState = tr("STANDBY");
stateDescription = tr("Standby, operational"); stateDescription = tr("Standby, OK");
break; break;
case MAV_STATE_CRITICAL: case MAV_STATE_CRITICAL:
uasState = tr("CRITICAL"); uasState = tr("CRITICAL");
stateDescription = tr("Failure occured!"); stateDescription = tr("FAILURE: Continue");
break; break;
case MAV_STATE_EMERGENCY: case MAV_STATE_EMERGENCY:
uasState = tr("EMERGENCY"); uasState = tr("EMERGENCY");
...@@ -984,11 +984,11 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc ...@@ -984,11 +984,11 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc
break; break;
case MAV_STATE_POWEROFF: case MAV_STATE_POWEROFF:
uasState = tr("SHUTDOWN"); uasState = tr("SHUTDOWN");
stateDescription = tr("Powering off system"); stateDescription = tr("Powering off");
break; break;
default: default:
uasState = tr("UNKNOWN"); uasState = tr("UNKNOWN");
stateDescription = tr("FAILURE: Unknown system state"); stateDescription = tr("Unknown state");
break; break;
} }
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>447</width> <width>469</width>
<height>181</height> <height>190</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0" colspan="2"> <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> <item>
<widget class="QComboBox" name="linkComboBox"> <widget class="QComboBox" name="linkComboBox">
<property name="maximumSize"> <property name="maximumSize">
...@@ -81,6 +81,19 @@ ...@@ -81,6 +81,19 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
...@@ -107,12 +120,18 @@ ...@@ -107,12 +120,18 @@
</widget> </widget>
</item> </item>
<item row="4" column="1"> <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"> <property name="spacing">
<number>5</number> <number>5</number>
</property> </property>
<item> <item>
<widget class="QComboBox" name="specialComboBox"> <widget class="QComboBox" name="specialComboBox">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maxVisibleItems"> <property name="maxVisibleItems">
<number>10</number> <number>10</number>
</property> </property>
...@@ -188,6 +207,22 @@ ...@@ -188,6 +207,22 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QPushButton" name="holdButton"> <widget class="QPushButton" name="holdButton">
<property name="text"> <property name="text">
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>335</width> <width>310</width>
<height>121</height> <height>111</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>335</width> <width>260</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
...@@ -73,12 +73,12 @@ QLabel#timeRemainingLabel { ...@@ -73,12 +73,12 @@ QLabel#timeRemainingLabel {
} }
QLabel#waypointLabel { QLabel#waypointLabel {
font: 24px; font: 22px;
} }
QGroupBox { QGroupBox {
border: 1px solid #4A4A4F; border: 1px solid #4A4A4F;
border-radius: 5px; border-radius: 10px;
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
margin: 0px; margin: 0px;
} }
...@@ -98,7 +98,7 @@ QGroupBox#heartbeatIcon { ...@@ -98,7 +98,7 @@ QGroupBox#heartbeatIcon {
QToolButton#typeButton { QToolButton#typeButton {
font-weight: bold; font-weight: bold;
font-size: 12px; font-size: 12px;
border: 2px solid #999999; border: 0px solid #999999;
border-radius: 5px; border-radius: 5px;
min-width:44px; min-width:44px;
max-width: 44px; max-width: 44px;
...@@ -184,8 +184,11 @@ QProgressBar::chunk#thrustBar { ...@@ -184,8 +184,11 @@ QProgressBar::chunk#thrustBar {
}</string> }</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="margin"> <property name="margin">
<number>6</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QGroupBox" name="uasViewFrame"> <widget class="QGroupBox" name="uasViewFrame">
...@@ -206,26 +209,26 @@ QProgressBar::chunk#thrustBar { ...@@ -206,26 +209,26 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>6</number> <number>4</number>
</property> </property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>2</number> <number>2</number>
</property> </property>
<property name="margin"> <property name="margin">
<number>6</number> <number>4</number>
</property> </property>
<item row="0" column="0" rowspan="5" colspan="2"> <item row="0" column="0" rowspan="5" colspan="2">
<widget class="QToolButton" name="typeButton"> <widget class="QToolButton" name="typeButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>48</width> <width>44</width>
<height>48</height> <height>44</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>48</width> <width>44</width>
<height>48</height> <height>44</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
......
...@@ -50,6 +50,8 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA ...@@ -50,6 +50,8 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
m_ui->setupUi(this); m_ui->setupUi(this);
listLayout = new QVBoxLayout(this); listLayout = new QVBoxLayout(this);
listLayout->setMargin(0);
listLayout->setSpacing(3);
listLayout->setAlignment(Qt::AlignTop); listLayout->setAlignment(Qt::AlignTop);
this->setLayout(listLayout); this->setLayout(listLayout);
setObjectName("UNMANNED_SYSTEMS_LIST"); setObjectName("UNMANNED_SYSTEMS_LIST");
...@@ -58,7 +60,7 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA ...@@ -58,7 +60,7 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
uWidget = new QGCUnconnectedInfoWidget(this); uWidget = new QGCUnconnectedInfoWidget(this);
listLayout->addWidget(uWidget); listLayout->addWidget(uWidget);
this->setMinimumWidth(250); this->setMinimumWidth(262);
uasViews = QMap<UASInterface*, UASView*>(); uasViews = QMap<UASInterface*, UASView*>();
......
...@@ -59,6 +59,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -59,6 +59,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
lon(0), lon(0),
alt(0), alt(0),
groundDistance(0), groundDistance(0),
localFrame(false),
m_ui(new Ui::UASView) m_ui(new Ui::UASView)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
...@@ -109,6 +110,19 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -109,6 +110,19 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
// Heartbeat fade // Heartbeat fade
refreshTimer = new QTimer(this); refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); 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() UASView::~UASView()
...@@ -135,7 +149,7 @@ void UASView::setBackgroundColor() ...@@ -135,7 +149,7 @@ void UASView::setBackgroundColor()
{ {
uasColor = uasColor.darker(675); 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()); uasColor.red(), uasColor.green(), uasColor.blue(), borderColor.toStdString().c_str());
m_ui->uasViewFrame->setStyleSheet(colorstyle); m_ui->uasViewFrame->setStyleSheet(colorstyle);
} }
...@@ -286,11 +300,15 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) ...@@ -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) void UASView::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec)
{ {
Q_UNUSED(usec); Q_UNUSED(usec);
if (uas == this->uas) Q_UNUSED(uas);
{
this->x = x; this->x = x;
this->y = y; this->y = y;
this->z = z; this->z = z;
if (!localFrame)
{
localFrame = true;
m_ui->gpsLabel->hide();
m_ui->positionLabel->show();
} }
} }
...@@ -404,7 +422,7 @@ void UASView::refresh() ...@@ -404,7 +422,7 @@ void UASView::refresh()
// Position // Position
QString 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); m_ui->positionLabel->setText(position);
QString globalPosition; QString globalPosition;
QString latIndicator; QString latIndicator;
...@@ -425,23 +443,22 @@ void UASView::refresh() ...@@ -425,23 +443,22 @@ void UASView::refresh()
{ {
lonIndicator = "W"; 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); m_ui->gpsLabel->setText(globalPosition);
// Altitude // Altitude
if (groundDistance == 0 && alt != 0) 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 else
{ {
m_ui->groundDistanceLabel->setText(QString("%1 m").arg(groundDistance)); m_ui->groundDistanceLabel->setText(QString("%1 m").arg(groundDistance, 5, 'f', 1, '0'));
} }
// Speed // Speed
QString speed; QString speed("%1 m/s");
speed = speed.sprintf("%02.2f m/s", totalSpeed); m_ui->speedLabel->setText(speed.arg(totalSpeed, 4, 'f', 1, '0'));
m_ui->speedLabel->setText(speed);
// Thrust // Thrust
m_ui->thrustBar->setValue(thrust * 100); m_ui->thrustBar->setValue(thrust * 100);
...@@ -461,7 +478,7 @@ void UASView::refresh() ...@@ -461,7 +478,7 @@ void UASView::refresh()
} }
else else
{ {
m_ui->timeRemainingLabel->setText(tr("Calculating")); m_ui->timeRemainingLabel->setText(tr("Calc.."));
} }
// Time Elapsed // Time Elapsed
...@@ -482,7 +499,7 @@ void UASView::refresh() ...@@ -482,7 +499,7 @@ void UASView::refresh()
heartbeatColor = heartbeatColor.darker(150); heartbeatColor = heartbeatColor.darker(150);
QString colorstyle; 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()); heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue());
m_ui->heartbeatIcon->setStyleSheet(colorstyle); m_ui->heartbeatIcon->setStyleSheet(colorstyle);
m_ui->heartbeatIcon->setAutoFillBackground(true); m_ui->heartbeatIcon->setAutoFillBackground(true);
......
...@@ -99,6 +99,7 @@ protected: ...@@ -99,6 +99,7 @@ protected:
float lon; float lon;
float alt; float alt;
float groundDistance; float groundDistance;
bool localFrame;
static const int updateInterval = 300; 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