Commit 91614e3a authored by Don Gagne's avatar Don Gagne

VehicleSummary converted to QML

Summary page is also the launching spot for the setup screens. No more
left hand set of buttons.
parent 70d81ad3
......@@ -630,7 +630,7 @@ SOURCES += \
src/QGCComboBox.cc \
src/QGCTemporaryFile.cc \
src/audio/QGCAudioWorker.cpp \
src/QGCQuickWidget.cc
src/QGCQuickWidget.cc \
#
# Unit Test specific configuration goes here
......@@ -698,19 +698,18 @@ SOURCES += \
# AutoPilot Plugin Support
#
FORMS += \
src/VehicleSetup/SetupView.ui \
src/VehicleSetup/SummaryPage.ui \
src/VehicleSetup/ParameterEditor.ui \
src/ui/QGCPX4VehicleConfig.ui \
src/AutoPilotPlugins/PX4/FlightModeConfig.ui
src/AutoPilotPlugins/PX4/FlightModeConfig.ui \
src/VehicleSetup/SetupWidgetHolder.ui \
HEADERS+= \
src/VehicleSetup/SetupView.h \
src/VehicleSetup/SummaryPage.h \
src/VehicleSetup/ParameterEditor.h \
src/VehicleSetup/VehicleSetupButton.h \
src/VehicleSetup/VehicleComponentButton.h \
src/VehicleSetup/VehicleComponent.h \
src/VehicleSetup/VehicleComponentSummaryItem.h \
src/AutoPilotPlugins/AutoPilotPluginManager.h \
src/AutoPilotPlugins/AutoPilotPlugin.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
......@@ -722,12 +721,13 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/AirframeComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \
src/VehicleSetup/SetupWidgetHolder.h \
SOURCES += \
src/VehicleSetup/SetupView.cc \
src/VehicleSetup/SummaryPage.cc \
src/VehicleSetup/ParameterEditor.cc \
src/VehicleSetup/VehicleComponent.cc \
src/VehicleSetup/VehicleComponentSummaryItem.cc \
src/AutoPilotPlugins/AutoPilotPluginManager.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \
......@@ -738,6 +738,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/AirframeComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \
src/VehicleSetup/SetupWidgetHolder.cc \
# Fact System code
......
......@@ -236,8 +236,13 @@
<file alias="qtlogging.ini">files/QLoggingCategory/qtlogging.ini</file>
</qresource>
<qresource prefix="/qml">
<file alias="QGroundControlFactControls/qmldir">files/qml/qmldir</file>
<file alias="QGroundControlFactControls/FactTextInput.qml">files/qml/FactTextInput.qml</file>
<file alias="test.qml">src/test.qml</file>
<file alias="QGroundControl/FactControls/qmldir">qml/QGroundControl/FactControls/qmldir</file>
<file alias="QGroundControl/FactControls/SetupButton.qml">qml/QGroundControl/FactControls/SetupButton.qml</file>
<file alias="SetupViewConnected.qml">src/VehicleSetup/SetupViewConnected.qml</file>
<file alias="SetupViewDisconnected.qml">src/VehicleSetup/SetupViewDisconnected.qml</file>
<file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file>
<file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
<file alias="ParameterFactMetaData.xml">src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml</file>
......
......@@ -6,16 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<width>750</width>
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>750</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......
This diff is collapsed.
......@@ -24,21 +24,18 @@
#ifndef SETUPVIEW_H
#define SETUPVIEW_H
#include <QWidget>
#include "UASInterface.h"
#include "ParameterEditor.h"
#include "VehicleComponent.h"
#include "QGCQuickWidget.h"
#include "AutoPilotPlugin.h"
/// @file
/// @brief This class is used to display the UI for the VehicleComponent objects.
/// @author Don Gagne <don@thegagnes.com>
namespace Ui {
class SetupView;
}
class SetupView : public QWidget
class SetupView : public QGCQuickWidget
{
Q_OBJECT
......@@ -48,26 +45,19 @@ public:
private slots:
void _setActiveUAS(UASInterface* uas);
void _summaryButtonClicked(void);
void _pluginReady(void);
void _firmwareButtonClicked(void);
void _componentButtonClicked(void);
void _parametersReady(void);
void _uasConnected(void);
void _uasDisconnected(void);
void _parametersButtonClicked(void);
void _setupButtonClicked(const QVariant& component);
private:
void _clearWidgets(void);
void _clearComponentButtons(void);
void _showOnlySetupTab(void);
void _showBothTabs(void);
void _uncheckAllButtons(void);
void _setConnectedView(void);
void _setDisconnectedView(void);
void _setViewConnections(void);
UASInterface* _uasCurrent; ///< Currently active UAS
QList<VehicleComponent*> _components; ///< VehicleComponents for active UAS
QWidget* _setupWidget; ///< Currently active setup widget
ParameterEditor* _parameterWidget; ///< Currently active parameter editor wdiget
bool _initComplete; ///< true: parameters are ready and ui has been setup
Ui::SetupView* _ui;
UASInterface* _uasCurrent; ///< Currently active UAS
bool _initComplete; ///< true: parameters are ready and ui has been setup
AutoPilotPlugin* _autoPilotPlugin;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SetupView</class>
<widget class="QWidget" name="SetupView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>419</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QWidget" name="navBarWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="navBarLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>24</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item>
<widget class="VehicleSetupButton" name="firmwareButton">
<property name="text">
<string>Firmware
Upgrade</string>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/menu/firmware_upgrade.png</normaloff>:/files/images/px4/menu/firmware_upgrade.png</iconset>
</property>
<property name="iconSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="VehicleSetupButton" name="summaryButton">
<property name="text">
<string>Vehicle
Summary</string>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/menu/plane.png</normaloff>:/files/images/px4/menu/plane.png</iconset>
</property>
<property name="iconSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="componentButtonLayout"/>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="setupTab">
<attribute name="title">
<string>Setup</string>
</attribute>
<layout class="QVBoxLayout" name="setupLayout"/>
</widget>
<widget class="QWidget" name="parameterTab">
<attribute name="title">
<string>Parameters</string>
</attribute>
<layout class="QVBoxLayout" name="parameterLayout"/>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>VehicleSetupButton</class>
<extends>QPushButton</extends>
<header>VehicleSetupButton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
Rectangle {
id: topLevel
objectName: "topLevel"
anchors.fill: parent
color: "#222"
signal buttonClicked(variant component);
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
smooth: true
source: autopilot.setupBackgroundImage;
}
Column {
anchors.margins: 20
anchors.fill: parent
spacing: 5
Rectangle { id: header; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Summary" }
}
Flow {
width: parent.width;
height: parent.height - header.height - footer.height
spacing: 5
Repeater {
model: autopilot.components
Button {
width: 250
height: 200
property var summaryModel: modelData.summaryItems
text: modelData.name
property bool setupComplete: modelData.setupComplete
style: ButtonStyle {
id: buttonStyle
background: Rectangle {
id: innerRect
readonly property real titleHeight: 30
border.color: "#888"
radius: 10
color: control.activeFocus ? "#47b" : "white"
opacity: control.hovered || control.activeFocus ? 1 : 0.8
Behavior on opacity {NumberAnimation{ duration: 100 }}
Text {
id: titleBar
width: parent.width
height: parent.titleHeight
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
text: control.text
font.pixelSize: 12
Rectangle {
id: setupIndicator
property bool setupComplete: true
readonly property real indicatorRadius: 6
x: parent.width - (indicatorRadius * 2) - 5
y: (parent.height - (indicatorRadius * 2)) / 2
width: indicatorRadius * 2
height: indicatorRadius * 2
radius: indicatorRadius
color: control.setupComplete ? "green" : "red"
}
}
Rectangle {
width: parent.width
height: parent.height - parent.titleHeight
y: parent.titleHeight
border.color: "#888"
gradient: Gradient {
GradientStop { position: 0; color: "#ffffff" }
GradientStop { position: 1; color: "#000000" }
}
ListView {
id: summaryList
anchors.fill: parent
anchors.margins: 4
model: control.summaryModel
delegate: Row { width: parent.width
Text { id: firstCol; text: modelData.name }
Text { horizontalAlignment: Text.AlignRight; width: parent.width - firstCol.contentWidth; text: modelData.state }
}
}
}
}
label: Item {}
}
onClicked: topLevel.buttonClicked(modelData)
}
}
}
Rectangle { id: footer; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
property real spacing: (width - firmwareButton.width - parametersButton.width) / 3
Button { id: firmwareButton; objectName: "firmwareButton";
x: parent.spacing; anchors.verticalCenter: parent.verticalCenter;
text: "Firmware Upgrade" }
Button { id: parametersButton; objectName: "parametersButton"
x: firmwareButton.width + (parent.spacing*2); anchors.verticalCenter: parent.verticalCenter;
text: "Parameters" }
}
}
}
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
Rectangle {
anchors.fill: parent
color: "#222"
Item {
anchors.margins: 20
anchors.fill: parent
Rectangle { id: header; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Summary" }
}
Text { width: parent.width; height: parent.height - header.height - footer.height;
anchors.top: header.bottom
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "No vehicle currently connected. Vehicle Setup is only available while vehicle is connected." }
Rectangle { id: footer; anchors.bottom: parent.bottom; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
Button { id: firmwareButton; objectName: "firmwareButton";
anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter;
text: "Firmware Upgrade"
}
}
}
}
#include "SetupWidgetHolder.h"
#include "ui_SetupWidgetHolder.h"
SetupWidgetHolder::SetupWidgetHolder(QWidget *parent) :
QDialog(parent),
ui(new Ui::SetupWidgetHolder)
{
ui->setupUi(this);
}
SetupWidgetHolder::~SetupWidgetHolder()
{
delete ui;
}
void SetupWidgetHolder::setInnerWidget(QWidget* widget)
{
ui->setupWidgetLayout->addWidget(widget);
}
#ifndef SETUPWIDGETHOLDER_H
#define SETUPWIDGETHOLDER_H
#include <QDialog>
namespace Ui {
class SetupWidgetHolder;
}
class SetupWidgetHolder : public QDialog
{
Q_OBJECT
public:
explicit SetupWidgetHolder(QWidget *parent = 0);
~SetupWidgetHolder();
void setInnerWidget(QWidget* widget);
private:
Ui::SetupWidgetHolder *ui;
};
#endif // SETUPWIDGETHOLDER_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SetupWidgetHolder</class>
<widget class="QDialog" name="SetupWidgetHolder">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="setupWidgetLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -2,17 +2,35 @@
<ui version="4.0">
<class>PX4FirmwareUpgrade</class>
<widget class="QWidget" name="PX4FirmwareUpgrade">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1562</width>
<height>1286</height>
<width>727</width>
<height>527</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>727</width>
<height>527</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
......
......@@ -6,16 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>831</width>
<height>1286</height>
<width>720</width>
<height>501</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>720</width>
<height>501</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......
......@@ -6,10 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>416</height>
<width>802</width>
<height>471</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>802</width>
<height>471</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......@@ -39,9 +51,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-282</y>
<width>762</width>
<height>638</height>
<y>0</y>
<width>761</width>
<height>611</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......
......@@ -258,7 +258,9 @@ void QGCPX4SensorCalibration::setInstructionImage(const QString &path)
void QGCPX4SensorCalibration::setAutopilotImage(int index)
{
setAutopilotImage(QString(":/files/images/px4/calibration/pixhawk_%1.png").arg(index, 2, 10, QChar('0')));
Q_UNUSED(index);
// FIXME: This was referencing a non-existent png. Need to figure out what this was trying to do.
//setAutopilotImage(QString(":/files/images/px4/calibration/pixhawk_%1.png").arg(index, 2, 10, QChar('0')));
}
void QGCPX4SensorCalibration::setGpsImage(int index)
......
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