diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index e5bc994154c25c1a4c14551863a35cb61ae89aa4..d032df6f264a212657d7f88d1ac3c15428c88758 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -70,6 +70,7 @@ src/QmlControls/QGCFlickableVerticalIndicator.qml src/QmlControls/QGCLabel.qml src/QmlControls/QGCListView.qml + src/QmlControls/QGCMapLabel.qml src/QmlControls/QGCMobileFileOpenDialog.qml src/QmlControls/QGCMobileFileSaveDialog.qml src/QmlControls/QGCMovableItem.qml diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 3ccdeb548c7e631b68e20d1d1948452b6105cd90..c7a2258c4139ea002755ca9856811816fad70730 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -71,10 +71,10 @@ FlightMap { Component.onCompleted: start(false /* editMode */) } - QGCLabel { + QGCMapLabel { id: flyLabel + map: flightMap text: qsTr("Fly") - color: mapPal.text visible: !ScreenTools.isShortScreen anchors.topMargin: _toolButtonTopMargin anchors.horizontalCenter: centerMapDropButton.horizontalCenter diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 8d9830e43f9e4b5199ab2bac7fdb377d9a80602f..ed8042802612c380ab54cb88492e6f6fee8b734d 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -161,13 +161,14 @@ Map { // Not sure why this is needed, but trying to reference polygonDrawer directly from other code doesn't work property alias polygonDraw: polygonDrawer - QGCLabel { - id: polygonHelp + QGCMapLabel { + id: polygonHelp anchors.topMargin: parent.height - ScreenTools.availableHeight anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right horizontalAlignment: Text.AlignHCenter + map: _map text: qsTr("Click to add point %1").arg(ScreenTools.isMobile || !polygonDrawer.polygonReady ? "" : qsTr("- Right Click to end polygon")) visible: polygonDrawer.drawingPolygon diff --git a/src/FlightMap/MapScale.qml b/src/FlightMap/MapScale.qml index 7c0d878bebd1ca4ee2ab53ba1263619158be0f66..26a5dfb6f42ec0d2531657f2c0254f95d21de3cd 100644 --- a/src/FlightMap/MapScale.qml +++ b/src/FlightMap/MapScale.qml @@ -138,9 +138,9 @@ Item { onTriggered: calculateScale() } - QGCLabel { + QGCMapLabel { id: scaleText - color: _color + map: mapControl font.family: ScreenTools.demiboldFontFamily anchors.left: parent.left anchors.right: parent.right diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index 738a9864c65b1b8633298aac48a434be99edea4c..0b180e91011f50d0d1041e5e29a624221229bdcf 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -584,6 +584,8 @@ QGCView { text: qsTr("Mission") checked: true color: mapPal.text + textStyle: Text.Outline + textStyleColor: mapPal.textOutline } Item { height: 1; width: 1 } @@ -593,6 +595,8 @@ QGCView { exclusiveGroup: planElementSelectorGroup text: qsTr("Fence") color: mapPal.text + textStyle: Text.Outline + textStyleColor: mapPal.textOutline } Item { height: 1; width: 1 } @@ -602,6 +606,8 @@ QGCView { exclusiveGroup: planElementSelectorGroup text: qsTr("Rally") color: mapPal.text + textStyle: Text.Outline + textStyleColor: mapPal.textOutline } } // Row - Plan Element Selector @@ -770,10 +776,10 @@ QGCView { } } - QGCLabel { + QGCMapLabel { id: planLabel + map: editorMap text: qsTr("Plan") - color: mapPal.text visible: !ScreenTools.isShortScreen anchors.topMargin: _toolButtonTopMargin anchors.horizontalCenter: addMissionItemsButton.horizontalCenter diff --git a/src/QGCMapPalette.cc b/src/QGCMapPalette.cc index 5779dfff8f51cb4214830f9c1dfa63622617ed06..0bdd60f77d678b797e6821cb28cf6aa59ffbd4d1 100644 --- a/src/QGCMapPalette.cc +++ b/src/QGCMapPalette.cc @@ -15,6 +15,7 @@ QColor QGCMapPalette::_thumbJoystick[QGCMapPalette::_cColorGroups] = { QColor(255,255,255,127), QColor(0,0,0,127) }; QColor QGCMapPalette::_text [QGCMapPalette::_cColorGroups] = { QColor(255,255,255), QColor(0,0,0) }; +QColor QGCMapPalette::_textOutline [QGCMapPalette::_cColorGroups] = { QColor(0,0,0), QColor(255,255,255) }; QGCMapPalette::QGCMapPalette(QObject* parent) : QObject(parent) diff --git a/src/QGCMapPalette.h b/src/QGCMapPalette.h index 14698c06b67a02f9ff3f4ec21d13f62d4df128a4..7896c6746ab879fe1920b083e91e2ea15a3f6a6e 100644 --- a/src/QGCMapPalette.h +++ b/src/QGCMapPalette.h @@ -43,6 +43,7 @@ class QGCMapPalette : public QObject Q_PROPERTY(bool lightColors READ lightColors WRITE setLightColors NOTIFY paletteChanged) Q_PROPERTY(QColor text READ text NOTIFY paletteChanged) + Q_PROPERTY(QColor textOutline READ textOutline NOTIFY paletteChanged) Q_PROPERTY(QColor thumbJoystick READ thumbJoystick NOTIFY paletteChanged) public: @@ -50,6 +51,7 @@ public: /// Text color QColor text(void) const { return _text[_lightColors ? 0 : 1]; } + QColor textOutline(void) const { return _textOutline[_lightColors ? 0 : 1]; } /// Thumb joystick indicator QColor thumbJoystick(void) const { return _thumbJoystick[_lightColors ? 0 : 1]; } @@ -68,6 +70,7 @@ private: static QColor _thumbJoystick[_cColorGroups]; static QColor _text[_cColorGroups]; + static QColor _textOutline[_cColorGroups]; }; #endif diff --git a/src/QmlControls/QGCMapLabel.qml b/src/QmlControls/QGCMapLabel.qml new file mode 100644 index 0000000000000000000000000000000000000000..ebc49222c884341862d7748c23486f5dfa15780e --- /dev/null +++ b/src/QmlControls/QGCMapLabel.qml @@ -0,0 +1,16 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 + +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 + +/// Text control used for displaying text of Maps +QGCLabel { + property var map + + QGCMapPalette { id: mapPal; lightColors: map.isSatelliteMap } + + color: mapPal.text + style: Text.Outline + styleColor: mapPal.textOutline +} diff --git a/src/QmlControls/QGCRadioButton.qml b/src/QmlControls/QGCRadioButton.qml index 4747e3d41b169660b683c052508e83802fa67011..cfcb5072c873e0540ca1efefed5b4ec06d338793 100644 --- a/src/QmlControls/QGCRadioButton.qml +++ b/src/QmlControls/QGCRadioButton.qml @@ -1,20 +1,23 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 -import QGroundControl.Palette 1.0 -import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.ScreenTools 1.0 RadioButton { - property var color: _qgcPal.text ///< Text color + property var color: qgcPal.text ///< Text color + property int textStyle: Text.Normal + property color textStyleColor: qgcPal.text - property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } + QGCPalette { id: qgcPal; colorGroupEnabled: enabled } style: RadioButtonStyle { label: Item { implicitWidth: text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 implicitHeight: text.implicitHeight baselineOffset: text.y + text.baselineOffset + Rectangle { anchors.fill: text anchors.margins: -1 @@ -27,6 +30,7 @@ RadioButton { border.color: "#47b" opacity: 0.6 } + Text { id: text text: control.text @@ -34,6 +38,8 @@ RadioButton { font.family: ScreenTools.normalFontFamily antialiasing: true color: control.color + style: control.textStyle + styleColor: control.textStyleColor anchors.centerIn: parent } } diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index c3d9009102698cab07c04393aeaf2c896d0fa1b4..f1a1caf12d617e379918ad4f5cbe3ee434f66c46 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -30,6 +30,7 @@ QGCComboBox 1.0 QGCComboBox.qml QGCFlickable 1.0 QGCFlickable.qml QGCLabel 1.0 QGCLabel.qml QGCListView 1.0 QGCListView.qml +QGCMapLabel 1.0 QGCMapLabel.qml QGCMobileFileOpenDialog 1.0 QGCMobileFileOpenDialog.qml QGCMobileFileSaveDialog 1.0 QGCMobileFileSaveDialog.qml QGCMovableItem 1.0 QGCMovableItem.qml diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index 450a51058a812a08149e06d995cd5f1ade82f6a0..985afec75452171ae0d30eaba22e507885ec307f 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -508,6 +508,8 @@ QGCView { gesture.enabled: false visible: _showPreview + property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1 + plugin: Plugin { name: "QGroundControl" } MapScale { @@ -523,9 +525,9 @@ QGCView { border.color: _mapAdjustedColor color: "transparent" - QGCLabel { + QGCMapLabel { anchors.centerIn: parent - color: _mapAdjustedColor + map: minZoomPreview text: qsTr("Min Zoom: %1").arg(sliderMinZoom.value) } MouseArea { @@ -545,6 +547,8 @@ QGCView { gesture.enabled: false visible: _showPreview + property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1 + plugin: Plugin { name: "QGroundControl" } MapScale { @@ -560,9 +564,9 @@ QGCView { border.color: _mapAdjustedColor color: "transparent" - QGCLabel { + QGCMapLabel { anchors.centerIn: parent - color: _mapAdjustedColor + map: maxZoomPreview text: qsTr("Max Zoom: %1").arg(sliderMaxZoom.value) } MouseArea {