From 5982ad4cd3531687a9483d1b6fbceddf2a4adcd4 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Thu, 25 Jan 2018 04:25:26 -0500 Subject: [PATCH] Fixed QML side and done for the night. --- src/Airmap/AirMapManager.cc | 2 +- src/Airmap/AirMapWeatherInformation.cc | 3 +++ src/Airmap/AirspaceControl.qml | 6 +++--- src/Airmap/AirspaceWeather.qml | 8 ++++---- src/AirspaceManagement/AirspaceManager.h | 3 +-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Airmap/AirMapManager.cc b/src/Airmap/AirMapManager.cc index c8bd695ad..39d3ae554 100644 --- a/src/Airmap/AirMapManager.cc +++ b/src/Airmap/AirMapManager.cc @@ -34,7 +34,7 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox) { _logger = std::make_shared(); qt::register_types(); // TODO: still needed?s - _logger->logging_category().setEnabled(QtDebugMsg, true); + _logger->logging_category().setEnabled(QtDebugMsg, false); _logger->logging_category().setEnabled(QtInfoMsg, true); _logger->logging_category().setEnabled(QtWarningMsg, true); _dispatchingLogger = std::make_shared(_logger); diff --git a/src/Airmap/AirMapWeatherInformation.cc b/src/Airmap/AirMapWeatherInformation.cc index 17608fc13..2cffed63e 100644 --- a/src/Airmap/AirMapWeatherInformation.cc +++ b/src/Airmap/AirMapWeatherInformation.cc @@ -49,6 +49,7 @@ AirMapWeatherInformation::setROI(const QGeoCoordinate& center) void AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate) { + qCDebug(AirMapManagerLog) << "Request Weather"; if (!_shared.client()) { qCDebug(AirMapManagerLog) << "No AirMap client instance. Not updating Weather information"; _valid = false; @@ -72,8 +73,10 @@ AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate _humidity = weather.humidity; _visibility = weather.visibility; _precipitation = weather.precipitation; + qCDebug(AirMapManagerLog) << "Weather Info: " << _valid << _icon; } else { _valid = false; + qCDebug(AirMapManagerLog) << "Request Weather Failed"; } emit weatherChanged(); }); diff --git a/src/Airmap/AirspaceControl.qml b/src/Airmap/AirspaceControl.qml index 3f601db9b..df936210b 100644 --- a/src/Airmap/AirspaceControl.qml +++ b/src/Airmap/AirspaceControl.qml @@ -71,7 +71,7 @@ Item { } AirspaceWeather { iconHeight: ScreenTools.defaultFontPixelWidth * 2.5 - visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather + visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid anchors.verticalCenter: parent.verticalCenter } } @@ -141,7 +141,7 @@ Item { height: 1 } AirspaceWeather { - visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather && showColapse + visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid && showColapse anchors.verticalCenter: parent.verticalCenter } } @@ -162,7 +162,7 @@ Item { } } AirspaceWeather { - visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather && !showColapse + visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid && !showColapse anchors.right: parent.right anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.verticalCenter: parent.verticalCenter diff --git a/src/Airmap/AirspaceWeather.qml b/src/Airmap/AirspaceWeather.qml index c8a9c66e5..f173f83c4 100644 --- a/src/Airmap/AirspaceWeather.qml +++ b/src/Airmap/AirspaceWeather.qml @@ -18,7 +18,7 @@ Item { property color _colorWhite: "#ffffff" property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _celcius: QGroundControl.settingsManager.unitsSettings.temperatureUnits.rawValue === UnitsSettings.TemperatureUnitsCelsius - property int _tempC: _activeVehicle ? _activeVehicle.airspaceController.weatherTemp : 0 + property int _tempC: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid ? _activeVehicle.airspaceController.weatherInfo.temperature : 0 property string _tempS: (_celcius ? _tempC : _tempC * 1.8 + 32).toFixed(0) + (_celcius ? "°C" : "°F") Row { id: weatherRow @@ -27,15 +27,15 @@ Item { width: height height: iconHeight sourceSize.height: height - source: _activeVehicle ? _activeVehicle.airspaceController.weatherIcon : "" + source: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid ? _activeVehicle.airspaceController.weatherInfo.icon : "" color: _colorWhite - visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather + visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid anchors.verticalCenter: parent.verticalCenter } QGCLabel { text: _tempS color: _colorWhite - visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather + visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid anchors.verticalCenter: parent.verticalCenter } } diff --git a/src/AirspaceManagement/AirspaceManager.h b/src/AirspaceManagement/AirspaceManager.h index 9e891d8b0..91ce2d805 100644 --- a/src/AirspaceManagement/AirspaceManager.h +++ b/src/AirspaceManagement/AirspaceManager.h @@ -81,7 +81,7 @@ public: QmlObjectListModel* polygonRestrictions () { return &_polygonRestrictions; } QmlObjectListModel* circularRestrictions () { return &_circleRestrictions; } - AirspaceWeatherInfoProvider* weatherInfo () { return _weather;} + AirspaceWeatherInfoProvider* weatherInfo () { return _weatherProvider; } void setToolbox(QGCToolbox* toolbox) override; @@ -109,5 +109,4 @@ private: QTimer _roiUpdateTimer; QGeoCoordinate _roiCenter; double _roiRadius; - AirspaceWeatherInfoProvider* _weather; }; -- 2.22.0