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)
{
_logger = std::make_shared<qt::Logger>();
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<qt::DispatchingLogger>(_logger);
......
......@@ -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();
});
......
......@@ -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
......
......@@ -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
}
}
......
......@@ -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;
};
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