Commit 5982ad4c authored by Gus Grubba's avatar Gus Grubba

Fixed QML side and done for the night.

parent ad4d7957
...@@ -34,7 +34,7 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox) ...@@ -34,7 +34,7 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{ {
_logger = std::make_shared<qt::Logger>(); _logger = std::make_shared<qt::Logger>();
qt::register_types(); // TODO: still needed?s 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(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);
......
...@@ -49,6 +49,7 @@ AirMapWeatherInformation::setROI(const QGeoCoordinate& center) ...@@ -49,6 +49,7 @@ AirMapWeatherInformation::setROI(const QGeoCoordinate& center)
void void
AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate) AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate)
{ {
qCDebug(AirMapManagerLog) << "Request Weather";
if (!_shared.client()) { if (!_shared.client()) {
qCDebug(AirMapManagerLog) << "No AirMap client instance. Not updating Weather information"; qCDebug(AirMapManagerLog) << "No AirMap client instance. Not updating Weather information";
_valid = false; _valid = false;
...@@ -72,8 +73,10 @@ AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate ...@@ -72,8 +73,10 @@ AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate
_humidity = weather.humidity; _humidity = weather.humidity;
_visibility = weather.visibility; _visibility = weather.visibility;
_precipitation = weather.precipitation; _precipitation = weather.precipitation;
qCDebug(AirMapManagerLog) << "Weather Info: " << _valid << _icon;
} else { } else {
_valid = false; _valid = false;
qCDebug(AirMapManagerLog) << "Request Weather Failed";
} }
emit weatherChanged(); emit weatherChanged();
}); });
......
...@@ -71,7 +71,7 @@ Item { ...@@ -71,7 +71,7 @@ Item {
} }
AirspaceWeather { AirspaceWeather {
iconHeight: ScreenTools.defaultFontPixelWidth * 2.5 iconHeight: ScreenTools.defaultFontPixelWidth * 2.5
visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -141,7 +141,7 @@ Item { ...@@ -141,7 +141,7 @@ Item {
height: 1 height: 1
} }
AirspaceWeather { AirspaceWeather {
visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather && showColapse visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid && showColapse
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -162,7 +162,7 @@ Item { ...@@ -162,7 +162,7 @@ Item {
} }
} }
AirspaceWeather { AirspaceWeather {
visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather && !showColapse visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid && !showColapse
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
...@@ -18,7 +18,7 @@ Item { ...@@ -18,7 +18,7 @@ Item {
property color _colorWhite: "#ffffff" property color _colorWhite: "#ffffff"
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _celcius: QGroundControl.settingsManager.unitsSettings.temperatureUnits.rawValue === UnitsSettings.TemperatureUnitsCelsius 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") property string _tempS: (_celcius ? _tempC : _tempC * 1.8 + 32).toFixed(0) + (_celcius ? "°C" : "°F")
Row { Row {
id: weatherRow id: weatherRow
...@@ -27,15 +27,15 @@ Item { ...@@ -27,15 +27,15 @@ Item {
width: height width: height
height: iconHeight height: iconHeight
sourceSize.height: height sourceSize.height: height
source: _activeVehicle ? _activeVehicle.airspaceController.weatherIcon : "" source: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid ? _activeVehicle.airspaceController.weatherInfo.icon : ""
color: _colorWhite color: _colorWhite
visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
QGCLabel { QGCLabel {
text: _tempS text: _tempS
color: _colorWhite color: _colorWhite
visible: _activeVehicle && _activeVehicle.airspaceController.hasWeather visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
......
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
QmlObjectListModel* polygonRestrictions () { return &_polygonRestrictions; } QmlObjectListModel* polygonRestrictions () { return &_polygonRestrictions; }
QmlObjectListModel* circularRestrictions () { return &_circleRestrictions; } QmlObjectListModel* circularRestrictions () { return &_circleRestrictions; }
AirspaceWeatherInfoProvider* weatherInfo () { return _weather;} AirspaceWeatherInfoProvider* weatherInfo () { return _weatherProvider; }
void setToolbox(QGCToolbox* toolbox) override; void setToolbox(QGCToolbox* toolbox) override;
...@@ -109,5 +109,4 @@ private: ...@@ -109,5 +109,4 @@ private:
QTimer _roiUpdateTimer; QTimer _roiUpdateTimer;
QGeoCoordinate _roiCenter; QGeoCoordinate _roiCenter;
double _roiRadius; double _roiRadius;
AirspaceWeatherInfoProvider* _weather;
}; };
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