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 {
property bool _activeVehicleCoordinateValid: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinateValid : false
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
onZoomLevelChanged: QGroundControl.flightMapZoom = zoomLevel
onActiveVehicleCoordinateChanged: {
if (_followVehicle && _activeVehicleCoordinateValid && activeVehicleCoordinate.isValid) {
......
......@@ -197,23 +197,37 @@ Item {
z: QGroundControl.zOrderWidgets
dropDownComponent: Component {
Row {
Column {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: _flightMap ? _flightMap.mapType == text : false
text: modelData
QGCButton {
checkable: true
checked: _flightMap ? _flightMap.mapType == text : false
text: modelData
onClicked: {
_flightMap.mapType = text
_dropButtonsExclusiveGroup.current = null
onClicked: {
_flightMap.mapType = text
_dropButtonsExclusiveGroup.current = null
}
}
}
}
QGCButton {
text: "Clear flight trails"
enabled: QGroundControl.multiVehicleManager.activeVehicle
onClicked: {
QGroundControl.multiVehicleManager.activeVehicle.clearTrajectoryPoints()
_dropButtonsExclusiveGroup.current = null
}
}
}
}
}
......
......@@ -43,7 +43,6 @@ Item {
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
spacing: _margins
visible: multiVehicleManager.activeVehicle
Rectangle {
id: valuesPageIndicator
......
......@@ -758,7 +758,7 @@ QGCView {
spacing: _margin
QGCLabel {
width: columnHolder.width
width: sendSaveRow.width
wrapMode: Text.WordWrap
text: syncNeeded && !controller.autoSync ?
"You have unsaved changed to you mission. You should send to your vehicle, or save to a file:" :
......@@ -766,6 +766,7 @@ QGCView {
}
Row {
id: sendSaveRow
visible: true //autoSyncCheckBox.enabled && autoSyncCheckBox.checked
spacing: ScreenTools.defaultFontPixelWidth
......
......@@ -76,8 +76,9 @@ public:
Q_PROPERTY(Fact* offlineEditingFirmwareType READ offlineEditingFirmwareType CONSTANT)
Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT)
Q_PROPERTY(QGeoCoordinate flightMapPosition MEMBER _flightMapPosition NOTIFY flightMapPositionChanged)
Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT)
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
Q_PROPERTY(bool experimentalSurvey READ experimentalSurvey WRITE setExperimentalSurvey NOTIFY experimentalSurveyChanged)
......@@ -152,6 +153,7 @@ signals:
void isVersionCheckEnabledChanged (bool enabled);
void mavlinkSystemIDChanged (int id);
void flightMapPositionChanged (QGeoCoordinate flightMapPosition);
void flightMapZoomChanged (int flightMapZoom);
void experimentalSurveyChanged (bool experimentalSurvey);
private:
......@@ -160,11 +162,12 @@ private:
LinkManager* _linkManager;
MissionCommands* _missionCommands;
MultiVehicleManager* _multiVehicleManager;
QGCMapEngineManager* _mapEngineManager;
QGCMapEngineManager* _mapEngineManager;
bool _virtualTabletJoystick;
QGeoCoordinate _flightMapPosition;
QGeoCoordinate _flightMapPosition;
int _flightMapZoom;
SettingsFact _offlineEditingFirmwareTypeFact;
FactMetaData _offlineEditingFirmwareTypeMetaData;
......
......@@ -228,3 +228,11 @@ void QmlObjectListModel::deleteListAndContents(void)
}
deleteLater();
}
void QmlObjectListModel::clearAndDeleteContents(void)
{
for (int i=0; i<_objectList.count(); i++) {
_objectList[i]->deleteLater();
}
clear();
}
......@@ -63,6 +63,9 @@ public:
/// Calls deleteLater on all items and this itself.
void deleteListAndContents(void);
/// Clears the list and calls delete on each entry
void clearAndDeleteContents(void);
signals:
void countChanged(int count);
void dirtyChanged(bool dirtyChanged);
......
......@@ -252,15 +252,21 @@ Rectangle {
anchors.top: parent.top
anchors.bottom: bottomRect.top
color: (__qgcPal.globalTheme === QGCPalette.Light) ? "black" : "#98aca4"
Map {
id: _map
anchors.fill: parent
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.15
zoomLevel: 10
center: QGroundControl.defaultMapPosition
gesture.flickDeceleration: 3000
gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
plugin: Plugin { name: "QGroundControl" }
Component.onCompleted: {
center = QGroundControl.flightMapPosition
zoomLevel = QGroundControl.flightMapZoom
}
onCenterChanged: {
handleChanges()
checkSanity()
......@@ -282,6 +288,7 @@ Rectangle {
anchors.fill: parent
}
}
Rectangle {
width: ScreenTools.defaultFontPixelHeight * 16
height: ScreenTools.defaultFontPixelHeight * 9
......
......@@ -141,6 +141,7 @@ Vehicle::Vehicle(LinkInterface* link,
connect(this, &Vehicle::_sendMessageOnThread, this, &Vehicle::_sendMessage, Qt::QueuedConnection);
connect(this, &Vehicle::_sendMessageOnLinkOnThread, this, &Vehicle::_sendMessageOnLink, Qt::QueuedConnection);
connect(this, &Vehicle::flightModeChanged, this, &Vehicle::_announceflightModeChanged);
connect(this, &Vehicle::armedChanged, this, &Vehicle::_announceArmedChanged);
_uas = new UAS(_mavlink, this, _firmwarePluginManager);
......@@ -467,7 +468,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
if (sysStatus.battery_remaining > 0 && sysStatus.battery_remaining < _batteryFactGroup.percentRemainingAnnounce()->rawValue().toInt()) {
if (!_lowBatteryAnnounceTimer.isValid() || _lowBatteryAnnounceTimer.elapsed() > _lowBatteryAnnounceRepeatMSecs) {
_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)
_connectionLost = true;
_heardFrom = false;
emit connectionLostChanged(true);
_say(QString("communication lost to %1").arg(_vehicleIdSpeech()));
_say(QString("%1 communication lost").arg(_vehicleIdSpeech()));
if (_autoDisconnect) {
disconnectInactiveVehicle();
}
......@@ -1301,7 +1302,7 @@ void Vehicle::_connectionActive(void)
if (_connectionLost) {
_connectionLost = 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)
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) {
return QString("vehicle %1").arg(id());
} else {
return QStringLiteral("vehicle");
return QString();
}
}
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::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
......@@ -318,6 +318,8 @@ public:
Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust);
Q_INVOKABLE void disconnectInactiveVehicle(void);
Q_INVOKABLE void clearTrajectoryPoints(void);
// Property accessors
QGeoCoordinate coordinate(void) { return _coordinate; }
......@@ -524,6 +526,7 @@ private slots:
void _parametersReady(bool parametersReady);
void _remoteControlRSSIChanged(uint8_t rssi);
void _announceflightModeChanged(const QString& flightMode);
void _announceArmedChanged(bool armed);
void _handleTextMessage (int newCount);
void _handletextMessageReceived (UASMessage* message);
......
......@@ -165,7 +165,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
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.")
onLinkActivated: Qt.openUrlExternally(link)
......
......@@ -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("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)
{
statechanged = true;
this->status = state.system_status;
getStatusForCode((int)state.system_status, uasState, stateDescription);
emit statusChanged(this, uasState, stateDescription);
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
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;
......
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