diff --git a/src/MetricAggregator.cpp b/src/MetricAggregator.cpp index 197350620..c1d10decb 100644 --- a/src/MetricAggregator.cpp +++ b/src/MetricAggregator.cpp @@ -547,6 +547,9 @@ MetricAggregator::refreshCPModelMetrics(bool bg) QDate firstOfMonth = QDate(year, month, 01); QDate lastOfMonth = firstOfMonth.addMonths(1).addDays(-1); + // let others know where we got to... + emit modelProgress(year, month); + // months is a rolling 3 months sets of bests QVector wpk; // for getting the wpk values months << RideFileCache::meanMaxPowerFor(context, wpk, firstOfMonth, lastOfMonth); @@ -655,4 +658,5 @@ MetricAggregator::refreshCPModelMetrics(bool bg) #if (!defined Q_OS_MAC) || (defined QT_NOBUG39038) || (QT_VERSION < 0x050300) // QTBUG 39038 !!! if (!bg) delete bar; #endif + emit modelProgress(0, 0); // all done } diff --git a/src/MetricAggregator.h b/src/MetricAggregator.h index fa077ff13..6746dfdc2 100644 --- a/src/MetricAggregator.h +++ b/src/MetricAggregator.h @@ -62,6 +62,7 @@ class MetricAggregator : public QObject signals: void dataChanged(); // when metricDB table changed + void modelProgress(int, int); // let others know when we're refreshing the model estimates public slots: void update(); diff --git a/src/RideSummaryWindow.cpp b/src/RideSummaryWindow.cpp index e4a7103a8..8097723e6 100644 --- a/src/RideSummaryWindow.cpp +++ b/src/RideSummaryWindow.cpp @@ -106,6 +106,7 @@ RideSummaryWindow::RideSummaryWindow(Context *context, bool ridesummary) : } connect(context, SIGNAL(configChanged()), this, SLOT(configChanged())); connect(this, SIGNAL(doRefresh()), this, SLOT(refresh())); + connect(context->athlete->metricDB, SIGNAL(modelProgress(int,int)), this, SLOT(modelProgress(int,int))); setChartLayout(vlayout); configChanged(); // set colors @@ -158,6 +159,24 @@ RideSummaryWindow::setFilter(QStringList list) } #endif +void +RideSummaryWindow::modelProgress(int year, int month) +{ + // ignore if not visible! + if (!amVisible()) return; + + QString string; + + if (!year && !month) { + string = "

Model

"; + } else { + string = QString("

Modeling
%1 %2

").arg(QDate::shortMonthName(month)).arg(year); + } + rideSummary->page()->mainFrame()->evaluateJavaScript( + QString("var div = document.getElementById(\"modhead\"); div.innerHTML = '%1'; ").arg(string));; + +} + void RideSummaryWindow::compareChanged() { @@ -572,10 +591,10 @@ RideSummaryWindow::htmlSummary() // MODEL // lets get a table going summary += "" - ""; + ""; summary = summary.arg(90 / columnNames.count()+1); - summary = summary.arg(tr("Model")); + summary = summary.arg(tr("

Model

")); // W; summary += QString("") diff --git a/src/RideSummaryWindow.h b/src/RideSummaryWindow.h index 20328ba80..49a9ec47c 100644 --- a/src/RideSummaryWindow.h +++ b/src/RideSummaryWindow.h @@ -113,6 +113,9 @@ class RideSummaryWindow : public GcChartWindow // config changed void configChanged(); + // model estimate progress updates + void modelProgress(int year, int month); + signals: void doRefresh();

%2

%2
%1:%2 kJ