Commit 2d8f91fe authored by pixhawk's avatar pixhawk

Merge branch 'master' of pixhawk.ethz.ch:qgroundcontrol

parents 5b6f3fad 47065d29
......@@ -107,7 +107,7 @@ QSpinBox {
QPushButton {
font-weight: bold;
min-height: 18px;
max-height: 32px;
max-height: 18px;
border: 2px solid #4A4A4F;
border-radius: 5px;
padding-left: 10px;
......@@ -127,10 +127,10 @@ QToolButton {
font-weight: bold;
min-height: 16px;
min-width: 24px;
max-height: 32px;
border: 1px solid #EEEEEE;
max-height: 18px;
border: 2px solid #4A4A4F;
border-radius: 5px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #303030, stop: 1 #202020);
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208);
}
QToolButton:checked {
......
......@@ -3,23 +3,23 @@
# from http://github.com/pixhawk/qmapcontrol/
# over bundled version in lib directory
# Version from GIT repository is preferred
#include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{
# include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{
# Include bundled version if necessary
include(lib/QMapControl/QMapControl.pri)
#message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows")
QT += network opengl svg xml phonon
# message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows")
QT += network \
opengl \
svg \
xml \
phonon
TEMPLATE = app
TARGET = qgroundcontrol
BASEDIR = .
BUILDDIR = build
LANGUAGE = C++
CONFIG += debug_and_release console
CONFIG += debug_and_release \
console
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
......@@ -142,7 +142,8 @@ HEADERS += src/MG.h \
src/ui/watchdog/WatchdogProcessView.h \
src/ui/watchdog/WatchdogView.h \
src/uas/UASWaypointManager.h \
src/ui/HSIDisplay.h
src/ui/HSIDisplay.h \
src/QGC.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
......
#ifndef QGC_H
#define QGC_H
#include <QColor>
namespace QGC
{
const QColor ColorCyan(55, 154, 195);
}
#endif // QGC_H
......@@ -17,11 +17,19 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
{
qDebug() << "got waypoint count (" << count << ") from ID " << systemId;
current_count = count;
current_wp_id = 0;
current_state = WP_GETLIST_GETWPS;
if (count > 0)
{
current_count = count;
current_wp_id = 0;
current_state = WP_GETLIST_GETWPS;
sendWaypointRequest(current_wp_id);
sendWaypointRequest(current_wp_id);
}
else
{
emit updateStatusString("done.");
qDebug() << "No waypoints on UAS " << systemId;
}
}
}
......@@ -54,7 +62,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
emit updateStatusString("done.");
qDebug() << "got all waypoints from from ID " << systemId;
qDebug() << "got all waypoints from ID " << systemId;
}
}
else
......@@ -66,13 +74,25 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_waypoint_request_t *wpr)
{
if (systemId == current_partner_systemid && compId == current_partner_compid && current_state == WP_SENDLIST && wpr->seq == current_wp_id)
if (systemId == current_partner_systemid && compId == current_partner_compid && ((current_state == WP_SENDLIST && wpr->seq == 0) || (current_state == WP_SENDLIST_SENDWPS && (wpr->seq == current_wp_id || wpr->seq == current_wp_id + 1)) || (current_state == WP_IDLE && wpr->seq == current_count-1)))
{
qDebug() << "handleWaypointRequest";
if (wpr->seq < waypoint_buffer.count())
{
//TODO: send waypoint
current_state = WP_SENDLIST_SENDWPS;
current_wp_id = wpr->seq;
sendWaypoint(current_wp_id);
if(current_wp_id == waypoint_buffer.count()-1)
{
//all waypoints sent, but we still have to wait for a possible rerequest of the last waypoint
current_state = WP_IDLE;
emit updateStatusString("done.");
qDebug() << "send all waypoints to ID " << systemId;
}
}
else
{
......@@ -111,13 +131,13 @@ void UASWaypointManager::requestWaypoints()
current_partner_systemid = uas.getUASID();
current_partner_compid = MAV_COMP_ID_WAYPOINTPLANNER;
qDebug() << "sent waypoint list request to ID " << wprl.target_system;
const QString str = QString("requesting waypoint list...");
emit updateStatusString(str);
mavlink_msg_waypoint_request_list_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wprl);
uas.sendMessage(message);
uas.sendMessage(message);
qDebug() << "sent waypoint list request to ID " << wprl.target_system;
}
}
......@@ -125,42 +145,54 @@ void UASWaypointManager::sendWaypoints(const QVector<Waypoint*> &list)
{
if (current_state == WP_IDLE)
{
current_count = list.count();
current_state = WP_SENDLIST;
current_wp_id = 0;
//copy waypoint data to local buffer
for (int i=0; i < current_count; i++)
if (list.count() > 0)
{
waypoint_buffer.push_back(new mavlink_waypoint_t);
mavlink_waypoint_t *cur_d = waypoint_buffer.back();
memset(cur_d, 0, sizeof(mavlink_waypoint_t)); //initialize with zeros
const Waypoint *cur_s = list.at(i);
cur_d->autocontinue = cur_s->getAutoContinue();
cur_d->current = cur_s->getCurrent();
cur_d->seq = i;
cur_d->x = cur_s->getX();
cur_d->y = cur_s->getY();
cur_d->z = cur_s->getZ();
cur_d->yaw = cur_s->getYaw();
}
current_count = list.count();
current_state = WP_SENDLIST;
current_wp_id = 0;
current_partner_systemid = uas.getUASID();
current_partner_compid = MAV_COMP_ID_WAYPOINTPLANNER;
//clear local buffer
while(!waypoint_buffer.empty())
{
delete waypoint_buffer.back();
waypoint_buffer.pop_back();
}
//send the waypoint count to UAS (this starts the send transaction)
mavlink_message_t message;
mavlink_waypoint_count_t wpc;
//copy waypoint data to local buffer
for (int i=0; i < current_count; i++)
{
waypoint_buffer.push_back(new mavlink_waypoint_t);
mavlink_waypoint_t *cur_d = waypoint_buffer.back();
memset(cur_d, 0, sizeof(mavlink_waypoint_t)); //initialize with zeros
const Waypoint *cur_s = list.at(i);
cur_d->autocontinue = cur_s->getAutoContinue();
cur_d->current = cur_s->getCurrent();
cur_d->seq = i;
cur_d->x = cur_s->getX();
cur_d->y = cur_s->getY();
cur_d->z = cur_s->getZ();
cur_d->yaw = cur_s->getYaw();
}
wpc.target_system = uas.getUASID();
wpc.target_component = MAV_COMP_ID_WAYPOINTPLANNER;
wpc.count = current_count;
//send the waypoint count to UAS (this starts the send transaction)
mavlink_message_t message;
mavlink_waypoint_count_t wpc;
qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system;
wpc.target_system = uas.getUASID();
wpc.target_component = MAV_COMP_ID_WAYPOINTPLANNER;
wpc.count = current_count;
const QString str = QString("start transmitting waypoints...");
emit updateStatusString(str);
const QString str = QString("start transmitting waypoints...");
emit updateStatusString(str);
mavlink_msg_waypoint_count_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpc);
uas.sendMessage(message);
mavlink_msg_waypoint_count_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpc);
uas.sendMessage(message);
qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system;
}
}
else
{
......@@ -178,13 +210,35 @@ void UASWaypointManager::sendWaypointRequest(quint16 seq)
wpr.target_component = MAV_COMP_ID_WAYPOINTPLANNER;
wpr.seq = seq;
const QString str = QString("retrieving waypoint ID %1 of %2 total").arg(wpr.seq).arg(current_count);
emit updateStatusString(str);
mavlink_msg_waypoint_request_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpr);
uas.sendMessage(message);
qDebug() << "sent waypoint request (" << wpr.seq << ") to ID " << wpr.target_system;
}
const QString str = QString("retrieving waypoint ID %1 of %2 total").arg(wpr.seq).arg(current_count);
emit updateStatusString(str);
void UASWaypointManager::sendWaypoint(quint16 seq)
{
mavlink_message_t message;
if (seq < waypoint_buffer.count())
{
mavlink_waypoint_t *wp;
wp = waypoint_buffer.at(seq);
wp->target_system = uas.getUASID();
wp->target_component = MAV_COMP_ID_WAYPOINTPLANNER;
const QString str = QString("sending waypoint ID %1 of %2 total").arg(wp->seq).arg(current_count);
emit updateStatusString(str);
mavlink_msg_waypoint_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, wp);
uas.sendMessage(message);
qDebug() << "sent waypoint (" << wp->seq << ") to ID " << wp->target_system;
}
}
void UASWaypointManager::waypointChanged(Waypoint*)
......
......@@ -28,6 +28,7 @@ public:
private:
void sendWaypointRequest(quint16 seq);
void sendWaypoint(quint16 seq);
public slots:
void clearWaypointList();
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DebugConsole</class>
<widget class="QWidget" name="DebugConsole">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>488</width>
<height>390</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>4</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,10,0,0,0,0">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="linkComboBox">
<property name="toolTip">
<string>Select the link to monitor</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="speedLabel">
<property name="text">
<string>0.0 kB/s</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mavlinkCheckBox">
<property name="toolTip">
<string>Ignore MAVLINK protocol messages in display</string>
</property>
<property name="text">
<string>Ignore MAVLINK</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hexCheckBox">
<property name="toolTip">
<string>Display and send bytes in HEX representation</string>
</property>
<property name="text">
<string>HEX</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="holdCheckBox">
<property name="toolTip">
<string>Saves CPU ressources, automatically set view to hold if data rate is too high to prevent fast scrolling</string>
</property>
<property name="statusTip">
<string>Saves CPU ressources, automatically set view to hold if data rate is too high to prevent fast scrolling</string>
</property>
<property name="whatsThis">
<string>Enable auto hold to lower the CPU consumption</string>
</property>
<property name="text">
<string>Auto hold</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QPlainTextEdit" name="receiveText"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="sentText">
<property name="text">
<string>Enter data/text below to send</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLineEdit" name="sendText">
<property name="toolTip">
<string>Type the bytes to send here, use 0xAA format for HEX (Check HEX checkbox above)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="transmitButton">
<property name="toolTip">
<string>Send the ASCII text or HEX values over the link</string>
</property>
<property name="text">
<string>Send</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wireless.svg</normaloff>:/images/devices/network-wireless.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="holdButton">
<property name="text">
<string>Hold</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../mavground.qrc"/>
</resources>
<connections>
<connection>
<sender>clearButton</sender>
<signal>clicked()</signal>
<receiver>receiveText</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>356</x>
<y>278</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>146</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DebugConsole</class>
<widget class="QWidget" name="DebugConsole">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<height>185</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>4</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="10,0,0,0,0">
<item>
<widget class="QComboBox" name="linkComboBox">
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Select the link to monitor</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="speedLabel">
<property name="text">
<string>0.0 kB/s</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mavlinkCheckBox">
<property name="toolTip">
<string>Ignore MAVLINK protocol messages in display</string>
</property>
<property name="text">
<string>No MAVLINK</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hexCheckBox">
<property name="toolTip">
<string>Display and send bytes in HEX representation</string>
</property>
<property name="text">
<string>HEX</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="holdCheckBox">
<property name="toolTip">
<string>Saves CPU ressources, automatically set view to hold if data rate is too high to prevent fast scrolling</string>
</property>
<property name="statusTip">
<string>Saves CPU ressources, automatically set view to hold if data rate is too high to prevent fast scrolling</string>
</property>
<property name="whatsThis">
<string>Enable auto hold to lower the CPU consumption</string>
</property>
<property name="text">
<string>Auto hold</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QPlainTextEdit" name="receiveText"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="sentText">
<property name="text">
<string>Enter data/text below to send</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLineEdit" name="sendText">
<property name="toolTip">
<string>Type the bytes to send here, use 0xAA format for HEX (Check HEX checkbox above)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="transmitButton">
<property name="toolTip">
<string>Send the ASCII text or HEX values over the link</string>
</property>
<property name="text">
<string>Send</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wireless.svg</normaloff>:/images/devices/network-wireless.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="holdButton">
<property name="text">
<string>Hold</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../mavground.qrc"/>
</resources>
<connections>
<connection>
<sender>clearButton</sender>
<signal>clicked()</signal>
<receiver>receiveText</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>356</x>
<y>278</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>146</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -581,6 +581,16 @@ float HDDisplay::refToScreenY(float y)
return (scalingFactor * y);
}
float HDDisplay::screenToRefX(float x)
{
return x/scalingFactor;
}
float HDDisplay::screenToRefY(float y)
{
return y/scalingFactor;
}
void HDDisplay::drawLine(float refX1, float refY1, float refX2, float refY2, float width, const QColor& color, QPainter* painter)
{
QPen pen(Qt::SolidLine);
......
......@@ -70,6 +70,8 @@ protected:
float refLineWidthToPen(float line);
float refToScreenX(float x);
float refToScreenY(float y);
float screenToRefX(float x);
float screenToRefY(float y);
void rotatePolygonClockWiseRad(QPolygonF& p, float angle, QPointF origin);
void drawPolygon(QPolygonF refPolygon, QPainter* painter);
void drawLine(float refX1, float refY1, float refX2, float refY2, float width, const QColor& color, QPainter* painter);
......
This diff is collapsed.
......@@ -37,6 +37,7 @@ This file is part of the PIXHAWK project
#include <QTimer>
#include <QMap>
#include <QPair>
#include <QMouseEvent>
#include <cmath>
#include "HDDisplay.h"
......@@ -55,19 +56,38 @@ public slots:
void updatePositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired, quint64 usec);
void updateLocalPosition(UASInterface*, double x, double y, double z, quint64 usec);
void updateGlobalPosition(UASInterface*, double lat, double lon, double alt, quint64 usec);
void updateSpeed(UASInterface* uas, double vx, double vy, double vz, quint64 time);
void paintEvent(QPaintEvent * event);
/** @brief Update state from joystick */
void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat);
void pressKey(int key);
protected slots:
void paintDisplay();
void drawGPS();
void drawObjects();
void drawPositionSetpoint(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
void drawAttitudeSetpoint(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
void drawGPS(QPainter &painter);
void drawObjects(QPainter &painter);
void drawPositionDirection(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
void drawAttitudeDirection(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
void drawAltitudeSetpoint(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
void setBodySetpointCoordinateXY(double x, double y);
void setBodySetpointCoordinateZ(double z);
/** @brief Send the current ui setpoint coordinates as new setpoint to the MAV */
void sendBodySetPointCoordinates();
/** @brief Draw one setpoint */
void drawSetpointXY(float x, float y, float yaw, const QColor &color, QPainter &painter);
/** @brief Draw the limiting safety area */
void drawSafetyArea(const QPointF &topLeft, const QPointF &bottomRight, const QColor &color, QPainter &painter);
void mouseDoubleClickEvent(QMouseEvent* event);
protected:
static QColor getColorForSNR(float snr);
/** @brief Screen coordinates of widget to metric coordinates in body frame */
QPointF screenToMetricBody(QPointF ref);
/** @brief Reference coordinates to metric coordinates */
QPointF refToMetricBody(QPointF &ref);
/** @brief Metric coordinates to reference coordinates */
QPointF metricBodyToRefX(QPointF &metric);
/**
* @brief Private data container class to be used within the HSI widget
......@@ -132,11 +152,31 @@ protected:
float lat;
float lon;
float alt;
quint64 globalAvailable; ///< Last global position update time
quint64 globalAvailable; ///< Last global position update time
float x;
float y;
float z;
quint64 localAvailable; ///< Last local position update time
float vx;
float vy;
float vz;
float speed;
quint64 localAvailable; ///< Last local position update time
float roll;
float pitch;
float yaw;
float bodyXSetCoordinate; ///< X Setpoint coordinate active on the MAV
float bodyYSetCoordinate; ///< Y Setpoint coordinate active on the MAV
float bodyZSetCoordinate; ///< Z Setpoint coordinate active on the MAV
float bodyYawSet; ///< Yaw setpoint coordinate active on the MAV
float uiXSetCoordinate; ///< X Setpoint coordinate wanted by the UI
float uiYSetCoordinate; ///< Y Setpoint coordinate wanted by the UI
float uiZSetCoordinate; ///< Z Setpoint coordinate wanted by the UI
float uiYawSet; ///< Yaw Setpoint wanted by the UI
float metricWidth; ///< Width the instrument represents in meters (the width of the ground shown by the widget)
//
float xCenterPos;
float yCenterPos;
private:
};
......
......@@ -490,10 +490,11 @@ void MainWindow::loadEngineerView()
container3->setWidget(info);
addDockWidget(Qt::LeftDockWidgetArea, container3);
// WAYPOINT LIST
QDockWidget* container5 = new QDockWidget(tr("Waypoint List"), this);
container5->setWidget(waypoints);
addDockWidget(Qt::BottomDockWidgetArea, container5);
// HORIZONTAL SITUATION INDICATOR
QDockWidget* container6 = new QDockWidget(tr("Horizontal Situation Indicator"), this);
container6->setWidget(hsi);
hsi->start();
addDockWidget(Qt::BottomDockWidgetArea, container6);
// DEBUG CONSOLE
QDockWidget* container7 = new QDockWidget(tr("Communication Console"), this);
......
......@@ -6,21 +6,27 @@
<rect>
<x>0</x>
<y>0</y>
<width>387</width>
<height>212</height>
<width>380</width>
<height>190</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,20,0" columnstretch="0,0,0,0,20">
<property name="margin">
<number>20</number>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="spacing">
<property name="rightMargin">
<number>6</number>
</property>
<item row="0" column="0" colspan="4">
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="1" colspan="4">
<widget class="QLabel" name="controlStatusLabel">
<property name="text">
<string>UNCONNECTED</string>
......@@ -30,27 +36,14 @@
</property>
</widget>
</item>
<item row="0" column="4" rowspan="7">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>172</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4">
<item row="1" column="1" colspan="4">
<widget class="QPushButton" name="controlButton">
<property name="text">
<string>Activate Engine</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<item row="2" column="1" colspan="4">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -60,13 +53,26 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>218</width>
<height>6</height>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<item row="0" column="0" rowspan="6">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>159</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="liftoffButton">
<property name="text">
<string>Liftoff</string>
......@@ -77,56 +83,56 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QComboBox" name="modeComboBox"/>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="shutdownButton">
<item row="3" column="2" colspan="2">
<widget class="QPushButton" name="landButton">
<property name="text">
<string>Halt</string>
<string>Land</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
<normaloff>:/images/control/land.svg</normaloff>:/images/control/land.svg</iconset>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="setModeButton">
<item row="3" column="4">
<widget class="QPushButton" name="shutdownButton">
<property name="text">
<string>Set Mode</string>
<string>Halt</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wireless.svg</normaloff>:/images/devices/network-wireless.svg</iconset>
<normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<spacer name="verticalSpacer">
<item row="0" column="5" rowspan="6">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
<width>30</width>
<height>159</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="2">
<widget class="QPushButton" name="landButton">
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="modeComboBox"/>
</item>
<item row="4" column="3" colspan="2">
<widget class="QPushButton" name="setModeButton">
<property name="text">
<string>Land</string>
<string>Set Mode</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/control/land.svg</normaloff>:/images/control/land.svg</iconset>
<normaloff>:/images/devices/network-wireless.svg</normaloff>:/images/devices/network-wireless.svg</iconset>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<item row="5" column="1" colspan="4">
<widget class="QLabel" name="lastActionLabel">
<property name="text">
<string>No actions executed so far</string>
......@@ -136,6 +142,19 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="6">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
......
......@@ -17,6 +17,9 @@
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
......@@ -109,19 +112,6 @@
</property>
</widget>
</item>
<item row="0" column="6" rowspan="6">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>108</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
......@@ -398,7 +388,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>197</height>
<height>0</height>
</size>
</property>
</spacer>
......
......@@ -10,6 +10,12 @@
<height>300</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......
......@@ -26,7 +26,7 @@
<string>Form</string>
</property>
<property name="styleSheet">
<string>QWidget#colorIcon {}
<string notr="true">QWidget#colorIcon {}
QWidget {
background-color: none;
......@@ -95,19 +95,6 @@ QGroupBox#heartbeatIcon {
background-color: red;
}
QToolButton {
font-weight: bold;
font-size: 12px;
border: 1px solid #999999;
border-radius: 5px;
min-width:44px;
max-width: 44px;
min-height: 44px;
max-height: 44px;
padding: 0px;
background-color: none;
}
QToolButton#typeButton {
font-weight: bold;
font-size: 12px;
......@@ -126,7 +113,7 @@ QPushButton {
font-size: 12px;
border: 1px solid #999999;
border-radius: 10px;
min-width:12px;
min-width: 20px;
max-width: 40px;
min-height: 16px;
max-height: 16px;
......@@ -203,14 +190,14 @@ QProgressBar::chunk#thrustBar {
<item>
<widget class="QGroupBox" name="uasViewFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<width>0</width>
<height>0</height>
</size>
</property>
......@@ -558,7 +545,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="liftoffButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......@@ -575,7 +562,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="haltButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......@@ -592,7 +579,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="continueButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......@@ -609,7 +596,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="landButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......@@ -637,7 +624,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="abortButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......@@ -654,7 +641,7 @@ QProgressBar::chunk#thrustBar {
<widget class="QPushButton" name="killButton">
<property name="minimumSize">
<size>
<width>18</width>
<width>26</width>
<height>22</height>
</size>
</property>
......
......@@ -47,17 +47,18 @@ void XMLCommProtocolWidget::selectXMLFile()
{
m_ui->fileNameLabel->setText(fileNames.first());
QFile file(fileNames.first());
// Store filename for next time
settings.setValue(mavlinkXML, fileNames.first());
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
const QString instanceText(QString::fromUtf8(file.readAll()));
setXML(instanceText);
// Store filename for next time
settings.setValue(mavlinkXML, QFileInfo(file).absoluteFilePath());
}
else
{
QMessageBox msgBox;
msgBox.setText("Could not write XML file. Permission denied");
msgBox.setText("Could not read XML file. Permission denied");
msgBox.exec();
}
}
......@@ -114,10 +115,25 @@ void XMLCommProtocolWidget::selectOutputDirectory()
void XMLCommProtocolWidget::generate()
{
// Check if input file is present
if (!QFileInfo(m_ui->fileNameLabel->text().trimmed()).isFile())
{
QMessageBox::critical(this, tr("Please select an XML input file first"), tr("You have to select an input XML file before generating C files."), QMessageBox::Ok);
return;
}
// Check if output dir is selected
if (!QFileInfo(m_ui->outputDirNameLabel->text().trimmed()).isDir())
{
QMessageBox::critical(this, tr("Please select output directory first"), tr("You have to select an output directory before generating C files."), QMessageBox::Ok);
return;
}
// First save file
save();
// Clean log
m_ui->compileLog->clear();
MAVLinkXMLParser* parser = new MAVLinkXMLParser(m_ui->fileNameLabel->text().trimmed(), m_ui->outputDirNameLabel->text().trimmed());
connect(parser, SIGNAL(parseState(QString)), m_ui->compileLog, SLOT(appendHtml(QString)));
bool result = parser->generate();
......
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