Commit 7f35db33 authored by Gus Grubba's avatar Gus Grubba

Ruleset picker container

Added an "unknown" weather icon for when I get "valid" data and no icon
parent 0e1d01f5
......@@ -35,8 +35,8 @@ 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(QtInfoMsg, true);
_logger->logging_category().setEnabled(QtDebugMsg, false);
_logger->logging_category().setEnabled(QtInfoMsg, false);
_logger->logging_category().setEnabled(QtWarningMsg, true);
_dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger);
connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error);
......
......@@ -57,7 +57,11 @@ AirMapWeatherInformation::_requestWeatherUpdate(const QGeoCoordinate& coordinate
if (result) {
const Status::Weather& weather = result.value().weather;
_valid = true;
_icon = QStringLiteral("qrc:/airmapweather/") + QString::fromStdString(weather.icon) + QStringLiteral(".svg");
if(weather.icon.empty()) {
_icon = QStringLiteral("qrc:/airmapweather/unknown.svg");
} else {
_icon = QStringLiteral("qrc:/airmapweather/") + QString::fromStdString(weather.icon) + QStringLiteral(".svg");
}
qCDebug(AirMapManagerLog) << "Weather Info: " << _valid << "Icon:" << QString::fromStdString(weather.icon) << "Condition:" << QString::fromStdString(weather.condition) << "Temp:" << weather.temperature;
} else {
_valid = false;
......
......@@ -228,6 +228,7 @@ Item {
color: _colorGray
anchors.verticalCenter: parent.verticalCenter
QGCColoredImage {
id: pencilIcon
width: height
height: parent.height * 0.5
sourceSize.height: height
......@@ -301,6 +302,7 @@ Item {
color: Qt.rgba(0,0,0,0.1)
MouseArea {
anchors.fill: parent
onWheel: { wheel.accepted = true; }
onClicked: {
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
......@@ -325,11 +327,12 @@ Item {
}
Rectangle {
id: ruleSelectorRect
x: 0
y: 0
color: qgcPal.window
width: rulesCol.width + ScreenTools.defaultFontPixelWidth
height: rulesCol.height + ScreenTools.defaultFontPixelHeight
radius: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
Column {
id: rulesCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
......@@ -388,8 +391,41 @@ Item {
}
}
}
//-- Arrow
QGCColoredImage {
id: arrowIconShadow
anchors.fill: arrowIcon
sourceSize.height: height
source: "qrc:/airmap/right-arrow.svg"
color: qgcPal.window
visible: false
}
DropShadow {
anchors.fill: arrowIconShadow
visible: ruleSelectorRect.visible
horizontalOffset: 4
verticalOffset: 4
radius: 32.0
samples: 65
color: Qt.rgba(0,0,0,0.75)
source: arrowIconShadow
}
QGCColoredImage {
id: arrowIcon
width: height
height: ScreenTools.defaultFontPixelHeight * 2
sourceSize.height: height
source: "qrc:/airmap/right-arrow.svg"
color: ruleSelectorRect.color
anchors.left: ruleSelectorRect.right
anchors.top: ruleSelectorRect.top
anchors.topMargin: (ScreenTools.defaultFontPixelHeight * 4) - (height * 0.5) + (pencilIcon.height * 0.5)
}
Component.onCompleted: {
mainWindow.disableToolbar()
var target = mainWindow.mapFromItem(pencilIcon, 0, 0)
ruleSelectorRect.x = target.x - ruleSelectorRect.width - (ScreenTools.defaultFontPixelWidth * 7)
ruleSelectorRect.y = target.y - (ScreenTools.defaultFontPixelHeight * 4)
}
}
}
......
......@@ -12,30 +12,31 @@ import QGroundControl.Airmap 1.0
import QGroundControl.SettingsManager 1.0
Item {
height: _activeVehicle && _activeVehicle.airspaceController.hasWeather ? weatherRow.height : 0
width: _activeVehicle && _activeVehicle.airspaceController.hasWeather ? weatherRow.width : 0
height: _valid ? weatherRow.height : 0
width: _valid ? weatherRow.width : 0
property var iconHeight: ScreenTools.defaultFontPixelWidth * 4
property bool _valid: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
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.weatherInfo.valid ? _activeVehicle.airspaceController.weatherInfo.temperature : 0
property int _tempC: _valid ? _activeVehicle.airspaceController.weatherInfo.temperature : 0
property string _tempS: (_celcius ? _tempC : _tempC * 1.8 + 32).toFixed(0) + (_celcius ? "°C" : "°F")
Row {
id: weatherRow
spacing: ScreenTools.defaultFontPixelHeight * 0.5
id: weatherRow
spacing: ScreenTools.defaultFontPixelHeight * 0.5
QGCColoredImage {
width: height
height: iconHeight
sourceSize.height: height
source: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid ? _activeVehicle.airspaceController.weatherInfo.icon : ""
source: _valid ? _activeVehicle.airspaceController.weatherInfo.icon : ""
color: _colorWhite
visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
visible: _valid
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel {
text: _tempS
color: _colorWhite
visible: _activeVehicle && _activeVehicle.airspaceController.weatherInfo.valid
visible: _valid
anchors.verticalCenter: parent.verticalCenter
}
}
......
......@@ -14,6 +14,7 @@
<file alias="colapse.svg">images/colapse.svg</file>
<file alias="expand.svg">images/expand.svg</file>
<file alias="pencil.svg">images/pencil.svg</file>
<file alias="right-arrow.svg">images/right-arrow.svg</file>
</qresource>
<qresource prefix="/airmapweather">
<file alias="clear.svg">images/weather-icons/clear.svg</file>
......@@ -45,6 +46,7 @@
<file alias="sunny.svg">images/weather-icons/sunny.svg</file>
<file alias="thunderstorm.svg">images/weather-icons/thunderstorm.svg</file>
<file alias="tornado.svg">images/weather-icons/tornado.svg</file>
<file alias="unknown.svg">images/weather-icons/unknown.svg</file>
<file alias="windy.svg">images/weather-icons/windy.svg</file>
</qresource>
</RCC>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="72px" height="72px" viewBox="0 0 72 72" style="enable-background:new 0 0 72 72;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<polygon class="st0" points="0,0 0,72 72,36 "/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="200px" height="200px" viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
<title>sunny</title>
<desc>Created with Sketch.</desc>
<g>
<path d="M88.911,118.466l-0.468-4.671c-1.088-9.691,2.264-20.331,11.186-31.106c8.087-9.629,12.573-16.589,12.573-24.626
c0-9.229-5.702-15.417-17.146-15.499c-6.398,0-13.603,2.088-18.166,5.566l-4.327-11.344c6.107-4.337,16.273-7.25,25.8-7.25
c20.628,0,30.089,12.816,30.089,26.538c0,12.129-6.874,21.039-15.528,31.15c-7.908,9.491-10.797,17.445-10.195,26.632l0.238,4.609
H88.911z M84.955,143.633c0-6.619,4.44-11.316,10.696-11.33c6.387,0,10.575,4.711,10.615,11.33c0,6.242-4.175,11.177-10.696,11.177
C89.247,154.81,84.86,149.875,84.955,143.633z"/>
</g>
</svg>
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