Commit bc33da52 authored by pixhawk's avatar pixhawk
Browse files

Added true audio output

parent 124997d0
......@@ -108,10 +108,14 @@ DebugConsole::~DebugConsole()
delete m_ui;
}
/**
* Add a link to the debug console output
*/
void DebugConsole::addLink(LinkInterface* link)
{
// Add link to link list
links.insert(link->getId(), link);
m_ui->linkComboBox->insertItem(link->getId(), link->getName());
// Set new item as current
m_ui->linkComboBox->setCurrentIndex(qMax(0, links.size() - 1));
......
......@@ -45,6 +45,7 @@ This file is part of the PIXHAWK project
#include "WaypointList.h"
#include "MainWindow.h"
#include "JoystickWidget.h"
#include "GAudioOutput.h"
#include "LogCompressor.h"
......@@ -56,7 +57,7 @@ This file is part of the PIXHAWK project
*
* @see QMainWindow::show()
**/
MGMainWindow::MGMainWindow(QWidget *parent) : QMainWindow(parent)
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
// Quick hack
......@@ -167,20 +168,20 @@ MGMainWindow::MGMainWindow(QWidget *parent) : QMainWindow(parent)
udpLink->connect();
simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt");
connect(simulationLink, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)));
//connect(simulationLink, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)));
LinkManager::instance()->addProtocol(simulationLink, mavlink);
//CommConfigurationWindow* simulationWidget = new CommConfigurationWindow(simulationLink, mavlink, this);
//ui.menuNetwork->addAction(commWidget->getAction());
simulationLink->connect();
}
MGMainWindow::~MGMainWindow()
MainWindow::~MainWindow()
{
delete statusBar;
statusBar = NULL;
}
QStatusBar* MGMainWindow::createStatusBar()
QStatusBar* MainWindow::createStatusBar()
{
QStatusBar* bar = new QStatusBar();
/* Add status fields and messages */
......@@ -189,7 +190,7 @@ QStatusBar* MGMainWindow::createStatusBar()
return bar;
}
void MGMainWindow::startVideoCapture()
void MainWindow::startVideoCapture()
{
QString format = "bmp";
QString initialPath = QDir::currentPath() + tr("/untitled.") + format;
......@@ -205,14 +206,14 @@ void MGMainWindow::startVideoCapture()
connect(videoTimer, SIGNAL(timeout()), this, SLOT(saveScreen()));
}
void MGMainWindow::stopVideoCapture()
void MainWindow::stopVideoCapture()
{
videoTimer->stop();
// TODO Convert raw images to PNG
}
void MGMainWindow::saveScreen()
void MainWindow::saveScreen()
{
QPixmap window = QPixmap::grabWindow(this->winId());
QString format = "bmp";
......@@ -223,7 +224,7 @@ void MGMainWindow::saveScreen()
}
}
void MGMainWindow::reloadStylesheet()
void MainWindow::reloadStylesheet()
{
// Load style sheet
//QFile styleSheet(MG::DIR::getSupportFilesDirectory() + "/images/style-mission.css");
......@@ -237,17 +238,17 @@ void MGMainWindow::reloadStylesheet()
}
}
void MGMainWindow::showStatusMessage(const QString& status, int timeout)
void MainWindow::showStatusMessage(const QString& status, int timeout)
{
statusBar->showMessage(status, timeout);
}
void MGMainWindow::setLastAction(QString status)
void MainWindow::setLastAction(QString status)
{
showStatusMessage(status, 5);
}
void MGMainWindow::setLinkStatus(QString status)
void MainWindow::setLinkStatus(QString status)
{
showStatusMessage(status, 15);
}
......@@ -256,7 +257,7 @@ void MGMainWindow::setLinkStatus(QString status)
* @brief Create all actions associated to the main window
*
**/
void MGMainWindow::connectActions()
void MainWindow::connectActions()
{
// Connect actions from ui
connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink()));
......@@ -283,12 +284,12 @@ void MGMainWindow::connectActions()
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
}
void MGMainWindow::configure()
void MainWindow::configure()
{
joystickWidget = new JoystickWidget(joystick, this);
}
void MGMainWindow::addLink()
void MainWindow::addLink()
{
SerialLink* link = new SerialLink();
// TODO This should be only done in the dialog itself
......@@ -304,13 +305,19 @@ void MGMainWindow::addLink()
// TODO Implement the link removal!
}
void MGMainWindow::UASCreated(UASInterface* uas)
void MainWindow::UASCreated(UASInterface* uas)
{
// Connect the UAS to the full user interface
ui.menuConnected_Systems->addAction(QIcon(":/actions/linechart.svg"), tr("View ") + uas->getUASName(), uas, SLOT(setSelected()));
ui.menuConnected_Systems->addAction(QIcon(":/images/mavs/generic.svg"), tr("View ") + uas->getUASName(), uas, SLOT(setSelected()));
// Line chart
connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)), Qt::QueuedConnection);
// FIXME DO THIS ONLY FOR THE FIRST CONNECTED SYSTEM
static bool sysPresent = false;
if (!sysPresent)
{
connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)), Qt::QueuedConnection);
sysPresent = true;
}
// Health / System status indicator
info->addUAS(uas);
......@@ -326,12 +333,12 @@ void MGMainWindow::UASCreated(UASInterface* uas)
reloadStylesheet();
}
void MGMainWindow::clearView()
void MainWindow::clearView()
{
// Halt HUD
hud->stop();
/*headDown1->stop();
headDown2->stop();*/
headDown1->stop();
headDown2->stop();
// Remove all dock widgets
QList<QObject*> list = this->children();
......@@ -352,9 +359,10 @@ void MGMainWindow::clearView()
}
}
void MGMainWindow::loadPilotView()
void MainWindow::loadPilotView()
{
clearView();
GAudioOutput::instance()->say("Switched to Pilot View");
// HEAD UP DISPLAY
centerStack->setCurrentWidget(hud);
......@@ -376,10 +384,12 @@ void MGMainWindow::loadPilotView()
this->show();
}
void MGMainWindow::loadOperatorView()
void MainWindow::loadOperatorView()
{
clearView();
GAudioOutput::instance()->say("Switched to Operator View");
// LINE CHART
centerStack->setCurrentWidget(map);
......@@ -416,10 +426,12 @@ void MGMainWindow::loadOperatorView()
this->show();
}
void MGMainWindow::loadSettingsView()
void MainWindow::loadSettingsView()
{
clearView();
GAudioOutput::instance()->say("Switched to Settings View");
// LINE CHART
centerStack->setCurrentWidget(linechart);
......@@ -434,11 +446,13 @@ void MGMainWindow::loadSettingsView()
addDockWidget(Qt::RightDockWidgetArea, container6);
}
void MGMainWindow::loadEngineerView()
void MainWindow::loadEngineerView()
{
clearView();
// Engineer view, used in EMAV2009
GAudioOutput::instance()->say("Switched to Engineer View");
// LINE CHART
centerStack->setCurrentWidget(linechart);
......@@ -470,7 +484,7 @@ void MGMainWindow::loadEngineerView()
this->show();
}
void MGMainWindow::loadWidgets()
void MainWindow::loadWidgets()
{
loadOperatorView();
//loadEngineerView();
......@@ -478,32 +492,32 @@ void MGMainWindow::loadWidgets()
}
/*
void MGMainWindow::removeCommConfAct(QAction* action)
void MainWindow::removeCommConfAct(QAction* action)
{
ui.menuNetwork->removeAction(action);
}*/
//void MGMainWindow::startUAS()
//void MainWindow::startUAS()
//{
// UASManager::instance()->getActiveUAS()->launch();
//}
//
//void MGMainWindow::returnUAS()
//void MainWindow::returnUAS()
//{
// UASManager::instance()->getActiveUAS()->home();
//}
//
//void MGMainWindow::stopUAS()
//void MainWindow::stopUAS()
//{
// UASManager::instance()->getActiveUAS()->emergencySTOP();
//}
//
//void MGMainWindow::killUAS()
//void MainWindow::killUAS()
//{
// UASManager::instance()->getActiveUAS()->emergencyKILL();
//}
void MGMainWindow::runTests()
void MainWindow::runTests()
{
// TODO Remove after debugging: Add fake data
static double testvalue = 0.0f;
......
......@@ -67,12 +67,12 @@ This file is part of the PIXHAWK project
* @brief Main Application Window
*
**/
class MGMainWindow : public QMainWindow {
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MGMainWindow(QWidget *parent = 0);
~MGMainWindow();
MainWindow(QWidget *parent = 0);
~MainWindow();
UASControlWidget* control;
LinechartWidget* linechart;
......@@ -161,7 +161,7 @@ protected:
QTimer* videoTimer;
private:
Ui::MGMainWindow ui;
Ui::MainWindow ui;
};
#endif /* _MAINWINDOW_H_ */
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MGMainWindow</class>
<widget class="QMainWindow" name="MGMainWindow">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
......@@ -241,7 +241,7 @@
<connection>
<sender>actionExit</sender>
<signal>triggered()</signal>
<receiver>MGMainWindow</receiver>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
......
......@@ -29,14 +29,55 @@
<string>QWidget#colorIcon {}
QWidget {
background-color: #252528;
background-color: none;
color: #DDDDDF;
border-color: #EEEEEE;
background-clip: margin;
}
QLabel#nameLabel {
font: bold 16px;
color: #3C7B9E;
}
QLabel#modeLabel {
font: 12px;
}
QLabel#stateLabel {
font: 12px;
}
QLabel#gpsLabel {
font: 8px;
}
QLabel#positionLabel {
font: 8px;
}
QLabel#timeElapsedLabel {
font: 8px;
}
QLabel#groundDistanceLabel {
font: 8px;
}
QLabel#speedLabel {
font: 8px;
}
QLabel#timeRemainingLabel {
font: 8px;
}
QLabel#waypointLabel {
font: 24px;
}
QGroupBox {
border: 1px solid #EEEEEE;
border: 1px solid #4A4A4F;
border-radius: 5px;
padding: 0px 0px 0px 0px;
margin: 0px;
......@@ -67,6 +108,19 @@ QToolButton {
background-color: none;
}
QToolButton#typeButton {
font-weight: bold;
font-size: 12px;
border: 2px solid #999999;
border-radius: 5px;
min-width:44px;
max-width: 44px;
min-height: 44px;
max-height: 44px;
padding: 0px;
background-color: none;
}
QPushButton {
font-weight: bold;
font-size: 12px;
......@@ -84,41 +138,38 @@ QPushButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #555555);
}
QPushButton#landButton {
color: #000000;
QPushButton#abortButton {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffee01, stop:1 #ae8f00) url(&quot;ICONDIR/control/emergency-button.png&quot;);
stop:0 #ffee01, stop:1 #ae8f00);
}
QPushButton:pressed#landButton {
color: #000000;
QPushButton:pressed#abortButton {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bbaa00, stop:1 #a05b00) url(&quot;ICONDIR/control/emergency-button.png&quot;);
stop:0 #bbaa00, stop:1 #a05b00);
}
QPushButton#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffb917, stop:1 #b37300) url(&quot;ICONDIR/control/emergency-button.png&quot;);
stop:0 #ffb917, stop:1 #b37300);
}
QPushButton:pressed#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bb8500, stop:1 #903000) url(&quot;ICONDIR/control/emergency-button.png&quot;);
stop:0 #bb8500, stop:1 #903000);
}
QProgressBar {
border: 1px solid white;
border: 1px solid #4A4A4F;
border-radius: 4px;
text-align: center;
padding: 2px;
color: white;
background-color: #111111;
color: #DDDDDF;
background-color: #111118;
}
QProgressBar:horizontal {
height: 12px;
height: 10px;
}
QProgressBar QLabel {
......@@ -180,14 +231,14 @@ QProgressBar::chunk#thrustBar {
<widget class="QToolButton" name="typeButton">
<property name="minimumSize">
<size>
<width>46</width>
<height>46</height>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>46</width>
<height>46</height>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="baseSize">
......@@ -234,8 +285,9 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<pointsize>-1</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
......@@ -254,8 +306,9 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
......@@ -268,7 +321,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="timeRemainingLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -280,7 +336,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="timeElapsedLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -304,7 +363,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="groundDistanceLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -313,14 +375,17 @@ QProgressBar::chunk#thrustBar {
</widget>
</item>
<item row="4" column="4" colspan="2">
<widget class="QLabel" name="altitudeLabel">
<widget class="QLabel" name="speedLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>00.00 m</string>
<string>00.0 m/s</string>
</property>
</widget>
</item>
......@@ -380,9 +445,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="stateLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -394,14 +460,18 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="waypointLabel">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>WPX</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="6">
......@@ -420,7 +490,10 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -444,7 +517,10 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
......@@ -530,7 +606,7 @@ QProgressBar::chunk#thrustBar {
</widget>
</item>
<item>
<widget class="QPushButton" name="returnButton">
<widget class="QPushButton" name="landButton">
<property name="minimumSize">
<size>
<width>18</width>
......@@ -553,12 +629,12 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/actions/go-home.svg</normaloff>:/images/actions/go-home.svg</iconset>
<normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="landButton">
<widget class="QPushButton" name="abortButton">
<property name="minimumSize">
<size>
<width>18</width>
......
......@@ -73,8 +73,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
connect(m_ui->haltButton, SIGNAL(clicked()), uas, SLOT(halt()));
connect(m_ui->continueButton, SIGNAL(clicked()), uas, SLOT(go()));
connect(m_ui->returnButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(m_ui->landButton, SIGNAL(clicked()), uas, SLOT(emergencySTOP()));
connect(m_ui->landButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(m_ui->abortButton, SIGNAL(clicked()), uas, SLOT(emergencySTOP()));
connect(m_ui->killButton, SIGNAL(clicked()), uas, SLOT(emergencyKILL()));
connect(m_ui->shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown()));
......@@ -95,6 +95,15 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
//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);
// Heartbeat fade
refreshTimer = new QTimer(this);
......@@ -107,6 +116,11 @@ UASView::~UASView()
delete m_ui;
}
void UASView::setUASasActive(bool)
{
UASManager::instance()->setActiveUAS(this->uas);
}
void UASView::updateMode(int sysId, QString status, QString description)
{
if (sysId == this->uas->getUASID()) m_ui->modeLabel->setText(status);
......@@ -182,13 +196,6 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType)
break;
}
}
// MAV_GENERIC = 0,
// MAV_FIXED_WING,
// MAV_QUADROTOR,
// MAV_COAXIAL,
// MAV_HELICOPTER,
// MAV_GROUND,
// OCU
}
void UASView::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec)
......
......@@ -67,6 +67,8 @@ public slots:
void selectWaypoint(int uasId, int id);
/** @brief Set the current system type */
void setSystemType(UASInterface* uas, unsigned int systemType);
/** @brief Set the current UAS as the globally active system */
void setUASasActive(bool);
protected:
void changeEvent(QEvent *e);
......
Supports Markdown
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