Commit 49c71137 authored by pixhawk's avatar pixhawk

Minor improvements in UAS display

parent 36a43a28
# -------------------------------------------------
# MAVGround - Micro Air Vehicle Groundstation
# Please see our website at <http://pixhawk.ethz.ch>
# Original Author:
# Lorenz Meier <mavteam@student.ethz.ch>
# Contributing Authors (in alphabetical order):
# (c) 2009 PIXHAWK Team
# This file is part of the mav groundstation project
# MAVGround is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# MAVGround is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with MAVGround. If not, see <http://www.gnu.org/licenses/>.
# ABOUT THIS FILE:
# This file includes the MAVLink protocol from outside the groundstation directory
# Change the MAVLINKDIR to whereever the MAVLink .c and .h files are located.
# DO NOT USE A TRAILING SLASH!
# ------------------------------------------------------------------------------
MAVLINKDIR = ../embedded/src/comm/mavlink
INCLUDEPATH += $$MAVLINKDIR
HEADERS += \
$$MAVLINKDIR/mavlink.h
SOURCES += $$MAVLINKDIR/protocol.c
......@@ -94,12 +94,12 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
// Start the user interface
splashScreen->showMessage(tr("Starting User Interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
startUI();
// Start UI
mainWindow = new MainWindow();
// Remove splash screen
splashScreen->finish(mainWindow);
}
/**
......@@ -133,12 +133,4 @@ void Core::startUASManager()
UASManager::instance();
}
/**
* @brief Start and show the user interface.
**/
void Core::startUI()
{
// Start UI
mainWindow = new MainWindow();
}
......@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/**
* @file
* @brief Main class
* @brief Definition of main class
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
......@@ -65,8 +65,6 @@ protected:
**/
void startUASManager();
void startUI();
private:
MainWindow* mainWindow;
//ViconTarsusProtocol* tarsus;
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>362</width>
<height>116</height>
<height>120</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -201,7 +201,7 @@ QProgressBar::chunk#thrustBar {
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="uasViewFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
......
......@@ -45,6 +45,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
stateDesc(tr("Unknown system state")),
mode("MAV_MODE_UNKNOWN"),
thrust(0),
isActive(false),
m_ui(new Ui::UASView)
{
this->uas = uas;
......@@ -67,7 +68,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(uas, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
// Setup UAS selection
connect(m_ui->groupBox, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool)));
connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool)));
// Setup user interaction
connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
......@@ -90,20 +91,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
m_ui->nameLabel->setText(uas->getUASName());
}
// Get min/max values from UAS
// TODO get these values from UAS
//m_ui->speedBar->setMinimum(0);
//m_ui->speedBar->setMaximum(15);
// UAS color
QColor uasColor = uas->getColor();
uasColor = uasColor.darker(475);
QString colorstyle;
colorstyle = colorstyle.sprintf("QGroupBox { border: 2px solid #4A4A4F; border-radius: 5px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}",
uasColor.red(), uasColor.green(), uasColor.blue());
m_ui->groupBox->setStyleSheet(colorstyle);
//m_ui->groupBox->setAutoFillBackground(true);
setBackgroundColor();
// Heartbeat fade
refreshTimer = new QTimer(this);
......@@ -116,9 +104,35 @@ UASView::~UASView()
delete m_ui;
}
void UASView::setUASasActive(bool)
/**
* Set the background color based on the MAV color. If the MAV is selected as the
* currently actively controlled system, the frame color is highlighted
*/
void UASView::setBackgroundColor()
{
// UAS color
QColor uasColor = uas->getColor();
QString colorstyle;
QString borderColor = "#4A4A4F";
if (isActive)
{
borderColor = "#FA4A4F";
uasColor = uasColor.darker(475);
}
else
{
uasColor = uasColor.darker(675);
}
colorstyle = colorstyle.sprintf("QGroupBox { border-radius: 5px; 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);
}
void UASView::setUASasActive(bool active)
{
UASManager::instance()->setActiveUAS(this->uas);
this->isActive = active;
setBackgroundColor();
}
void UASView::updateMode(int sysId, QString status, QString description)
......
......@@ -69,6 +69,8 @@ public slots:
void setSystemType(UASInterface* uas, unsigned int systemType);
/** @brief Set the current UAS as the globally active system */
void setUASasActive(bool);
/** @brief Set the background color for the widget */
void setBackgroundColor();
protected:
void changeEvent(QEvent *e);
......@@ -82,7 +84,8 @@ protected:
QString state;
QString stateDesc;
QString mode;
double thrust;
double thrust; ///< Current vehicle thrust: 0 - 1.0 for 100% thrust
bool isActive; ///< Is this MAV selected by the user?
void mouseDoubleClickEvent (QMouseEvent * event);
/** @brief Mouse enters the widget */
......
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