Removed the unused styleOptions from RideMap (#3849)

* Removed the unused styleOptions functions and associated Q_PROPERTY.
* Remove unused dark.css resource
Co-authored-by: Ale Martinez <amtriathlon@gmail.com>
This commit is contained in:
Paul Johnson
2021-04-02 22:56:47 +01:00
committed by GitHub
parent e849b4fd81
commit 92f81ef711
4 changed files with 12 additions and 39 deletions

View File

@@ -440,9 +440,7 @@ void RideMapWindow::createHtml()
"\n"); "\n");
if (mapCombo->currentIndex() == OSM) { if (mapCombo->currentIndex() == OSM) {
// when we have style options we draw the route in cplotmarker colors
// and no opacity since its just a stylised map used for dashboards or
// small thumbnails.
currentPage += QString("function drawRouteForLatLons(latlons) {\n" currentPage += QString("function drawRouteForLatLons(latlons) {\n"
@@ -471,14 +469,11 @@ void RideMapWindow::createHtml()
"routeYellow.on('mouseover', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n" "routeYellow.on('mouseover', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n"
"routeYellow.on('mousemove', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n" "routeYellow.on('mousemove', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n"
"}\n").arg(styleoptions == "" ? "#FFFF00" : GColor(CPLOTMARKER).name()) "}\n").arg("#FFFF00")
.arg(styleoptions == "" ? 0.4 : 1.0); .arg(0.4);
} }
else if (mapCombo->currentIndex() == GOOGLE) { else if (mapCombo->currentIndex() == GOOGLE) {
// when we have style options we draw the route in cplotmarker colors
// and no opacity since its just a stylised map used for dashboards or
// small thumbnails.
currentPage += QString("function drawRouteForLatLons(latlons) {\n" currentPage += QString("function drawRouteForLatLons(latlons) {\n"
// route will be drawn with these options // route will be drawn with these options
@@ -506,8 +501,8 @@ void RideMapWindow::createHtml()
" google.maps.event.addListener(routeYellow, 'mouseup', function(event) { map.setOptions({draggable: true, zoomControl: true, scrollwheel: true, disableDoubleClickZoom: false}); webBridge.mouseup(); });\n" " google.maps.event.addListener(routeYellow, 'mouseup', function(event) { map.setOptions({draggable: true, zoomControl: true, scrollwheel: true, disableDoubleClickZoom: false}); webBridge.mouseup(); });\n"
" google.maps.event.addListener(routeYellow, 'mouseover', function(event) { webBridge.hoverPath(event.latLng.lat(), event.latLng.lng()); });\n" " google.maps.event.addListener(routeYellow, 'mouseover', function(event) { webBridge.hoverPath(event.latLng.lat(), event.latLng.lng()); });\n"
"}\n").arg(styleoptions == "" ? "#FFFF00" : GColor(CPLOTMARKER).name()) "}\n").arg("#FFFF00")
.arg(styleoptions == "" ? 0.4f : 1.0f); .arg(0.4f);
} }
currentPage += QString("function drawIntervals() { \n" currentPage += QString("function drawIntervals() { \n"
@@ -641,8 +636,6 @@ void RideMapWindow::createHtml()
// initialise function called when map loaded // initialise function called when map loaded
"function initialize() {\n"); "function initialize() {\n");
if (styleoptions == "") {
// TERRAIN style map please and make it draggable // TERRAIN style map please and make it draggable
// note that because QT webkit offers touch/gesture // note that because QT webkit offers touch/gesture
// support the Google API only supports dragging // support the Google API only supports dragging
@@ -653,14 +646,6 @@ void RideMapWindow::createHtml()
" style: google.maps.MapTypeControlStyle.DEFAULT\n" " style: google.maps.MapTypeControlStyle.DEFAULT\n"
" };\n"); " };\n");
} else {
// USER DEFINED STYLE OPTIONS
currentPage += QString(""
"var styledMapType = new google.maps.StyledMapType( %1 "
" , {name: 'Styled Map'} );\n" ).arg(styleoptions);
}
currentPage += QString( currentPage += QString(
" var myOptions = {\n" " var myOptions = {\n"
" draggable: true,\n" " draggable: true,\n"
@@ -669,8 +654,8 @@ void RideMapWindow::createHtml()
" disableDefaultUI: %2,\n" " disableDefaultUI: %2,\n"
" tilt: 45,\n" " tilt: 45,\n"
" streetViewControl: false,\n" " streetViewControl: false,\n"
" };\n").arg(styleoptions != "" ? "'styled_map'" : "google.maps.MapTypeId.TERRAIN") " };\n").arg("google.maps.MapTypeId.TERRAIN")
.arg(styleoptions != "" ? "true" : "false"); .arg("false");
@@ -686,12 +671,6 @@ void RideMapWindow::createHtml()
arg(maxLon,0,'g',GPS_COORD_TO_STRING); arg(maxLon,0,'g',GPS_COORD_TO_STRING);
if (styleoptions != "") {
currentPage += QString(""
" map.mapTypes.set('styled_map', styledMapType);\n"
" map.setMapTypeId('styled_map');\n");
}
currentPage += QString("" currentPage += QString(""
// add the bike layer, useful in some areas, but coverage // add the bike layer, useful in some areas, but coverage
// is limited, US gets best coverage at this point (Summer 2011) // is limited, US gets best coverage at this point (Summer 2011)
@@ -813,8 +792,8 @@ RideMapWindow::drawShadedRoute()
"polyline.on('mouseup', function(event) { map.dragging.enable();L.DomEvent.stopPropagation(event);webBridge.mouseup(); });\n" // setOptions ? "polyline.on('mouseup', function(event) { map.dragging.enable();L.DomEvent.stopPropagation(event);webBridge.mouseup(); });\n" // setOptions ?
"polyline.on('mouseover', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n" "polyline.on('mouseover', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n"
"path = polyline.getLatLngs();\n" "path = polyline.getLatLngs();\n"
"}\n").arg(styleoptions == "" ? color.name() : GColor(CPLOTMARKER).name()) "}\n").arg(color.name())
.arg(styleoptions == "" ? 0.5 : 1.0); .arg(0.5);
} else if (mapCombo->currentIndex() == GOOGLE) { } else if (mapCombo->currentIndex() == GOOGLE) {
// color the polyline // color the polyline
code += QString("var polyOptions = {\n" code += QString("var polyOptions = {\n"
@@ -824,8 +803,8 @@ RideMapWindow::drawShadedRoute()
" zIndex: 0,\n" " zIndex: 0,\n"
"}\n" "}\n"
"polyline.setOptions(polyOptions);\n" "polyline.setOptions(polyOptions);\n"
"}\n").arg(styleoptions == "" ? color.name() : GColor(CPLOTMARKER).name()) "}\n").arg(color.name())
.arg(styleoptions == "" ? 0.5f : 1.0f); .arg(0.5f);
} }
view->page()->runJavaScript(code); view->page()->runJavaScript(code);
@@ -1226,7 +1205,7 @@ MapWebBridge::drawOverlays()
mw->createMarkers(); mw->createMarkers();
// overlay a shaded route // overlay a shaded route
if (mw->getStyleOptions() == "") mw->drawShadedRoute(); mw->drawShadedRoute();
// Get the latest new selection lap number. // Get the latest new selection lap number.
RideItem *rideItem = mw->property("ride").value<RideItem*>(); RideItem *rideItem = mw->property("ride").value<RideItem*>();

