mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
User selectable map route line color and switchable route line out & back opacity (#4030)
This commit is contained in:
@@ -71,6 +71,8 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont
|
||||
hideShadedZonesCk->setChecked(false);
|
||||
hideYellowLineCk = new QCheckBox();
|
||||
hideYellowLineCk->setChecked(false);
|
||||
hideRouteLineOpacityCk = new QCheckBox();
|
||||
hideRouteLineOpacityCk->setChecked(false);
|
||||
showInt = new QCheckBox();
|
||||
showInt->setChecked(true);
|
||||
|
||||
@@ -79,6 +81,7 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont
|
||||
commonLayout->addRow(new QLabel(tr("Show Full Plot")), showFullPlotCk);
|
||||
commonLayout->addRow(new QLabel(tr("Hide Shaded Zones")), hideShadedZonesCk);
|
||||
commonLayout->addRow(new QLabel(tr("Hide Yellow Line")), hideYellowLineCk);
|
||||
commonLayout->addRow(new QLabel(tr("Hide Out & Back Route Opacity")), hideRouteLineOpacityCk);
|
||||
commonLayout->addRow(new QLabel(tr("Show Intervals Overlay")), showInt);
|
||||
commonLayout->addRow(new QLabel(""));
|
||||
|
||||
@@ -115,6 +118,7 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont
|
||||
connect(showFullPlotCk, SIGNAL(stateChanged(int)), this, SLOT(showFullPlotChanged(int)));
|
||||
connect(hideShadedZonesCk, SIGNAL(stateChanged(int)), this, SLOT(hideShadedZonesChanged(int)));
|
||||
connect(hideYellowLineCk, SIGNAL(stateChanged(int)), this, SLOT(hideYellowLineChanged(int)));
|
||||
connect(hideRouteLineOpacityCk, SIGNAL(stateChanged(int)), this, SLOT(hideRouteLineOpacityChanged(int)));
|
||||
connect(osmTSUrl, SIGNAL(editingFinished()), this, SLOT(osmCustomTSURLEditingFinished()));
|
||||
connect(tileCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(tileTypeSelected(int)));
|
||||
|
||||
@@ -288,6 +292,14 @@ RideMapWindow::hideYellowLineChanged(int value)
|
||||
Q_UNUSED(value);
|
||||
forceReplot();
|
||||
}
|
||||
|
||||
void
|
||||
RideMapWindow::hideRouteLineOpacityChanged(int value)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
forceReplot();
|
||||
}
|
||||
|
||||
void
|
||||
RideMapWindow::osmCustomTSURLEditingFinished()
|
||||
{
|
||||
@@ -313,12 +325,14 @@ RideMapWindow::osmCustomTSURLEditingFinished()
|
||||
}
|
||||
|
||||
void
|
||||
RideMapWindow::configChanged(qint32)
|
||||
RideMapWindow::configChanged(qint32 value)
|
||||
{
|
||||
setProperty("color", GColor(CPLOTBACKGROUND));
|
||||
#ifndef Q_OS_MAC
|
||||
overlayIntervals->setStyleSheet(AbstractView::ourStyleSheet());
|
||||
#endif
|
||||
|
||||
if (value & CONFIG_APPEARANCE) forceReplot();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -749,7 +763,7 @@ void RideMapWindow::createHtml()
|
||||
|
||||
QColor RideMapWindow::GetColor(int watts)
|
||||
{
|
||||
if (range < 0 || hideShadedZones()) return Qt::red;
|
||||
if (range < 0 || hideShadedZones()) return GColor(MAPROUTELINE);
|
||||
else return zoneColor(context->athlete->zones(myRideItem ? myRideItem->sport : "Bike")->whichZone(range, watts), 7);
|
||||
}
|
||||
|
||||
@@ -829,7 +843,7 @@ RideMapWindow::drawShadedRoute()
|
||||
"polyline.on('mouseover', function(event) { webBridge.hoverPath(event.latlng.lat, event.latlng.lng); });\n"
|
||||
"path = polyline.getLatLngs();\n"
|
||||
"}\n").arg(color.name())
|
||||
.arg(0.5);
|
||||
.arg(hideRouteLineOpacity() ? 1.0 : 0.5f);
|
||||
} else if (mapCombo->currentIndex() == GOOGLE) {
|
||||
// color the polyline
|
||||
code += QString("var polyOptions = {\n"
|
||||
@@ -840,7 +854,7 @@ RideMapWindow::drawShadedRoute()
|
||||
"}\n"
|
||||
"polyline.setOptions(polyOptions);\n"
|
||||
"}\n").arg(color.name())
|
||||
.arg(0.5f);
|
||||
.arg(hideRouteLineOpacity() ? 1.0 : 0.5f);
|
||||
|
||||
}
|
||||
view->page()->runJavaScript(code);
|
||||
|
||||
@@ -111,6 +111,7 @@ class RideMapWindow : public GcChartWindow
|
||||
Q_PROPERTY(bool showintervals READ showIntervals WRITE setShowIntervals USER true)
|
||||
Q_PROPERTY(bool hideShadedZones READ hideShadedZones WRITE setHideShadedZones USER true)
|
||||
Q_PROPERTY(bool hideYellowLine READ hideYellowLine WRITE setHideYellowLine USER true)
|
||||
Q_PROPERTY(bool hideRouteLineOpacity READ hideRouteLineOpacity WRITE setRouteLineOpacity USER true)
|
||||
Q_PROPERTY(int osmts READ osmTS WRITE setOsmTS USER true)
|
||||
Q_PROPERTY(QString googleKey READ googleKey WRITE setGoogleKey USER true)
|
||||
|
||||
@@ -138,6 +139,9 @@ class RideMapWindow : public GcChartWindow
|
||||
bool hideYellowLine() const { return hideYellowLineCk->isChecked(); }
|
||||
void setHideYellowLine(bool x) { hideYellowLineCk->setChecked(x); }
|
||||
|
||||
bool hideRouteLineOpacity() const { return hideRouteLineOpacityCk->isChecked(); }
|
||||
void setRouteLineOpacity(bool x) { hideRouteLineOpacityCk->setChecked(x); }
|
||||
|
||||
bool showMarkers() const { return ( showMarkersCk->checkState() == Qt::Checked); }
|
||||
void setShowMarkers(bool x) { if (x) showMarkersCk->setCheckState(Qt::Checked); else showMarkersCk->setCheckState(Qt::Unchecked) ;}
|
||||
|
||||
@@ -161,6 +165,7 @@ class RideMapWindow : public GcChartWindow
|
||||
void showFullPlotChanged(int value);
|
||||
void hideShadedZonesChanged(int value);
|
||||
void hideYellowLineChanged(int value);
|
||||
void hideRouteLineOpacityChanged(int value);
|
||||
void showIntervalsChanged(int value);
|
||||
void osmCustomTSURLEditingFinished();
|
||||
|
||||
@@ -181,7 +186,7 @@ class RideMapWindow : public GcChartWindow
|
||||
|
||||
QComboBox *mapCombo, *tileCombo;
|
||||
QCheckBox *showMarkersCk, *showFullPlotCk, *showInt;
|
||||
QCheckBox* hideShadedZonesCk, * hideYellowLineCk;
|
||||
QCheckBox* hideShadedZonesCk, * hideYellowLineCk, * hideRouteLineOpacityCk;
|
||||
QLabel *osmTSTitle, *osmTSLabel, *osmTSUrlLabel;
|
||||
QLineEdit *osmTSUrl;
|
||||
|
||||
|
||||
@@ -249,6 +249,7 @@ void GCColor::setupColors()
|
||||
{ tr("Gui"), tr("Chartbar background"), "CCHARTBAR", Qt::lightGray },
|
||||
{ tr("Gui"), tr("Overview Tile Background Alternate"), "CCARDBACKGROUND2", QColor(0,0,0) },
|
||||
{ tr("Gui"), tr("Overview Tile Background Vibrant"), "CCARDBACKGROUND3", QColor(52,52,52) },
|
||||
{ tr("Gui"), tr("Map Route Line"), "MAPROUTELINE", Qt::red },
|
||||
{ "", "", "", QColor(0,0,0) },
|
||||
};
|
||||
|
||||
@@ -377,7 +378,8 @@ void GCColor::setupColors()
|
||||
LightDefaultColorList[102].color = QColor(134,74,255); // 102:Respiratory Frequency
|
||||
LightDefaultColorList[103].color = QColor(255,46,46); // 103:FeO2
|
||||
LightDefaultColorList[106].color = QColor(180,180,180); // 106:Tile Alternate
|
||||
LightDefaultColorList[107].color = QColor(0xee,0xf8,0xff); // 107:Tile Vibrant
|
||||
LightDefaultColorList[107].color = QColor(238,248,255); // 107:Tile Vibrant
|
||||
LightDefaultColorList[108].color = QColor(255, 0, 0); // 105:MapRouteLine
|
||||
}
|
||||
|
||||
// default settings for fonts etc
|
||||
|
||||
@@ -186,7 +186,7 @@ class ColorEngine : public QObject
|
||||
#define GColor(x) GCColor::getColor(x)
|
||||
|
||||
// Define how many cconfigurable metric colors are available
|
||||
#define CNUMOFCFGCOLORS 108
|
||||
#define CNUMOFCFGCOLORS 109
|
||||
|
||||
#define CPLOTBACKGROUND 0
|
||||
#define CRIDEPLOTBACKGROUND 1
|
||||
@@ -296,4 +296,5 @@ class ColorEngine : public QObject
|
||||
#define CCHARTBAR 105
|
||||
#define CCARDBACKGROUND2 106
|
||||
#define CCARDBACKGROUND3 107
|
||||
#define MAPROUTELINE 108
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user