Commit 37324549 authored by Don Gagne's avatar Don Gagne

New QGCMapLabel using outline font

This makes text show up better on map images
parent 0b451410
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
<file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">src/QmlControls/QGCFlickableVerticalIndicator.qml</file> <file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">src/QmlControls/QGCFlickableVerticalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file> <file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCListView.qml">src/QmlControls/QGCListView.qml</file> <file alias="QGroundControl/Controls/QGCListView.qml">src/QmlControls/QGCListView.qml</file>
<file alias="QGroundControl/Controls/QGCMapLabel.qml">src/QmlControls/QGCMapLabel.qml</file>
<file alias="QGroundControl/Controls/QGCMobileFileOpenDialog.qml">src/QmlControls/QGCMobileFileOpenDialog.qml</file> <file alias="QGroundControl/Controls/QGCMobileFileOpenDialog.qml">src/QmlControls/QGCMobileFileOpenDialog.qml</file>
<file alias="QGroundControl/Controls/QGCMobileFileSaveDialog.qml">src/QmlControls/QGCMobileFileSaveDialog.qml</file> <file alias="QGroundControl/Controls/QGCMobileFileSaveDialog.qml">src/QmlControls/QGCMobileFileSaveDialog.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file> <file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
......
...@@ -71,10 +71,10 @@ FlightMap { ...@@ -71,10 +71,10 @@ FlightMap {
Component.onCompleted: start(false /* editMode */) Component.onCompleted: start(false /* editMode */)
} }
QGCLabel { QGCMapLabel {
id: flyLabel id: flyLabel
map: flightMap
text: qsTr("Fly") text: qsTr("Fly")
color: mapPal.text
visible: !ScreenTools.isShortScreen visible: !ScreenTools.isShortScreen
anchors.topMargin: _toolButtonTopMargin anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: centerMapDropButton.horizontalCenter anchors.horizontalCenter: centerMapDropButton.horizontalCenter
......
...@@ -161,13 +161,14 @@ Map { ...@@ -161,13 +161,14 @@ Map {
// Not sure why this is needed, but trying to reference polygonDrawer directly from other code doesn't work // Not sure why this is needed, but trying to reference polygonDrawer directly from other code doesn't work
property alias polygonDraw: polygonDrawer property alias polygonDraw: polygonDrawer
QGCLabel { QGCMapLabel {
id: polygonHelp id: polygonHelp
anchors.topMargin: parent.height - ScreenTools.availableHeight anchors.topMargin: parent.height - ScreenTools.availableHeight
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
map: _map
text: qsTr("Click to add point %1").arg(ScreenTools.isMobile || !polygonDrawer.polygonReady ? "" : qsTr("- Right Click to end polygon")) text: qsTr("Click to add point %1").arg(ScreenTools.isMobile || !polygonDrawer.polygonReady ? "" : qsTr("- Right Click to end polygon"))
visible: polygonDrawer.drawingPolygon visible: polygonDrawer.drawingPolygon
......
...@@ -138,9 +138,9 @@ Item { ...@@ -138,9 +138,9 @@ Item {
onTriggered: calculateScale() onTriggered: calculateScale()
} }
QGCLabel { QGCMapLabel {
id: scaleText id: scaleText
color: _color map: mapControl
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
......
...@@ -584,6 +584,8 @@ QGCView { ...@@ -584,6 +584,8 @@ QGCView {
text: qsTr("Mission") text: qsTr("Mission")
checked: true checked: true
color: mapPal.text color: mapPal.text
textStyle: Text.Outline
textStyleColor: mapPal.textOutline
} }
Item { height: 1; width: 1 } Item { height: 1; width: 1 }
...@@ -593,6 +595,8 @@ QGCView { ...@@ -593,6 +595,8 @@ QGCView {
exclusiveGroup: planElementSelectorGroup exclusiveGroup: planElementSelectorGroup
text: qsTr("Fence") text: qsTr("Fence")
color: mapPal.text color: mapPal.text
textStyle: Text.Outline
textStyleColor: mapPal.textOutline
} }
Item { height: 1; width: 1 } Item { height: 1; width: 1 }
...@@ -602,6 +606,8 @@ QGCView { ...@@ -602,6 +606,8 @@ QGCView {
exclusiveGroup: planElementSelectorGroup exclusiveGroup: planElementSelectorGroup
text: qsTr("Rally") text: qsTr("Rally")
color: mapPal.text color: mapPal.text
textStyle: Text.Outline
textStyleColor: mapPal.textOutline
} }
} // Row - Plan Element Selector } // Row - Plan Element Selector
...@@ -770,10 +776,10 @@ QGCView { ...@@ -770,10 +776,10 @@ QGCView {
} }
} }
QGCLabel { QGCMapLabel {
id: planLabel id: planLabel
map: editorMap
text: qsTr("Plan") text: qsTr("Plan")
color: mapPal.text
visible: !ScreenTools.isShortScreen visible: !ScreenTools.isShortScreen
anchors.topMargin: _toolButtonTopMargin anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: addMissionItemsButton.horizontalCenter anchors.horizontalCenter: addMissionItemsButton.horizontalCenter
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
QColor QGCMapPalette::_thumbJoystick[QGCMapPalette::_cColorGroups] = { QColor(255,255,255,127), QColor(0,0,0,127) }; 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::_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) : QGCMapPalette::QGCMapPalette(QObject* parent) :
QObject(parent) QObject(parent)
......
...@@ -43,6 +43,7 @@ class QGCMapPalette : public QObject ...@@ -43,6 +43,7 @@ class QGCMapPalette : public QObject
Q_PROPERTY(bool lightColors READ lightColors WRITE setLightColors NOTIFY paletteChanged) Q_PROPERTY(bool lightColors READ lightColors WRITE setLightColors NOTIFY paletteChanged)
Q_PROPERTY(QColor text READ text 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) Q_PROPERTY(QColor thumbJoystick READ thumbJoystick NOTIFY paletteChanged)
public: public:
...@@ -50,6 +51,7 @@ public: ...@@ -50,6 +51,7 @@ public:
/// Text color /// Text color
QColor text(void) const { return _text[_lightColors ? 0 : 1]; } QColor text(void) const { return _text[_lightColors ? 0 : 1]; }
QColor textOutline(void) const { return _textOutline[_lightColors ? 0 : 1]; }
/// Thumb joystick indicator /// Thumb joystick indicator
QColor thumbJoystick(void) const { return _thumbJoystick[_lightColors ? 0 : 1]; } QColor thumbJoystick(void) const { return _thumbJoystick[_lightColors ? 0 : 1]; }
...@@ -68,6 +70,7 @@ private: ...@@ -68,6 +70,7 @@ private:
static QColor _thumbJoystick[_cColorGroups]; static QColor _thumbJoystick[_cColorGroups];
static QColor _text[_cColorGroups]; static QColor _text[_cColorGroups];
static QColor _textOutline[_cColorGroups];
}; };
#endif #endif
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
}
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
RadioButton { 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 { style: RadioButtonStyle {
label: Item { label: Item {
implicitWidth: text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 implicitWidth: text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25
implicitHeight: text.implicitHeight implicitHeight: text.implicitHeight
baselineOffset: text.y + text.baselineOffset baselineOffset: text.y + text.baselineOffset
Rectangle { Rectangle {
anchors.fill: text anchors.fill: text
anchors.margins: -1 anchors.margins: -1
...@@ -27,6 +30,7 @@ RadioButton { ...@@ -27,6 +30,7 @@ RadioButton {
border.color: "#47b" border.color: "#47b"
opacity: 0.6 opacity: 0.6
} }
Text { Text {
id: text id: text
text: control.text text: control.text
...@@ -34,6 +38,8 @@ RadioButton { ...@@ -34,6 +38,8 @@ RadioButton {
font.family: ScreenTools.normalFontFamily font.family: ScreenTools.normalFontFamily
antialiasing: true antialiasing: true
color: control.color color: control.color
style: control.textStyle
styleColor: control.textStyleColor
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
......
...@@ -30,6 +30,7 @@ QGCComboBox 1.0 QGCComboBox.qml ...@@ -30,6 +30,7 @@ QGCComboBox 1.0 QGCComboBox.qml
QGCFlickable 1.0 QGCFlickable.qml QGCFlickable 1.0 QGCFlickable.qml
QGCLabel 1.0 QGCLabel.qml QGCLabel 1.0 QGCLabel.qml
QGCListView 1.0 QGCListView.qml QGCListView 1.0 QGCListView.qml
QGCMapLabel 1.0 QGCMapLabel.qml
QGCMobileFileOpenDialog 1.0 QGCMobileFileOpenDialog.qml QGCMobileFileOpenDialog 1.0 QGCMobileFileOpenDialog.qml
QGCMobileFileSaveDialog 1.0 QGCMobileFileSaveDialog.qml QGCMobileFileSaveDialog 1.0 QGCMobileFileSaveDialog.qml
QGCMovableItem 1.0 QGCMovableItem.qml QGCMovableItem 1.0 QGCMovableItem.qml
......
...@@ -508,6 +508,8 @@ QGCView { ...@@ -508,6 +508,8 @@ QGCView {
gesture.enabled: false gesture.enabled: false
visible: _showPreview visible: _showPreview
property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
plugin: Plugin { name: "QGroundControl" } plugin: Plugin { name: "QGroundControl" }
MapScale { MapScale {
...@@ -523,9 +525,9 @@ QGCView { ...@@ -523,9 +525,9 @@ QGCView {
border.color: _mapAdjustedColor border.color: _mapAdjustedColor
color: "transparent" color: "transparent"
QGCLabel { QGCMapLabel {
anchors.centerIn: parent anchors.centerIn: parent
color: _mapAdjustedColor map: minZoomPreview
text: qsTr("Min Zoom: %1").arg(sliderMinZoom.value) text: qsTr("Min Zoom: %1").arg(sliderMinZoom.value)
} }
MouseArea { MouseArea {
...@@ -545,6 +547,8 @@ QGCView { ...@@ -545,6 +547,8 @@ QGCView {
gesture.enabled: false gesture.enabled: false
visible: _showPreview visible: _showPreview
property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
plugin: Plugin { name: "QGroundControl" } plugin: Plugin { name: "QGroundControl" }
MapScale { MapScale {
...@@ -560,9 +564,9 @@ QGCView { ...@@ -560,9 +564,9 @@ QGCView {
border.color: _mapAdjustedColor border.color: _mapAdjustedColor
color: "transparent" color: "transparent"
QGCLabel { QGCMapLabel {
anchors.centerIn: parent anchors.centerIn: parent
color: _mapAdjustedColor map: maxZoomPreview
text: qsTr("Max Zoom: %1").arg(sliderMaxZoom.value) text: qsTr("Max Zoom: %1").arg(sliderMaxZoom.value)
} }
MouseArea { MouseArea {
......
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