View File

@@ -111,7 +111,6 @@ class RideMapWindow : public GcChartWindow
Q_PROPERTY(bool showintervals READ showIntervals WRITE setShowIntervals USER true) Q_PROPERTY(bool showintervals READ showIntervals WRITE setShowIntervals USER true)
Q_PROPERTY(int osmts READ osmTS WRITE setOsmTS USER true) Q_PROPERTY(int osmts READ osmTS WRITE setOsmTS USER true)
Q_PROPERTY(QString googleKey READ googleKey WRITE setGoogleKey USER true) Q_PROPERTY(QString googleKey READ googleKey WRITE setGoogleKey USER true)
Q_PROPERTY(QString styleoptions READ getStyleOptions WRITE setStyleOptions USER false)
public: public:
typedef enum { typedef enum {
@@ -143,9 +142,6 @@ class RideMapWindow : public GcChartWindow
setTileServerUrlForTileType(x); setTileServerUrlForTileType(x);
} }
QString getStyleOptions() const { return styleoptions; }
void setStyleOptions(QString x) { styleoptions=x; }
QString googleKey() const { return gkey->text(); } QString googleKey() const { return gkey->text(); }
void setGoogleKey(QString x) { gkey->setText(x); } void setGoogleKey(QString x) { gkey->setText(x); }
@@ -172,7 +168,6 @@ class RideMapWindow : public GcChartWindow
private: private:
bool first; bool first;
QString styleoptions;
QComboBox *mapCombo, *tileCombo; QComboBox *mapCombo, *tileCombo;
QCheckBox *showMarkersCk, *showFullPlotCk, *showInt; QCheckBox *showMarkersCk, *showFullPlotCk, *showInt;

View File

@@ -180,7 +180,6 @@
<file>images/oxygen/down.png</file> <file>images/oxygen/down.png</file>
<file>audio/lap.wav</file> <file>audio/lap.wav</file>
<file>images/configure.png</file> <file>images/configure.png</file>
<file>web/googlemap/dark.css</file>
<file>images/toolbar/cloud.png</file> <file>images/toolbar/cloud.png</file>
<file>images/services/strava_compatible.png</file> <file>images/services/strava_compatible.png</file>
<file>images/services/strava_connect.png</file> <file>images/services/strava_connect.png</file>