Commit 5dd17698 authored by Bryant's avatar Bryant

Merge branch 'integration_merge' of https://github.com/mavlink/qgroundcontrol into restyling

Conflicts:
	src/uas/ArduPilotMegaMAV.h
	src/ui/uas/UASListWidget.cc
parents 44684144 33c8f8c8
...@@ -105,6 +105,8 @@ exists(user_config.pri) { ...@@ -105,6 +105,8 @@ exists(user_config.pri) {
message("----- USING CUSTOM USER QGROUNDCONTROL CONFIG FROM user_config.pri -----") message("----- USING CUSTOM USER QGROUNDCONTROL CONFIG FROM user_config.pri -----")
message("Adding support for additional MAVLink messages for: " $$MAVLINK_CONF) message("Adding support for additional MAVLink messages for: " $$MAVLINK_CONF)
message("------------------------------------------------------------------------") message("------------------------------------------------------------------------")
} else {
MAVLINK_CONF += ardupilotmega
} }
INCLUDEPATH += $$MAVLINKPATH INCLUDEPATH += $$MAVLINKPATH
isEmpty(MAVLINK_CONF) { isEmpty(MAVLINK_CONF) {
...@@ -230,7 +232,8 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -230,7 +232,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/uas/UASQuickViewItemSelect.ui \ src/ui/uas/UASQuickViewItemSelect.ui \
src/ui/uas/UASActionsWidget.ui \ src/ui/uas/UASActionsWidget.ui \
src/ui/QGCTabbedInfoView.ui \ src/ui/QGCTabbedInfoView.ui \
src/ui/UASRawStatusView.ui src/ui/UASRawStatusView.ui \
src/ui/uas/QGCMessageView.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
...@@ -387,7 +390,8 @@ HEADERS += src/MG.h \ ...@@ -387,7 +390,8 @@ HEADERS += src/MG.h \
src/ui/designer/QGCRadioChannelDisplay.h \ src/ui/designer/QGCRadioChannelDisplay.h \
src/ui/QGCTabbedInfoView.h \ src/ui/QGCTabbedInfoView.h \
src/ui/UASRawStatusView.h \ src/ui/UASRawStatusView.h \
src/ui/PrimaryFlightDisplay.h src/ui/PrimaryFlightDisplay.h \
src/ui/uas/QGCMessageView.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -563,7 +567,8 @@ SOURCES += src/main.cc \ ...@@ -563,7 +567,8 @@ SOURCES += src/main.cc \
src/ui/designer/QGCRadioChannelDisplay.cpp \ src/ui/designer/QGCRadioChannelDisplay.cpp \
src/ui/QGCTabbedInfoView.cpp \ src/ui/QGCTabbedInfoView.cpp \
src/ui/UASRawStatusView.cpp \ src/ui/UASRawStatusView.cpp \
src/ui/PrimaryFlightDisplay.cpp src/ui/PrimaryFlightDisplay.cpp \
src/ui/uas/QGCMessageView.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -25,7 +25,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -25,7 +25,6 @@ This file is part of the QGROUNDCONTROL project
#define ARDUPILOTMEGAMAV_H #define ARDUPILOTMEGAMAV_H
#include "UAS.h" #include "UAS.h"
class ArduPilotMegaMAV : public UAS class ArduPilotMegaMAV : public UAS
{ {
Q_OBJECT Q_OBJECT
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
QGCTabbedInfoView::QGCTabbedInfoView(QWidget *parent) : QWidget(parent) QGCTabbedInfoView::QGCTabbedInfoView(QWidget *parent) : QWidget(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
messageView = new QGCMessageView(this);
actionsWidget = new UASActionsWidget(this); actionsWidget = new UASActionsWidget(this);
quickView = new UASQuickView(this); quickView = new UASQuickView(this);
rawView = new UASRawStatusView(this); rawView = new UASRawStatusView(this);
ui.tabWidget->addTab(messageView,"Messages");
ui.tabWidget->addTab(quickView,"Quick"); ui.tabWidget->addTab(quickView,"Quick");
ui.tabWidget->addTab(actionsWidget,"Actions"); ui.tabWidget->addTab(actionsWidget,"Actions");
ui.tabWidget->addTab(rawView,"Status"); ui.tabWidget->addTab(rawView,"Status");
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include "ui_QGCTabbedInfoView.h" #include "ui_QGCTabbedInfoView.h"
#include "MAVLinkDecoder.h" #include "MAVLinkDecoder.h"
#include "QGCMessageView.h"
#include "UASActionsWidget.h" #include "UASActionsWidget.h"
#include "UASQuickView.h" #include "UASQuickView.h"
#include "UASRawStatusView.h" #include "UASRawStatusView.h"
...@@ -18,6 +19,7 @@ public: ...@@ -18,6 +19,7 @@ public:
private: private:
MAVLinkDecoder *m_decoder; MAVLinkDecoder *m_decoder;
Ui::QGCTabbedInfoView ui; Ui::QGCTabbedInfoView ui;
QGCMessageView *messageView;
UASActionsWidget *actionsWidget; UASActionsWidget *actionsWidget;
UASQuickView *quickView; UASQuickView *quickView;
UASRawStatusView *rawView; UASRawStatusView *rawView;
......
#include "QGCMessageView.h"
#include "ui_QGCMessageView.h"
#include "UASManager.h"
#include "QGCUnconnectedInfoWidget.h"
#include <QMenu>
QGCMessageView::QGCMessageView(QWidget *parent) :
QWidget(parent),
activeUAS(NULL),
clearAction(new QAction(tr("Clear Text"), this)),
ui(new Ui::QGCMessageView)
{
setObjectName("QUICKVIEW_MESSAGE_CONSOLE");
ui->setupUi(this);
setStyleSheet("QScrollArea { border: 0px; } QPlainTextEdit { border: 0px }");
// Construct initial widget
connectWidget = new QGCUnconnectedInfoWidget(this);
ui->horizontalLayout->addWidget(connectWidget);
ui->plainTextEdit->hide();
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
}
QGCMessageView::~QGCMessageView()
{
delete ui;
}
void QGCMessageView::setActiveUAS(UASInterface* uas)
{
if (!uas)
return;
if (activeUAS) {
disconnect(uas, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(handleTextMessage(int,int,int,QString)));
ui->plainTextEdit->clear();
} else {
// First time UI setup, clear layout
ui->horizontalLayout->removeWidget(connectWidget);
connectWidget->deleteLater();
ui->plainTextEdit->show();
connect(clearAction, SIGNAL(triggered()), ui->plainTextEdit, SLOT(clear()));
}
connect(uas, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(handleTextMessage(int,int,int,QString)));
activeUAS = uas;
}
void QGCMessageView::handleTextMessage(int uasid, int componentid, int severity, QString text)
{
// XXX color messages according to severity
ui->plainTextEdit->appendHtml(QString("<font color=\"%1\">[%2:%3] %4</font>\n").arg(UASManager::instance()->getUASForId(uasid)->getColor().name()).arg(UASManager::instance()->getUASForId(uasid)->getUASName()).arg(componentid).arg(text));
// Ensure text area scrolls correctly
ui->plainTextEdit->ensureCursorVisible();
}
void QGCMessageView::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu(this);
menu.addAction(clearAction);
menu.exec(event->globalPos());
}
#ifndef QGCMESSAGEVIEW_H
#define QGCMESSAGEVIEW_H
#include <QWidget>
#include <UASInterface.h>
#include <QVBoxLayout>
#include <QAction>
#include "QGCUnconnectedInfoWidget.h"
namespace Ui {
class QGCMessageView;
}
class QGCMessageView : public QWidget
{
Q_OBJECT
public:
explicit QGCMessageView(QWidget *parent = 0);
~QGCMessageView();
public slots:
/**
* @brief Set currently active UAS
* @param uas the current active UAS
*/
void setActiveUAS(UASInterface* uas);
/**
* @brief Handle text message from current active UAS
* @param uasid
* @param componentid
* @param severity
* @param text
*/
void handleTextMessage(int uasid, int componentid, int severity, QString text);
/**
* @brief Hand context menu event
* @param event
*/
virtual void contextMenuEvent(QContextMenuEvent* event);
protected:
UASInterface* activeUAS;
QVBoxLayout* initialLayout;
QGCUnconnectedInfoWidget *connectWidget;
QAction* clearAction;
private:
Ui::QGCMessageView *ui;
};
#endif // QGCMESSAGEVIEW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCMessageView</class>
<widget class="QWidget" name="QGCMessageView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>305</width>
<height>283</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>303</width>
<height>273</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -13,223 +13,141 @@ ...@@ -13,223 +13,141 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<widget class="QGroupBox" name="groupBox"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <property name="margin">
<rect> <number>6</number>
<x>10</x>
<y>10</y>
<width>241</width>
<height>161</height>
</rect>
</property> </property>
<property name="title"> <item>
<string>Mission Controls</string> <widget class="QGroupBox" name="groupBox">
</property> <property name="title">
<widget class="QPushButton" name="goToWaypointButton"> <string>Mission Controls</string>
<property name="geometry"> </property>
<rect> <layout class="QGridLayout" name="gridLayout">
<x>10</x> <property name="margin">
<y>50</y> <number>6</number>
<width>131</width> </property>
<height>23</height> <property name="spacing">
</rect> <number>6</number>
</property> </property>
<property name="text"> <item row="0" column="0">
<string>Go To Waypoint</string> <widget class="QComboBox" name="waypointComboBox"/>
</property> </item>
</widget> <item row="0" column="1">
<widget class="QComboBox" name="waypointComboBox"> <widget class="QLabel" name="currentWaypointLabel">
<property name="geometry"> <property name="text">
<rect> <string>Current:</string>
<x>10</x> </property>
<y>20</y> </widget>
<width>131</width> </item>
<height>22</height> <item row="1" column="0">
</rect> <widget class="QPushButton" name="goToWaypointButton">
</property> <property name="text">
</widget> <string>Go To Waypoint</string>
<widget class="QWidget" name="horizontalLayoutWidget"> </property>
<property name="geometry"> </widget>
<rect> </item>
<x>10</x> <item row="1" column="1">
<y>120</y> <widget class="QPushButton" name="pushButton_6">
<width>221</width> <property name="text">
<height>31</height> <string>Restart Mission</string>
</rect> </property>
</property> </widget>
<layout class="QHBoxLayout" name="horizontalLayout"> </item>
<item> <item row="2" column="0" colspan="2">
<widget class="QSpinBox" name="speedSpinBox"/> <layout class="QHBoxLayout" name="horizontalLayout_2">
</item> <item>
<item> <widget class="QSpinBox" name="altitudeSpinBox"/>
<widget class="QPushButton" name="changeSpeedButton"> </item>
<property name="text"> <item>
<string>Change Speed</string> <widget class="QPushButton" name="changeAltitudeButton">
</property> <property name="text">
</widget> <string>Change Altitude</string>
</item> </property>
</layout> </widget>
</widget> </item>
<widget class="QWidget" name="horizontalLayoutWidget_2"> </layout>
<property name="geometry"> </item>
<rect> <item row="3" column="0" colspan="2">
<x>10</x> <layout class="QHBoxLayout" name="horizontalLayout">
<y>81</y> <item>
<width>221</width> <widget class="QSpinBox" name="speedSpinBox"/>
<height>31</height> </item>
</rect> <item>
</property> <widget class="QPushButton" name="changeSpeedButton">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="text">
<item> <string>Change Speed</string>
<widget class="QSpinBox" name="altitudeSpinBox"/> </property>
</item> </widget>
<item> </item>
<widget class="QPushButton" name="changeAltitudeButton"> </layout>
<property name="text"> </item>
<string>Change Altitude</string> </layout>
</property> </widget>
</widget> </item>
</item> <item>
</layout> <widget class="QGroupBox" name="groupBox_2">
</widget> <property name="title">
<widget class="QLabel" name="currentWaypointLabel"> <string>Auto Actions</string>
<property name="geometry"> </property>
<rect> <layout class="QGridLayout" name="gridLayout_2">
<x>150</x> <property name="margin">
<y>20</y> <number>6</number>
<width>81</width> </property>
<height>20</height> <property name="spacing">
</rect> <number>6</number>
</property> </property>
<property name="text"> <item row="0" column="0" colspan="2">
<string>Current:</string> <widget class="QComboBox" name="comboBox"/>
</property> </item>
</widget> <item row="0" column="2" colspan="2">
<widget class="QPushButton" name="pushButton_6"> <widget class="QComboBox" name="comboBox_3"/>
<property name="geometry"> </item>
<rect> <item row="1" column="0" colspan="2">
<x>150</x> <widget class="QPushButton" name="pushButton_8">
<y>50</y> <property name="text">
<width>81</width> <string>Execute Action</string>
<height>23</height> </property>
</rect> </widget>
</property> </item>
<property name="text"> <item row="1" column="2" colspan="2">
<string>Restart Mission</string> <widget class="QPushButton" name="pushButton_5">
</property> <property name="text">
</widget> <string>Set Mode</string>
</widget> </property>
<widget class="QGroupBox" name="groupBox_2"> </widget>
<property name="geometry"> </item>
<rect> <item row="2" column="0">
<x>0</x> <widget class="QPushButton" name="pushButton">
<y>180</y> <property name="text">
<width>311</width> <string>Auto</string>
<height>161</height> </property>
</rect> </widget>
</property> </item>
<property name="title"> <item row="2" column="1" colspan="2">
<string>Auto Actions</string> <widget class="QPushButton" name="pushButton_2">
</property> <property name="text">
<widget class="QComboBox" name="comboBox"> <string>Manual</string>
<property name="geometry"> </property>
<rect> </widget>
<x>10</x> </item>
<y>20</y> <item row="2" column="3">
<width>141</width> <widget class="QPushButton" name="pushButton_4">
<height>22</height> <property name="text">
</rect> <string>RTL</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_8"> </item>
<property name="geometry"> <item row="3" column="0" colspan="4">
<rect> <widget class="QPushButton" name="armDisarmButton">
<x>10</x> <property name="text">
<y>50</y> <string>ARM</string>
<width>141</width> </property>
<height>23</height> </widget>
</rect> </item>
</property> </layout>
<property name="text"> </widget>
<string>Execute Action</string> </item>
</property> </layout>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>160</x>
<y>20</y>
<width>141</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>160</x>
<y>50</y>
<width>141</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Set Mode</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Auto</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>110</x>
<y>80</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Manual</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>210</x>
<y>80</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>RTL</string>
</property>
</widget>
<widget class="QPushButton" name="armDisarmButton">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>291</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>ARM</string>
</property>
</widget>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
......
...@@ -45,14 +45,14 @@ This file is part of the PIXHAWK project ...@@ -45,14 +45,14 @@ This file is part of the PIXHAWK project
#include "MAVLinkSimulationLink.h" #include "MAVLinkSimulationLink.h"
#include "LinkManager.h" #include "LinkManager.h"
UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UASList) UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent),
uWidget(NULL),
m_ui(new Ui::UASList)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->verticalLayout->setAlignment(Qt::AlignTop); m_ui->verticalLayout->setAlignment(Qt::AlignTop);
// Construct initial widget this->setMinimumWidth(262);
uWidget = new QGCUnconnectedInfoWidget(this);
m_ui->verticalLayout->addWidget(uWidget);
uasViews = QMap<UASInterface*, UASView*>(); uasViews = QMap<UASInterface*, UASView*>();
...@@ -84,14 +84,16 @@ void UASListWidget::changeEvent(QEvent *e) ...@@ -84,14 +84,16 @@ void UASListWidget::changeEvent(QEvent *e)
} }
} }
void UASListWidget::addUAS(UASInterface* uas) void UASListWidget::addUAS(UASInterface* uas)
{ {
if (uasViews.isEmpty()) if (uasViews.isEmpty())
{ {
m_ui->verticalLayout->removeWidget(uWidget); if (uWidget)
delete uWidget; {
uWidget = NULL; m_ui->verticalLayout->removeWidget(uWidget);
delete uWidget;
uWidget = NULL;
}
} }
if (!uasViews.contains(uas)) if (!uasViews.contains(uas))
......
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