Commit df9ed556 authored by Don Gagne's avatar Don Gagne

Merge pull request #2939 from DonLakeFlyer/Cleanup

Laundry list: Fixing things while tablet testing
parents 8d43d1a3 f4e50e33
...@@ -44,8 +44,12 @@ FlightMap { ...@@ -44,8 +44,12 @@ FlightMap {
property bool _activeVehicleCoordinateValid: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinateValid : false property bool _activeVehicleCoordinateValid: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinateValid : false
property var activeVehicleCoordinate: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinate : QtPositioning.coordinate() property var activeVehicleCoordinate: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinate : QtPositioning.coordinate()
Component.onCompleted: QGroundControl.flightMapPosition = center Component.onCompleted: {
QGroundControl.flightMapPosition = center
QGroundControl.flightMapZoom = zoomLevel
}
onCenterChanged: QGroundControl.flightMapPosition = center onCenterChanged: QGroundControl.flightMapPosition = center
onZoomLevelChanged: QGroundControl.flightMapZoom = zoomLevel
onActiveVehicleCoordinateChanged: { onActiveVehicleCoordinateChanged: {
if (_followVehicle && _activeVehicleCoordinateValid && activeVehicleCoordinate.isValid) { if (_followVehicle && _activeVehicleCoordinateValid && activeVehicleCoordinate.isValid) {
......
...@@ -197,6 +197,9 @@ Item { ...@@ -197,6 +197,9 @@ Item {
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
dropDownComponent: Component { dropDownComponent: Component {
Column {
spacing: ScreenTools.defaultFontPixelWidth
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
...@@ -215,6 +218,17 @@ Item { ...@@ -215,6 +218,17 @@ Item {
} }
} }
} }
QGCButton {
text: "Clear flight trails"
enabled: QGroundControl.multiVehicleManager.activeVehicle
onClicked: {
QGroundControl.multiVehicleManager.activeVehicle.clearTrajectoryPoints()
_dropButtonsExclusiveGroup.current = null
}
}
}
} }
} }
......
...@@ -43,7 +43,6 @@ Item { ...@@ -43,7 +43,6 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: _margins spacing: _margins
visible: multiVehicleManager.activeVehicle
Rectangle { Rectangle {
id: valuesPageIndicator id: valuesPageIndicator
......
...@@ -758,7 +758,7 @@ QGCView { ...@@ -758,7 +758,7 @@ QGCView {
spacing: _margin spacing: _margin
QGCLabel { QGCLabel {
width: columnHolder.width width: sendSaveRow.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: syncNeeded && !controller.autoSync ? text: syncNeeded && !controller.autoSync ?
"You have unsaved changed to you mission. You should send to your vehicle, or save to a file:" : "You have unsaved changed to you mission. You should send to your vehicle, or save to a file:" :
...@@ -766,6 +766,7 @@ QGCView { ...@@ -766,6 +766,7 @@ QGCView {
} }
Row { Row {
id: sendSaveRow
visible: true //autoSyncCheckBox.enabled && autoSyncCheckBox.checked visible: true //autoSyncCheckBox.enabled && autoSyncCheckBox.checked
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
......
...@@ -78,6 +78,7 @@ public: ...@@ -78,6 +78,7 @@ public:
Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT) Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT)
Q_PROPERTY(QGeoCoordinate flightMapPosition MEMBER _flightMapPosition NOTIFY flightMapPositionChanged) Q_PROPERTY(QGeoCoordinate flightMapPosition MEMBER _flightMapPosition NOTIFY flightMapPositionChanged)
Q_PROPERTY(int flightMapZoom MEMBER _flightMapZoom NOTIFY flightMapZoomChanged)
/// @ return: true: experimental survey ip code is turned on /// @ return: true: experimental survey ip code is turned on
Q_PROPERTY(bool experimentalSurvey READ experimentalSurvey WRITE setExperimentalSurvey NOTIFY experimentalSurveyChanged) Q_PROPERTY(bool experimentalSurvey READ experimentalSurvey WRITE setExperimentalSurvey NOTIFY experimentalSurveyChanged)
...@@ -152,6 +153,7 @@ signals: ...@@ -152,6 +153,7 @@ signals:
void isVersionCheckEnabledChanged (bool enabled); void isVersionCheckEnabledChanged (bool enabled);
void mavlinkSystemIDChanged (int id); void mavlinkSystemIDChanged (int id);
void flightMapPositionChanged (QGeoCoordinate flightMapPosition); void flightMapPositionChanged (QGeoCoordinate flightMapPosition);
void flightMapZoomChanged (int flightMapZoom);
void experimentalSurveyChanged (bool experimentalSurvey); void experimentalSurveyChanged (bool experimentalSurvey);
private: private:
...@@ -165,6 +167,7 @@ private: ...@@ -165,6 +167,7 @@ private:
bool _virtualTabletJoystick; bool _virtualTabletJoystick;
QGeoCoordinate _flightMapPosition; QGeoCoordinate _flightMapPosition;
int _flightMapZoom;
SettingsFact _offlineEditingFirmwareTypeFact; SettingsFact _offlineEditingFirmwareTypeFact;
FactMetaData _offlineEditingFirmwareTypeMetaData; FactMetaData _offlineEditingFirmwareTypeMetaData;
......
...@@ -228,3 +228,11 @@ void QmlObjectListModel::deleteListAndContents(void) ...@@ -228,3 +228,11 @@ void QmlObjectListModel::deleteListAndContents(void)
} }
deleteLater(); deleteLater();
} }
void QmlObjectListModel::clearAndDeleteContents(void)
{
for (int i=0; i<_objectList.count(); i++) {
_objectList[i]->deleteLater();
}
clear();
}
...@@ -63,6 +63,9 @@ public: ...@@ -63,6 +63,9 @@ public:
/// Calls deleteLater on all items and this itself. /// Calls deleteLater on all items and this itself.
void deleteListAndContents(void); void deleteListAndContents(void);
/// Clears the list and calls delete on each entry
void clearAndDeleteContents(void);
signals: signals:
void countChanged(int count); void countChanged(int count);
void dirtyChanged(bool dirtyChanged); void dirtyChanged(bool dirtyChanged);
......
...@@ -252,15 +252,21 @@ Rectangle { ...@@ -252,15 +252,21 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: bottomRect.top anchors.bottom: bottomRect.top
color: (__qgcPal.globalTheme === QGCPalette.Light) ? "black" : "#98aca4" color: (__qgcPal.globalTheme === QGCPalette.Light) ? "black" : "#98aca4"
Map { Map {
id: _map id: _map
anchors.fill: parent anchors.fill: parent
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.15 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.15
zoomLevel: 10
center: QGroundControl.defaultMapPosition center: QGroundControl.defaultMapPosition
gesture.flickDeceleration: 3000 gesture.flickDeceleration: 3000
gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
plugin: Plugin { name: "QGroundControl" } plugin: Plugin { name: "QGroundControl" }
Component.onCompleted: {
center = QGroundControl.flightMapPosition
zoomLevel = QGroundControl.flightMapZoom
}
onCenterChanged: { onCenterChanged: {
handleChanges() handleChanges()
checkSanity() checkSanity()
...@@ -282,6 +288,7 @@ Rectangle { ...@@ -282,6 +288,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
} }
} }
Rectangle { Rectangle {
width: ScreenTools.defaultFontPixelHeight * 16 width: ScreenTools.defaultFontPixelHeight * 16
height: ScreenTools.defaultFontPixelHeight * 9 height: ScreenTools.defaultFontPixelHeight * 9
......
...@@ -141,6 +141,7 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -141,6 +141,7 @@ Vehicle::Vehicle(LinkInterface* link,
connect(this, &Vehicle::_sendMessageOnThread, this, &Vehicle::_sendMessage, Qt::QueuedConnection); connect(this, &Vehicle::_sendMessageOnThread, this, &Vehicle::_sendMessage, Qt::QueuedConnection);
connect(this, &Vehicle::_sendMessageOnLinkOnThread, this, &Vehicle::_sendMessageOnLink, Qt::QueuedConnection); connect(this, &Vehicle::_sendMessageOnLinkOnThread, this, &Vehicle::_sendMessageOnLink, Qt::QueuedConnection);
connect(this, &Vehicle::flightModeChanged, this, &Vehicle::_announceflightModeChanged); connect(this, &Vehicle::flightModeChanged, this, &Vehicle::_announceflightModeChanged);
connect(this, &Vehicle::armedChanged, this, &Vehicle::_announceArmedChanged);
_uas = new UAS(_mavlink, this, _firmwarePluginManager); _uas = new UAS(_mavlink, this, _firmwarePluginManager);
...@@ -467,7 +468,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message) ...@@ -467,7 +468,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
if (sysStatus.battery_remaining > 0 && sysStatus.battery_remaining < _batteryFactGroup.percentRemainingAnnounce()->rawValue().toInt()) { if (sysStatus.battery_remaining > 0 && sysStatus.battery_remaining < _batteryFactGroup.percentRemainingAnnounce()->rawValue().toInt()) {
if (!_lowBatteryAnnounceTimer.isValid() || _lowBatteryAnnounceTimer.elapsed() > _lowBatteryAnnounceRepeatMSecs) { if (!_lowBatteryAnnounceTimer.isValid() || _lowBatteryAnnounceTimer.elapsed() > _lowBatteryAnnounceRepeatMSecs) {
_lowBatteryAnnounceTimer.restart(); _lowBatteryAnnounceTimer.restart();
_say(QString("Low battery on %1: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining)); _say(QString("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining));
} }
} }
} }
...@@ -1288,7 +1289,7 @@ void Vehicle::_connectionLostTimeout(void) ...@@ -1288,7 +1289,7 @@ void Vehicle::_connectionLostTimeout(void)
_connectionLost = true; _connectionLost = true;
_heardFrom = false; _heardFrom = false;
emit connectionLostChanged(true); emit connectionLostChanged(true);
_say(QString("communication lost to %1").arg(_vehicleIdSpeech())); _say(QString("%1 communication lost").arg(_vehicleIdSpeech()));
if (_autoDisconnect) { if (_autoDisconnect) {
disconnectInactiveVehicle(); disconnectInactiveVehicle();
} }
...@@ -1301,7 +1302,7 @@ void Vehicle::_connectionActive(void) ...@@ -1301,7 +1302,7 @@ void Vehicle::_connectionActive(void)
if (_connectionLost) { if (_connectionLost) {
_connectionLost = false; _connectionLost = false;
emit connectionLostChanged(false); emit connectionLostChanged(false);
_say(QString("communication regained to %1").arg(_vehicleIdSpeech())); _say(QString("% 1 communication regained").arg(_vehicleIdSpeech()));
} }
} }
...@@ -1344,15 +1345,26 @@ QString Vehicle::_vehicleIdSpeech(void) ...@@ -1344,15 +1345,26 @@ QString Vehicle::_vehicleIdSpeech(void)
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) { if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) {
return QString("vehicle %1").arg(id()); return QString("vehicle %1").arg(id());
} else { } else {
return QStringLiteral("vehicle"); return QString();
} }
} }
void Vehicle::_announceflightModeChanged(const QString& flightMode) void Vehicle::_announceflightModeChanged(const QString& flightMode)
{ {
_say(QString("%1 is now in %2 flight mode").arg(_vehicleIdSpeech()).arg(flightMode)); _say(QString("%1 %2 flight mode").arg(_vehicleIdSpeech()).arg(flightMode));
} }
void Vehicle::_announceArmedChanged(bool armed)
{
_say(QString("%1 %2").arg(_vehicleIdSpeech()).arg(armed ? QStringLiteral("armed") : QStringLiteral("disarmed")));
}
void Vehicle::clearTrajectoryPoints(void)
{
_mapTrajectoryList.clearAndDeleteContents();
}
const char* VehicleGPSFactGroup::_hdopFactName = "hdop"; const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop"; const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround"; const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
...@@ -318,6 +318,8 @@ public: ...@@ -318,6 +318,8 @@ public:
Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust); Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust);
Q_INVOKABLE void disconnectInactiveVehicle(void); Q_INVOKABLE void disconnectInactiveVehicle(void);
Q_INVOKABLE void clearTrajectoryPoints(void);
// Property accessors // Property accessors
QGeoCoordinate coordinate(void) { return _coordinate; } QGeoCoordinate coordinate(void) { return _coordinate; }
...@@ -524,6 +526,7 @@ private slots: ...@@ -524,6 +526,7 @@ private slots:
void _parametersReady(bool parametersReady); void _parametersReady(bool parametersReady);
void _remoteControlRSSIChanged(uint8_t rssi); void _remoteControlRSSIChanged(uint8_t rssi);
void _announceflightModeChanged(const QString& flightMode); void _announceflightModeChanged(const QString& flightMode);
void _announceArmedChanged(bool armed);
void _handleTextMessage (int newCount); void _handleTextMessage (int newCount);
void _handletextMessageReceived (UASMessage* message); void _handletextMessageReceived (UASMessage* message);
......
...@@ -165,7 +165,7 @@ Rectangle { ...@@ -165,7 +165,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: ScreenTools.largeFontPixelSize font.pixelSize: ScreenTools.largeFontPixelSize
text: "Connect vehicle to your device and QGroundControl will automatically detect to it." + text: "Connect vehicle to your device and QGroundControl will automatically detect it." +
(ScreenTools.isMobile ? "" : " Click Firmware on the left to upgrade your vehicle.") (ScreenTools.isMobile ? "" : " Click Firmware on the left to upgrade your vehicle.")
onLinkActivated: Qt.openUrlExternally(link) onLinkActivated: Qt.openUrlExternally(link)
......
...@@ -279,47 +279,16 @@ void UAS::receiveMessage(mavlink_message_t message) ...@@ -279,47 +279,16 @@ void UAS::receiveMessage(mavlink_message_t message)
emit valueChanged(uasId, name.arg("custom_mode"), "bits", state.custom_mode, time); emit valueChanged(uasId, name.arg("custom_mode"), "bits", state.custom_mode, time);
emit valueChanged(uasId, name.arg("system_status"), "-", state.system_status, time); emit valueChanged(uasId, name.arg("system_status"), "-", state.system_status, time);
QString audiostring = QString("System %1").arg(uasId);
QString stateAudio = "";
QString navModeAudio = "";
bool statechanged = false;
if ((state.system_status != this->status) && state.system_status != MAV_STATE_UNINIT) if ((state.system_status != this->status) && state.system_status != MAV_STATE_UNINIT)
{ {
statechanged = true;
this->status = state.system_status; this->status = state.system_status;
getStatusForCode((int)state.system_status, uasState, stateDescription); getStatusForCode((int)state.system_status, uasState, stateDescription);
emit statusChanged(this, uasState, stateDescription); emit statusChanged(this, uasState, stateDescription);
emit statusChanged(this->status); emit statusChanged(this->status);
// Adjust for better audio
if (uasState == QString("STANDBY")) uasState = QString("standing by");
if (uasState == QString("EMERGENCY")) uasState = QString("emergency condition");
if (uasState == QString("CRITICAL")) uasState = QString("critical condition");
if (uasState == QString("SHUTDOWN")) uasState = QString("shutting down");
stateAudio = uasState;
} }
// We got the mode // We got the mode
receivedMode = true; receivedMode = true;
// AUDIO
if (statechanged)
{
// Output the one message
audiostring += stateAudio;
}
if (statechanged && ((int)state.system_status == (int)MAV_STATE_CRITICAL || state.system_status == (int)MAV_STATE_EMERGENCY))
{
_say(QString("Emergency for system %1").arg(this->getUASID()), GAudioOutput::AUDIO_SEVERITY_EMERGENCY);
QTimer::singleShot(3000, qgcApp()->toolbox()->audioOutput(), SLOT(startEmergency()));
}
else if (statechanged)
{
_say(audiostring.toLower());
}
} }
break; break;
......
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