From 1751d8bf12557ed2ecdd63ea6e9ae3299b201124 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sun, 4 Apr 2010 21:38:54 +0100 Subject: [PATCH 1/7] Remove update 'flicker' when tab selected The recent patch to reduce redraws when rides are selected causes each tab to redraw whenever the tab IS selected. This patch reduces this by remembering the current ride plotted. It also fixes the "double draw" in GoogleMapControl and AllPlot when selected for the first time. --- src/AllPlotWindow.cpp | 11 +++++++++-- src/AllPlotWindow.h | 2 ++ src/GoogleMapControl.cpp | 22 ++++++++++++++-------- src/GoogleMapControl.h | 1 + src/ModelWindow.cpp | 5 +++++ src/ModelWindow.h | 2 ++ src/PfPvWindow.cpp | 7 ++++++- src/PfPvWindow.h | 1 + 8 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 1956ba769..c57cb47a9 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -239,15 +239,22 @@ AllPlotWindow::rideSelected() if (mainWindow->activeTab() != this) return; RideItem *ride = mainWindow->rideItem(); - if (!ride) + if (!ride || ride == current) return; + current = ride; + + int showit = showStack->isChecked(); + if (showit) allPlot->hide(); + else allPlot->show(); + + // set it up anyway since the stack plots + // reuse the arrays clearSelection(); // clear any ride interval selection data setAllPlotWidgets(ride); allPlot->setDataI(ride); allZoomer->setZoomBase(); // update stacked view if that is set - int showit = showStack->isChecked(); setShowStack(0); // zap whats there setShowStack(showit); } diff --git a/src/AllPlotWindow.h b/src/AllPlotWindow.h index db7013143..f5ed33d0a 100644 --- a/src/AllPlotWindow.h +++ b/src/AllPlotWindow.h @@ -99,6 +99,8 @@ class AllPlotWindow : public QWidget QSlider *smoothSlider; QLineEdit *smoothLineEdit; + RideItem *current; + private: void showInfo(QString); void resetStackedDatas(); diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index 733380a4f..06de56b56 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -156,12 +156,13 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) void GoogleMapControl::rideSelected() { - if (parent->activeTab() != this) - return; - RideItem * ride = parent->rideItem(); + if (parent->activeTab() != this) return; - if (!ride) + RideItem * ride = parent->rideItem(); + if (ride == current || !ride || !ride->ride()) return; + else + current = ride; int zone =ride->zoneRange(); if(zone < 0) @@ -177,8 +178,6 @@ GoogleMapControl::rideSelected() double prevLon = 0; double prevLat = 0; - if (ride == NULL || ride->ride() == NULL) return; - foreach(RideFilePoint *rfp,ride->ride()->dataPoints()) { RideFilePoint curRfp = *rfp; @@ -204,8 +203,15 @@ GoogleMapControl::rideSelected() void GoogleMapControl::resizeEvent(QResizeEvent * ) { - newRideToLoad = true; - loadRide(); + static bool first = true; + if (parent->activeTab() != this) return; + + if (first == true) { + first = false; + } else { + newRideToLoad = true; + loadRide(); + } } void GoogleMapControl::loadStarted() diff --git a/src/GoogleMapControl.h b/src/GoogleMapControl.h index dfa2a6841..a9bae91f9 100644 --- a/src/GoogleMapControl.h +++ b/src/GoogleMapControl.h @@ -64,6 +64,7 @@ Q_OBJECT int rideCP; // current HTML for the ride std::ostringstream currentPage; + RideItem *current; public slots: void rideSelected(); diff --git a/src/ModelWindow.cpp b/src/ModelWindow.cpp index eed006f4a..c944934a2 100644 --- a/src/ModelWindow.cpp +++ b/src/ModelWindow.cpp @@ -92,6 +92,7 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) : styleSelector->addItem(tr("Bar")); styleSelector->addItem(tr("Grid")); styleSelector->addItem(tr("Surface")); + styleSelector->addItem(tr("Dots")); styleSelector->setCurrentIndex(0); ignore = new QCheckBox(tr("Ignore Zero")); @@ -188,6 +189,10 @@ ModelWindow::rideSelected() if (main->activeTab() != this) return; ride = main->rideItem(); + + if (!ride || !ride->ride() || ride == current) + + current = ride; setData(true); } diff --git a/src/ModelWindow.h b/src/ModelWindow.h index b9ea60794..3a9a822c8 100644 --- a/src/ModelWindow.h +++ b/src/ModelWindow.h @@ -115,6 +115,8 @@ class ModelWindow : public QWidget // z pane slider QSlider *zpane; + RideItem *current; + private: void addStandardChannels(QComboBox *); diff --git a/src/PfPvWindow.cpp b/src/PfPvWindow.cpp index 87a77dc8b..4468fb9a9 100644 --- a/src/PfPvWindow.cpp +++ b/src/PfPvWindow.cpp @@ -91,11 +91,16 @@ PfPvWindow::rideSelected() { if (mainWindow->activeTab() != this) return; + + RideItem *ride = mainWindow->rideItem(); - if (!ride || !ride->ride()) + if (ride == current || !ride || !ride->ride()) return; pfPvPlot->setData(ride); + + current = ride; + // update the QLabel widget with the CP value set in PfPvPlot::setData() qaCPValue->setText(QString("%1").arg(pfPvPlot->getCP())); } diff --git a/src/PfPvWindow.h b/src/PfPvWindow.h index fd91c53bd..4d78f70cc 100644 --- a/src/PfPvWindow.h +++ b/src/PfPvWindow.h @@ -60,6 +60,7 @@ class PfPvWindow : public QWidget QLineEdit *qaCPValue; QLineEdit *qaCadValue; QLineEdit *qaClValue; + RideItem *current; }; #endif // _GC_PfPvWindow_h From afb9a44fe28bf5b68b5bd89b3d3e63f3caec4727 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Tue, 6 Apr 2010 21:36:58 -0400 Subject: [PATCH 2/7] fix ugly formatting --- src/DanielsPoints.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/DanielsPoints.cpp b/src/DanielsPoints.cpp index 6dd1e3761..c017c5bce 100644 --- a/src/DanielsPoints.cpp +++ b/src/DanielsPoints.cpp @@ -112,10 +112,11 @@ class DanielsEquivalentPower : public RideMetric { } void compute(const RideFile *, const Zones *zones, int zoneRange, - const QHash &deps) { - if (!zones || zoneRange < 0) { + const QHash &deps) + { + if (!zones || zoneRange < 0) { setValue(0); - return; + return; } double cp = zones->getCP(zoneRange); From fbdd15f2189747545efaa30bec936e25df626d52 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Tue, 6 Apr 2010 21:37:27 -0400 Subject: [PATCH 3/7] fix Daniels EqP when Time Riding == 0.0 --- src/DanielsPoints.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DanielsPoints.cpp b/src/DanielsPoints.cpp index c017c5bce..c2d4a272a 100644 --- a/src/DanielsPoints.cpp +++ b/src/DanielsPoints.cpp @@ -128,7 +128,7 @@ class DanielsEquivalentPower : public RideMetric { assert(timeRiding); double score = danielsPoints->value(true); double secs = timeRiding->value(true); - watts = cp * pow(score / DanielsPoints::K / secs, 0.25); + watts = secs == 0.0 ? 0.0 : cp * pow(score / DanielsPoints::K / secs, 0.25); setValue(watts); } From 4ca86c441de537b7d4901fa283f8e13c1f44876e Mon Sep 17 00:00:00 2001 From: "Patrick J. McNerthney" Date: Tue, 6 Apr 2010 16:10:31 -1000 Subject: [PATCH 4/7] Enhanced src/src.pro to detect the standard Debian/Ubuntu install set up of qwtplot3d and use that if QWT3D_INSTALL is not defined. --- src/src.pro | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/src.pro b/src/src.pro index a35ea7240..9b6b107f8 100644 --- a/src/src.pro +++ b/src/src.pro @@ -24,13 +24,21 @@ LIBS += -lm SOURCES += SrmDevice.cpp } -!isEmpty( QWT3D_INSTALL) { - INCLUDEPATH += $${QWT3D_INSTALL}/include - LIBS += $${QWT3D_INSTALL}/lib/libqwtplot3d.a - QT += opengl - HEADERS += ModelPlot.h ModelWindow.h - SOURCES += ModelPlot.cpp ModelWindow.cpp - DEFINES += GC_HAVE_QWTPLOT3D +!isEmpty( QWT3D_INSTALL ) { + INCLUDEPATH += $${QWT3D_INSTALL}/include + LIBS += $${QWT3D_INSTALL}/lib/libqwtplot3d.a + CONFIG += qwt3d +} +isEmpty( QWT3D_INSTALL ):linux-g++:exists( /usr/include/qwtplot3d-qt4 ):exists( /usr/lib/libqwtplot3d-qt4.so ) { + INCLUDEPATH += /usr/include/qwtplot3d-qt4 + LIBS += /usr/lib/libqwtplot3d-qt4.so + CONFIG += qwt3d +} +qwt3d { + QT += opengl + HEADERS += ModelPlot.h ModelWindow.h + SOURCES += ModelPlot.cpp ModelWindow.cpp + DEFINES += GC_HAVE_QWTPLOT3D } macx { From ac570c415c9ca20c88ea20df51cab39d15834600 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Sun, 11 Apr 2010 17:19:33 -0400 Subject: [PATCH 5/7] make sure "current" is initialized Also, a nit: fix indentation of 1 line in AllPlotWindow.h. --- src/AllPlotWindow.cpp | 2 +- src/AllPlotWindow.h | 2 +- src/GoogleMapControl.cpp | 2 +- src/ModelWindow.cpp | 2 +- src/PfPvWindow.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index c57cb47a9..dbd1715a7 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -36,7 +36,7 @@ #include AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) : - QWidget(mainWindow), mainWindow(mainWindow) + QWidget(mainWindow), mainWindow(mainWindow), current(NULL) { QVBoxLayout *vlayout = new QVBoxLayout; diff --git a/src/AllPlotWindow.h b/src/AllPlotWindow.h index f5ed33d0a..54d990be2 100644 --- a/src/AllPlotWindow.h +++ b/src/AllPlotWindow.h @@ -99,7 +99,7 @@ class AllPlotWindow : public QWidget QSlider *smoothSlider; QLineEdit *smoothLineEdit; - RideItem *current; + RideItem *current; private: void showInfo(QString); diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index 06de56b56..43f613dfc 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -139,7 +139,7 @@ using namespace gm; #define GOOGLE_KEY "ABQIAAAAS9Z2oFR8vUfLGYSzz40VwRQ69UCJw2HkJgivzGoninIyL8-QPBTtnR-6pM84ljHLEk3PDql0e2nJmg" -GoogleMapControl::GoogleMapControl(MainWindow *mw) +GoogleMapControl::GoogleMapControl(MainWindow *mw) : current(NULL) { parent = mw; view = new QWebView(); diff --git a/src/ModelWindow.cpp b/src/ModelWindow.cpp index c944934a2..eecf53341 100644 --- a/src/ModelWindow.cpp +++ b/src/ModelWindow.cpp @@ -46,7 +46,7 @@ ModelWindow::addStandardChannels(QComboBox *box) } ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) : - QWidget(parent), home(home), main(parent), ride(NULL) + QWidget(parent), home(home), main(parent), ride(NULL), current(NULL) { // Layouts QVBoxLayout *mainLayout = new QVBoxLayout; diff --git a/src/PfPvWindow.cpp b/src/PfPvWindow.cpp index 4468fb9a9..a880d0dab 100644 --- a/src/PfPvWindow.cpp +++ b/src/PfPvWindow.cpp @@ -23,7 +23,7 @@ #include PfPvWindow::PfPvWindow(MainWindow *mainWindow) : - QWidget(mainWindow), mainWindow(mainWindow) + QWidget(mainWindow), mainWindow(mainWindow), current(NULL) { QVBoxLayout *vlayout = new QVBoxLayout; QHBoxLayout *qaLayout = new QHBoxLayout; From d77c6ed576cfaa929533a909107f4ec28e778a8b Mon Sep 17 00:00:00 2001 From: Julian Baumgartner Date: Wed, 17 Mar 2010 20:40:46 -0600 Subject: [PATCH 6/7] added the javascript routine to do mouse overs --- src/GoogleMapControl.cpp | 94 +++++++++++++++++++++++++++++++++++++--- src/GoogleMapControl.h | 3 +- 2 files changed, 89 insertions(+), 8 deletions(-) diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index 43f613dfc..a5a95afc7 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -290,6 +290,7 @@ void GoogleMapControl::createHtml() << "GoldenCheetah" << endl << "" << endl + << CreateMapToolTipJavaScript() << endl << "" << endl << "" << endl << "" << endl - << "
" << endl << "
" << endl << "
" << endl << "" << endl << "" << endl; - currentPage << oss.str(); + currentPage << oss.str(); } @@ -361,11 +362,12 @@ string GoogleMapControl::CreatePolyLine() intervalPoints.end(), AvgPower()); // find the color - QColor color = GetColor(rideCP,avgPower); + // create the polyline - CreateSubPolyLine(intervalPoints,oss,color); + CreateSubPolyLine(intervalPoints,oss,avgPower); intervalPoints.clear(); intervalPoints.push_back(rfp); + } } @@ -375,12 +377,13 @@ string GoogleMapControl::CreatePolyLine() void GoogleMapControl::CreateSubPolyLine(const std::vector &points, std::ostringstream &oss, - QColor color) + int avgPower) { oss.precision(6); + QColor color = GetColor(rideCP,avgPower); QString colorstr = color.name(); oss.setf(ios::fixed,ios::floatfield); - oss << "map.addOverlay (new GPolyline(["; + oss << "var polyline = new GPolyline(["; BOOST_FOREACH(RideFilePoint rfp, points) { @@ -389,8 +392,21 @@ void GoogleMapControl::CreateSubPolyLine(const std::vector &point oss << "new GLatLng(" << rfp.lat << "," << rfp.lon << ")," << endl; } } + oss << "],\"" << colorstr.toStdString() << "\",4);" << endl; - oss << "],\"" << colorstr.toStdString() << "\",5));"; + oss << "GEvent.addListener(polyline, 'mouseover', function() {" << endl + << "var tooltip_text = '30s Power: " << avgPower << "';" << endl + << "var ss={'weight':8};" << endl + << "this.setStrokeStyle(ss);" << endl + << "this.overlay = new MapTooltip(this,tooltip_text);" << endl + << "map.addOverlay(this.overlay);" << endl + << "});" << endl + << "GEvent.addListener(polyline, 'mouseout', function() {" << endl + << "map.removeOverlay(this.overlay);" << endl + << "var ss={'weight':5};" << endl + << "this.setStrokeStyle(ss);" << endl + << "});" << endl; + oss << "map.addOverlay (polyline);" << endl; } @@ -466,3 +482,67 @@ string GoogleMapControl::CreateIntervalMarkers() } return oss.str(); } + +string GoogleMapControl::CreateMapToolTipJavaScript() +{ + ostringstream oss; + oss << " "<< endl; + return oss.str(); +} diff --git a/src/GoogleMapControl.h b/src/GoogleMapControl.h index a9bae91f9..7cdc858b3 100644 --- a/src/GoogleMapControl.h +++ b/src/GoogleMapControl.h @@ -46,7 +46,8 @@ Q_OBJECT std::string CreatePolyLine(); void CreateSubPolyLine(const std::vector &points, std::ostringstream &oss, - QColor color); + int avgPower); + std::string CreateMapToolTipJavaScript(); std::string CreateIntervalMarkers(); void loadRide(); // the web browser is loading a page, do NOT start another load From a6917a682ac642fb0eab43bb5080f59471c34392 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 1 Mar 2010 13:53:54 +0000 Subject: [PATCH 7/7] Metrics & Maps update for Win32 installer The new metrics feature requires the SQLITE plugins to be deployed alongside the binary and the forthcoming Google Maps patch requires QtWebKit, Phonon, Xml and Xmlpatterns deployed. Additionally, the terrain view requires the jpeg image formats deplyed. This patch updates the win32 NSI script to include these new dependencies and has been tested for Win 7, Vista and XP SP3. fixes #51 --- src/win32/GoldenCheetahInstall.nsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/win32/GoldenCheetahInstall.nsi b/src/win32/GoldenCheetahInstall.nsi index 6750d7efc..3546fd137 100644 --- a/src/win32/GoldenCheetahInstall.nsi +++ b/src/win32/GoldenCheetahInstall.nsi @@ -62,11 +62,20 @@ Section "Golden Cheetah (required)" File "..\release\QtGui4.dll" File "..\release\QtSql4.dll" File "..\release\QtXml4.dll" + File "..\release\QtWebKit4.dll" + File "..\release\QtXmlPatterns4.dll" + File "..\release\phonon4.dll" File "..\release\QtNetwork4.dll" File "..\release\QtOpenGL4.dll" File "..\release\libgcc_s_dw2-1.dll" File "..\release\qwtplot3d.dll" + SetOutPath $INSTDIR\sqldrivers + File "..\release\qsqlite4.dll" + + SetOutPath $INSTDIR\imageformats + File "..\release\qjpeg4.dll" + ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\GoldenCheetah "Install_Dir" "$INSTDIR" @@ -109,11 +118,16 @@ Section "Uninstall" Delete $INSTDIR\QtGui4.dll Delete $INSTDIR\QtSql4.dll Delete $INSTDIR\QtXml4.dll + Delete $INSTDIR\QtWebKit4.dll + Delete $INSTDIR\QtXmlPatterns4.dll + Delete $INSTDIR\phonon4.dll Delete $INSTDIR\QtNetwork4.dll Delete $INSTDIR\QtOpenGL4.dll Delete $INSTDIR\libgcc_s_dw2-1.dll Delete $INSTDIR\qwtplot3d.dll Delete $INSTDIR\uninstall.exe + Delete $INSTDIR\sqldrivers\qsqlite4.dll + Delete $INSTDIR\imageformats\qjpeg4.dll ; Remove shortcuts, if any Delete "$SMPROGRAMS\GoldenCheetah\*.*"