Commit a6ea3d79 authored by Gus Grubba's avatar Gus Grubba

Flight Details and File Flight Plan WIP

Permit refactoring
QGCButton tweaks
parent 32ed1ec0
...@@ -94,7 +94,7 @@ void AirMapFlightManager::createFlight(const QList<MissionItem*>& missionItems) ...@@ -94,7 +94,7 @@ void AirMapFlightManager::createFlight(const QList<MissionItem*>& missionItems)
qCDebug(AirMapManagerLog) << "Got Pilot ID:"<<_pilotID; qCDebug(AirMapManagerLog) << "Got Pilot ID:"<<_pilotID;
_uploadFlight(); _uploadFlight();
} else { } else {
_flightPermitStatus = AirspaceFlightPlanProvider::PermitUnknown; _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
emit flightPermitStatusChanged(); emit flightPermitStatusChanged();
_state = State::Idle; _state = State::Idle;
...@@ -372,7 +372,7 @@ void AirMapFlightManager::endFlight() ...@@ -372,7 +372,7 @@ void AirMapFlightManager::endFlight()
} }
_endFlight(_currentFlightId); _endFlight(_currentFlightId);
_flightPermitStatus = AirspaceFlightPlanProvider::PermitUnknown; _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
emit flightPermitStatusChanged(); emit flightPermitStatusChanged();
} }
......
...@@ -108,7 +108,7 @@ private: ...@@ -108,7 +108,7 @@ private:
QString _currentFlightId; ///< Flight ID, empty if there is none QString _currentFlightId; ///< Flight ID, empty if there is none
QString _pendingFlightId; ///< current flight ID, not necessarily accepted yet (once accepted, it's equal to _currentFlightId) QString _pendingFlightId; ///< current flight ID, not necessarily accepted yet (once accepted, it's equal to _currentFlightId)
QString _pendingFlightPlan; ///< current flight plan, waiting to be submitted QString _pendingFlightPlan; ///< current flight plan, waiting to be submitted
AirspaceFlightPlanProvider::PermitStatus _flightPermitStatus = AirspaceFlightPlanProvider::PermitUnknown; AirspaceFlightPlanProvider::PermitStatus _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
QString _pilotID; ///< Pilot ID in the form "auth0|abc123" QString _pilotID; ///< Pilot ID in the form "auth0|abc123"
bool _noFlightCreatedYet = true; bool _noFlightCreatedYet = true;
QTimer _pollTimer; ///< timer to poll for approval check QTimer _pollTimer; ///< timer to poll for approval check
......
...@@ -143,7 +143,7 @@ AirMapFlightPlanManager::_createFlightPlan() ...@@ -143,7 +143,7 @@ AirMapFlightPlanManager::_createFlightPlan()
qCDebug(AirMapManagerLog) << "Got Pilot ID:"<<_pilotID; qCDebug(AirMapManagerLog) << "Got Pilot ID:"<<_pilotID;
_uploadFlightPlan(); _uploadFlightPlan();
} else { } else {
_flightPermitStatus = AirspaceFlightPlanProvider::PermitUnknown; _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
emit flightPermitStatusChanged(); emit flightPermitStatusChanged();
_state = State::Idle; _state = State::Idle;
QString description = QString::fromStdString(result.error().description() ? result.error().description().get() : ""); QString description = QString::fromStdString(result.error().description() ? result.error().description().get() : "");
......
...@@ -88,7 +88,7 @@ private: ...@@ -88,7 +88,7 @@ private:
QmlObjectListModel _rulesets; QmlObjectListModel _rulesets;
AirspaceAdvisoryProvider::AdvisoryColor _airspaceColor; AirspaceAdvisoryProvider::AdvisoryColor _airspaceColor;
AirspaceFlightPlanProvider::PermitStatus _flightPermitStatus = AirspaceFlightPlanProvider::PermitUnknown; AirspaceFlightPlanProvider::PermitStatus _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
}; };
...@@ -37,8 +37,8 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox) ...@@ -37,8 +37,8 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{ {
_logger = std::make_shared<qt::Logger>(); _logger = std::make_shared<qt::Logger>();
qt::register_types(); // TODO: still needed? qt::register_types(); // TODO: still needed?
_logger->logging_category().setEnabled(QtDebugMsg, false); _logger->logging_category().setEnabled(QtDebugMsg, true);
_logger->logging_category().setEnabled(QtInfoMsg, false); _logger->logging_category().setEnabled(QtInfoMsg, true);
_logger->logging_category().setEnabled(QtWarningMsg, true); _logger->logging_category().setEnabled(QtWarningMsg, true);
_dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger); _dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger);
connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error); connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error);
......
...@@ -248,8 +248,8 @@ void AirMapRulesetsManager::setROI(const QGCGeoBoundingCube& roi) ...@@ -248,8 +248,8 @@ void AirMapRulesetsManager::setROI(const QGCGeoBoundingCube& roi)
//-- Sort rules by display order //-- Sort rules by display order
std::sort(pRuleSet->_rules.objectList()->begin(), pRuleSet->_rules.objectList()->end(), rules_sort); std::sort(pRuleSet->_rules.objectList()->begin(), pRuleSet->_rules.objectList()->end(), rules_sort);
_ruleSets.append(pRuleSet); _ruleSets.append(pRuleSet);
/*
qCDebug(AirMapManagerLog) << "Adding ruleset" << pRuleSet->name(); qCDebug(AirMapManagerLog) << "Adding ruleset" << pRuleSet->name();
/*
qDebug() << "------------------------------------------"; qDebug() << "------------------------------------------";
qDebug() << "Jurisdiction:" << ruleset.jurisdiction.name.data() << (int)ruleset.jurisdiction.region; qDebug() << "Jurisdiction:" << ruleset.jurisdiction.name.data() << (int)ruleset.jurisdiction.region;
qDebug() << "Name: " << ruleset.name.data(); qDebug() << "Name: " << ruleset.name.data();
......
...@@ -27,6 +27,7 @@ Item { ...@@ -27,6 +27,7 @@ Item {
property bool _validAdvisories: QGroundControl.airspaceManager.advisories.valid property bool _validAdvisories: QGroundControl.airspaceManager.advisories.valid
property color _textColor: qgcPal.text property color _textColor: qgcPal.text
property bool _colapsed: !QGroundControl.airspaceManager.airspaceVisible property bool _colapsed: !QGroundControl.airspaceManager.airspaceVisible
property var _flightPermit: QGroundControl.airspaceManager.flightPlan.flightPermitStatus
readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5 readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5
readonly property color _colorOrange: "#d75e0d" readonly property color _colorOrange: "#d75e0d"
...@@ -342,6 +343,26 @@ Item { ...@@ -342,6 +343,26 @@ Item {
} }
} }
//-- Footer //-- Footer
Row {
spacing: ScreenTools.defaultFontPixelWidth * 2
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
text: qsTr("Details")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 10
}
QGCButton {
text: qsTr("File Plan")
backRadius: 4
heightFactor: 0.3333
showBorder: true
enabled: _flightPermit !== AirspaceFlightPlanProvider.PermitNone
width: ScreenTools.defaultFontPixelWidth * 10
}
}
QGCLabel { QGCLabel {
text: qsTr("Powered by <b>AIRMAP</b>") text: qsTr("Powered by <b>AIRMAP</b>")
color: _textColor color: _textColor
......
<RCC> <RCC>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file alias="QGroundControl/Airmap/qmldir">QGroundControl.Airmap.qmldir</file> <file alias="AirmapSettings.qml">AirmapSettings.qml</file>
<file alias="QGroundControl/Airmap/AirspaceControl.qml">AirspaceControl.qml</file> <file alias="QGroundControl/Airmap/AirspaceControl.qml">AirspaceControl.qml</file>
<file alias="QGroundControl/Airmap/AirspaceRegulation.qml">AirspaceRegulation.qml</file> <file alias="QGroundControl/Airmap/AirspaceRegulation.qml">AirspaceRegulation.qml</file>
<file alias="QGroundControl/Airmap/AirspaceWeather.qml">AirspaceWeather.qml</file> <file alias="QGroundControl/Airmap/AirspaceWeather.qml">AirspaceWeather.qml</file>
<file alias="QGroundControl/Airmap/qmldir">QGroundControl.Airmap.qmldir</file>
<file alias="QGroundControl/Airmap/RuleSelector.qml">RuleSelector.qml</file> <file alias="QGroundControl/Airmap/RuleSelector.qml">RuleSelector.qml</file>
<file alias="AirmapSettings.qml">AirmapSettings.qml</file>
</qresource> </qresource>
<qresource prefix="/json"> <qresource prefix="/json">
<file alias="AirMap.SettingsGroup.json">AirMap.SettingsGroup.json</file> <file alias="AirMap.SettingsGroup.json">AirMap.SettingsGroup.json</file>
......
...@@ -29,7 +29,7 @@ class AirspaceFlightPlanProvider : public QObject ...@@ -29,7 +29,7 @@ class AirspaceFlightPlanProvider : public QObject
public: public:
enum PermitStatus { enum PermitStatus {
PermitUnknown = 0, PermitNone = 0, //-- No flght plan
PermitPending, PermitPending,
PermitAccepted, PermitAccepted,
PermitRejected, PermitRejected,
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
Q_PROPERTY(QmlObjectListModel* ruleSets READ ruleSets NOTIFY advisoryChanged) Q_PROPERTY(QmlObjectListModel* ruleSets READ ruleSets NOTIFY advisoryChanged)
Q_PROPERTY(AirspaceAdvisoryProvider::AdvisoryColor airspaceColor READ airspaceColor NOTIFY advisoryChanged) Q_PROPERTY(AirspaceAdvisoryProvider::AdvisoryColor airspaceColor READ airspaceColor NOTIFY advisoryChanged)
virtual PermitStatus flightPermitStatus () const { return PermitUnknown; } virtual PermitStatus flightPermitStatus () const { return PermitNone; }
virtual QDateTime flightStartTime () const = 0; virtual QDateTime flightStartTime () const = 0;
virtual QDateTime flightEndTime () const = 0; virtual QDateTime flightEndTime () const = 0;
virtual bool valid () = 0; ///< Current advisory list is valid virtual bool valid () = 0; ///< Current advisory list is valid
......
...@@ -634,7 +634,7 @@ QGCView { ...@@ -634,7 +634,7 @@ QGCView {
width: airspaceRow.width + (ScreenTools.defaultFontPixelWidth * 3) width: airspaceRow.width + (ScreenTools.defaultFontPixelWidth * 3)
height: airspaceRow.height * 1.25 height: airspaceRow.height * 1.25
color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75)
visible: QGroundControl.airmapSupported && _mainIsMap && flightPermit && flightPermit !== AirspaceFlightPlanProvider.PermitUnknown && !messageArea.visible && !criticalMmessageArea.visible visible: QGroundControl.airmapSupported && _mainIsMap && flightPermit && flightPermit !== AirspaceFlightPlanProvider.PermitNone && !messageArea.visible && !criticalMmessageArea.visible
radius: 3 radius: 3
border.width: 1 border.width: 1
border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35)
......
...@@ -6,12 +6,14 @@ import QGroundControl.Palette 1.0 ...@@ -6,12 +6,14 @@ import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
Button { Button {
property bool primary: false ///< primary button for a group of buttons property bool primary: false ///< primary button for a group of buttons
property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text
property bool showBorder: _qgcPal.globalTheme === QGCPalette.Light
property real backRadius: 0
property real heightFactor: 0.5
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool _showHighlight: (pressed | hovered | checked) && !__forceHoverOff property bool _showHighlight: (pressed | hovered | checked) && !__forceHoverOff
property bool _showBorder: _qgcPal.globalTheme === QGCPalette.Light
// This fixes the issue with button hover where if a Button is near the edge oa QQuickWidget you can // This fixes the issue with button hover where if a Button is near the edge oa QQuickWidget you can
// move the mouse fast enough such that the MouseArea does not trigger an onExited. This is turn // move the mouse fast enough such that the MouseArea does not trigger an onExited. This is turn
...@@ -22,7 +24,7 @@ Button { ...@@ -22,7 +24,7 @@ Button {
property int __lastGlobalMouseX: 0 property int __lastGlobalMouseX: 0
property int __lastGlobalMouseY: 0 property int __lastGlobalMouseY: 0
property int _horizontalPadding: ScreenTools.defaultFontPixelWidth property int _horizontalPadding: ScreenTools.defaultFontPixelWidth
property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight / 2) property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight * heightFactor)
Connections { Connections {
target: __behavior target: __behavior
...@@ -58,9 +60,11 @@ Button { ...@@ -58,9 +60,11 @@ Button {
/*! This defines the background of the button. */ /*! This defines the background of the button. */
background: Rectangle { background: Rectangle {
id: backRect
implicitWidth: ScreenTools.implicitButtonWidth implicitWidth: ScreenTools.implicitButtonWidth
implicitHeight: ScreenTools.implicitButtonHeight implicitHeight: ScreenTools.implicitButtonHeight
border.width: _showBorder ? 1: 0 radius: backRadius
border.width: showBorder ? 1 : 0
border.color: _qgcPal.buttonText border.color: _qgcPal.buttonText
color: _showHighlight ? color: _showHighlight ?
control._qgcPal.buttonHighlight : control._qgcPal.buttonHighlight :
......
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